gyp: Fix on darwin
Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
fe009bcbc4
commit
c982e84df4
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, gyp, utillinux ? null }:
|
||||
{ stdenv, fetchurl, gyp, utillinux }:
|
||||
|
||||
let
|
||||
version = "2.1";
|
||||
@ -16,7 +16,7 @@ in stdenv.mkDerivation {
|
||||
|
||||
buildFlags = [ "BUILDTYPE=Release" ];
|
||||
|
||||
buildInputs = [ gyp utillinux ];
|
||||
buildInputs = [ gyp ] ++ stdenv.lib.optional stdenv.isLinux utillinux;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
|
40
pkgs/development/python-modules/gyp/no-darwin-cflags.patch
Normal file
40
pkgs/development/python-modules/gyp/no-darwin-cflags.patch
Normal file
@ -0,0 +1,40 @@
|
||||
Index: gyp/pylib/gyp/xcode_emulation.py
|
||||
===================================================================
|
||||
--- gyp/pylib/gyp/xcode_emulation.py (revision 1635)
|
||||
+++ gyp/pylib/gyp/xcode_emulation.py (working copy)
|
||||
@@ -280,9 +280,6 @@
|
||||
if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'):
|
||||
cflags.append('-funsigned-char')
|
||||
|
||||
- if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'):
|
||||
- cflags.append('-fasm-blocks')
|
||||
-
|
||||
if 'GCC_DYNAMIC_NO_PIC' in self._Settings():
|
||||
if self._Settings()['GCC_DYNAMIC_NO_PIC'] == 'YES':
|
||||
cflags.append('-mdynamic-no-pic')
|
||||
@@ -292,9 +289,6 @@
|
||||
# mdynamic-no-pic by default for executable and possibly static lib
|
||||
# according to mento
|
||||
|
||||
- if self._Test('GCC_ENABLE_PASCAL_STRINGS', 'YES', default='YES'):
|
||||
- cflags.append('-mpascal-strings')
|
||||
-
|
||||
self._Appendf(cflags, 'GCC_OPTIMIZATION_LEVEL', '-O%s', default='s')
|
||||
|
||||
if self._Test('GCC_GENERATE_DEBUGGING_SYMBOLS', 'YES', default='YES'):
|
||||
@@ -334,7 +328,6 @@
|
||||
# TODO: Supporting fat binaries will be annoying.
|
||||
self._WarnUnimplemented('ARCHS')
|
||||
archs = ['i386']
|
||||
- cflags.append('-arch ' + archs[0])
|
||||
|
||||
if archs[0] in ('i386', 'x86_64'):
|
||||
if self._Test('GCC_ENABLE_SSE3_EXTENSIONS', 'YES', default='NO'):
|
||||
@@ -570,7 +563,6 @@
|
||||
# TODO: Supporting fat binaries will be annoying.
|
||||
self._WarnUnimplemented('ARCHS')
|
||||
archs = ['i386']
|
||||
- ldflags.append('-arch ' + archs[0])
|
||||
|
||||
# Xcode adds the product directory by default.
|
||||
ldflags.append('-L' + product_dir)
|
66
pkgs/development/python-modules/gyp/no-xcode.patch
Normal file
66
pkgs/development/python-modules/gyp/no-xcode.patch
Normal file
@ -0,0 +1,66 @@
|
||||
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))
|
||||
+ 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())
|
||||
+ if self._SdkPath():
|
||||
+ return l.replace('$(SDKROOT)', self._SdkPath())
|
||||
+ else:
|
||||
+ return l
|
||||
|
||||
def AdjustLibraries(self, libraries):
|
||||
"""Transforms entries like 'Cocoa.framework' in libraries into entries like
|
@ -1887,15 +1887,17 @@ pythonPackages = python.modules // rec {
|
||||
|
||||
|
||||
gyp = buildPythonPackage rec {
|
||||
rev = "1435";
|
||||
rev = "1635";
|
||||
name = "gyp-r${rev}";
|
||||
|
||||
src = fetchsvn {
|
||||
url = "http://gyp.googlecode.com/svn/trunk";
|
||||
inherit rev;
|
||||
sha256 = "1wmd1svx5344alb8ff9vzdam1ccqdl0h7shp1xnsk843hqwc0fz0";
|
||||
sha256 = "1hn5gxgj2z399f71kz11m61ifds7mx4zkymnd1c87k1wyp7bs5k5";
|
||||
};
|
||||
|
||||
patches = if pkgs.stdenv.isDarwin then [ ../development/python-modules/gyp/no-xcode.patch ../development/python-modules/gyp/no-darwin-cflags.patch ] else null;
|
||||
|
||||
# error: invalid command 'test'
|
||||
doCheck = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user