about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Vollmert <rob@vllmrt.net>2017-06-22 21:18:47 +0200
committerRobert Vollmert <rob@vllmrt.net>2017-06-26 21:28:43 +0200
commitc3da83cd40176b6c18db1ca311e448b9602fbe1e (patch)
treed7b254463133707e96c8dc6450c488b37d8e3ffc
parent2da82a1d19ce47c9c23cd2832cdbab6e297b97c9 (diff)
downloadnixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar.gz
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar.bz2
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar.lz
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar.xz
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.tar.zst
nixlib-c3da83cd40176b6c18db1ca311e448b9602fbe1e.zip
v8_3_16_14: fix OS X build
Issues addressed:
- xcode build failed with
    ... was built for newer OSX version (10.10) than being linked (10.5)
  fixed by setting GYP mac deployment target to the nix value
- a gyp bug when SDKROOT is not set (and removed an orphaned gyp patch
- path to python in generated gyp-mac-tool
- noisy build due to static assert warnings, by silencing warnings
- use of system xcodebuild and libtool replaced by darwin.cctools
-rw-r--r--pkgs/development/libraries/v8/3.16.14.nix14
-rw-r--r--pkgs/development/python-modules/gyp/no-xcode.patch70
-rw-r--r--pkgs/top-level/all-packages.nix1
-rw-r--r--pkgs/top-level/python-packages.nix1
4 files changed, 18 insertions, 68 deletions
diff --git a/pkgs/development/libraries/v8/3.16.14.nix b/pkgs/development/libraries/v8/3.16.14.nix
index 91a8763d43f9..73f5febb6685 100644
--- a/pkgs/development/libraries/v8/3.16.14.nix
+++ b/pkgs/development/libraries/v8/3.16.14.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux}:
+{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux, cctools }:
 
 assert readline != null;
 
@@ -24,9 +24,7 @@ stdenv.mkDerivation rec {
   '';
 
   configurePhase = stdenv.lib.optionalString stdenv.isDarwin ''
-    ln -s /usr/bin/xcodebuild $TMPDIR
-    ln -s /usr/bin/libtool $TMPDIR
-    export PATH=$TMPDIR:$PATH
+    export GYP_DEFINES="mac_deployment_target=$MACOSX_DEPLOYMENT_TARGET"
   '' + ''
     PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
       ${gyp}/bin/gyp \
@@ -41,12 +39,16 @@ stdenv.mkDerivation rec {
         ${lib.optionalString armHardFloat "-Dv8_use_arm_eabi_hardfloat=true"} \
         --depth=. -Ibuild/standalone.gypi \
         build/all.gyp
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's@/usr/bin/env python@${python}/bin/python@g' out/gyp-mac-tool
   '';
 
   nativeBuildInputs = [ which ];
-  buildInputs = [ readline python icu ] ++ lib.optional stdenv.isLinux utillinux;
+  buildInputs = [ readline python icu ]
+                  ++ lib.optional stdenv.isLinux utillinux
+                  ++ lib.optional stdenv.isDarwin cctools;
 
-  NIX_CFLAGS_COMPILE = "-Wno-error";
+  NIX_CFLAGS_COMPILE = "-Wno-error -w";
 
   buildFlags = [
     "-C out"
diff --git a/pkgs/development/python-modules/gyp/no-xcode.patch b/pkgs/development/python-modules/gyp/no-xcode.patch
index eb33a2b9987c..d202b7224744 100644
--- a/pkgs/development/python-modules/gyp/no-xcode.patch
+++ b/pkgs/development/python-modules/gyp/no-xcode.patch
@@ -1,66 +1,12 @@
-Index: pylib/gyp/xcode_emulation.py
-diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py
-index b2aab986a427d5285d70558bf97f0a42bfe1556e..20592c73fae660009aac621097cf3c4fb61d6cb6 100644
 --- a/pylib/gyp/xcode_emulation.py
 +++ b/pylib/gyp/xcode_emulation.py
-@@ -236,8 +236,14 @@ class XcodeSettings(object):
-     if sdk_root.startswith('/'):
-       return sdk_root
-     if sdk_root not in XcodeSettings._sdk_path_cache:
--      XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem(
--          sdk_root, 'Path')
-+      try:
-+        XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem(
-+            sdk_root, 'Path')
-+      except:
-+        # if this fails it's because xcodebuild failed, which means
-+        # the user is probably on a CLT-only system, where there
-+        # is no valid SDK root
-+        XcodeSettings._sdk_path_cache[sdk_root] = None
-     return XcodeSettings._sdk_path_cache[sdk_root]
- 
-   def _AppendPlatformVersionMinFlags(self, lst):
-@@ -340,10 +346,11 @@ class XcodeSettings(object):
- 
-     cflags += self._Settings().get('WARNING_CFLAGS', [])
- 
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      cflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
+@@ -1470,7 +1470,8 @@
+     sdk_root = xcode_settings._SdkRoot(configuration)
+     if not sdk_root:
+       sdk_root = xcode_settings._XcodeSdkPath('')
+-    env['SDKROOT'] = sdk_root
 +    if sdk_root:
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        cflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
- 
-     self.configname = None
-     return cflags
-@@ -573,10 +580,11 @@ class XcodeSettings(object):
-     for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []):
-       ldflags.append('-Wl,-rpath,' + rpath)
- 
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      ldflags.append('-F' + directory.replace('$(SDKROOT)', self._SdkPath()))
-+    if self._SdkPath():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        ldflags.append('-F' + directory.replace('$(SDKROOT)', self._SdkPath()))
- 
-     self.configname = None
-     return ldflags
-@@ -701,7 +709,10 @@ class XcodeSettings(object):
-         l = '-l' + m.group(1)
-       else:
-         l = library
--    return l.replace('$(SDKROOT)', self._SdkPath(config_name))
-+    if self._SdkPath():
-+      return l.replace('$(SDKROOT)', self._SdkPath(config_name))
-+    else:
-+      return l
++      env['SDKROOT'] = sdk_root
  
-   def AdjustLibraries(self, libraries, config_name=None):
-     """Transforms entries like 'Cocoa.framework' in libraries into entries like
+   if not additional_settings:
+     additional_settings = {}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 92bfbdef2afd..5a9fe75b3321 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10300,6 +10300,7 @@ with pkgs;
 
   v8_3_16_14 = callPackage ../development/libraries/v8/3.16.14.nix {
     inherit (python2Packages) python gyp;
+    cctools = darwin.cctools;
   };
 
   v8_3_24_10 = callPackage ../development/libraries/v8/3.24.10.nix {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 906f9b6b3919..6343a35791d2 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -11915,6 +11915,7 @@ in {
 
     patches = optionals pkgs.stdenv.isDarwin [
       ../development/python-modules/gyp/no-darwin-cflags.patch
+      ../development/python-modules/gyp/no-xcode.patch
     ];
 
     disabled = isPy3k;