From e7605dd08b460bc824b1f568c62b20a50d3fa18b Mon Sep 17 00:00:00 2001 From: Jude Taylor Date: Wed, 23 Sep 2015 16:13:29 -0700 Subject: [PATCH] add nodejs-4.1.0 --- pkgs/development/libraries/libuv/default.nix | 1 + .../web/nodejs/no-xcode-4.1.0.patch | 95 +++++++++++++++++++ pkgs/development/web/nodejs/v4_1_0.nix | 53 +++++++++++ pkgs/top-level/all-packages.nix | 7 +- 4 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/web/nodejs/no-xcode-4.1.0.patch create mode 100644 pkgs/development/web/nodejs/v4_1_0.nix diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix index 8052f0bc731..2a35264799b 100644 --- a/pkgs/development/libraries/libuv/default.nix +++ b/pkgs/development/libraries/libuv/default.nix @@ -109,4 +109,5 @@ in mapAttrs (v: h: mkWithAutotools stable (toVersion v) h) { v1_2_0 = "1nbp8qpgw64gl9nrjzxw0ndv1m64cfms0cy5a2883vw6877kizmx"; v1_6_1 = "10w9pjbmqcv03v04rnjd8mdh886j7v4y0svdsdklz69zskgdvvqg"; + v1_7_5 = "18x6cy2xn31am97vn6jli7kmb2fbp4c8kmv7jm97vggh0x55flsc"; } diff --git a/pkgs/development/web/nodejs/no-xcode-4.1.0.patch b/pkgs/development/web/nodejs/no-xcode-4.1.0.patch new file mode 100644 index 00000000000..137158b01b7 --- /dev/null +++ b/pkgs/development/web/nodejs/no-xcode-4.1.0.patch @@ -0,0 +1,95 @@ +diff --git a/configure b/configure +index d199975..66d903b 100755 +--- a/configure ++++ b/configure +@@ -734,7 +734,7 @@ def configure_library(lib, output): + # libpath needs to be provided ahead libraries + if pkg_libpath: + output['libraries'] += ( +- filter(None, map(str.strip, pkg_cflags.split('-L')))) ++ pkg_libpath.split()) + + default_libs = getattr(options, shared_lib + '_libname') + default_libs = map('-l{0}'.format, default_libs.split(',')) +diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py +index c002b11..fefb765 100644 +--- a/tools/gyp/pylib/gyp/xcode_emulation.py ++++ b/tools/gyp/pylib/gyp/xcode_emulation.py +@@ -446,10 +446,17 @@ class XcodeSettings(object): + + def _XcodeSdkPath(self, sdk_root): + if sdk_root not in XcodeSettings._sdk_path_cache: +- sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path') +- XcodeSettings._sdk_path_cache[sdk_root] = sdk_path +- if sdk_root: +- XcodeSettings._sdk_root_cache[sdk_path] = sdk_root ++ try: ++ sdk_path = self._GetSdkVersionInfoItem(sdk_root, 'Path') ++ XcodeSettings._sdk_path_cache[sdk_root] = sdk_path ++ if sdk_root: ++ XcodeSettings._sdk_root_cache[sdk_path] = sdk_root ++ 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): +@@ -572,10 +579,12 @@ class XcodeSettings(object): + framework_root = sdk_root + else: + framework_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)', framework_root)) ++ ++ if 'SDKROOT' in self._Settings(): ++ config = self.spec['configurations'][self.configname] ++ framework_dirs = config.get('mac_framework_dirs', []) ++ for directory in framework_dirs: ++ cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root)) + + self.configname = None + return cflags +@@ -826,10 +835,12 @@ class XcodeSettings(object): + sdk_root = self._SdkPath() + if not sdk_root: + sdk_root = '' +- config = self.spec['configurations'][self.configname] +- framework_dirs = config.get('mac_framework_dirs', []) +- for directory in framework_dirs: +- ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) ++ ++ if 'SDKROOT' in self._Settings(): ++ config = self.spec['configurations'][self.configname] ++ framework_dirs = config.get('mac_framework_dirs', []) ++ for directory in framework_dirs: ++ ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) + + is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() + if sdk_root and is_extension: +@@ -1032,7 +1043,11 @@ class XcodeSettings(object): + sdk_root = self._SdkPath(config_name) + if not sdk_root: + sdk_root = '' +- return l.replace('$(SDKROOT)', sdk_root) ++ ++ if self._SdkPath(): ++ return l.replace('$(SDKROOT)', sdk_root) ++ else: ++ return l + + def AdjustLibraries(self, libraries, config_name=None): + """Transforms entries like 'Cocoa.framework' in libraries into entries like +@@ -1248,7 +1263,7 @@ def XcodeVersion(): + if version: + version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0] + else: +- raise GypError("No Xcode or CLT version detected!") ++ version = "7.0.0" + # The CLT has no build information, so we return an empty string. + version_list = [version, ''] + version = version_list[0] diff --git a/pkgs/development/web/nodejs/v4_1_0.nix b/pkgs/development/web/nodejs/v4_1_0.nix new file mode 100644 index 00000000000..de8fa5f6bd3 --- /dev/null +++ b/pkgs/development/web/nodejs/v4_1_0.nix @@ -0,0 +1,53 @@ +{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser +, pkgconfig, runCommand, which, libtool +}: + +let + version = "4.1.0"; + + deps = { + inherit openssl zlib libuv; + + # disabled system v8 because v8 3.14 no longer receives security fixes + # we fall back to nodejs' internal v8 copy which receives backports for now + # inherit v8 + } // (stdenv.lib.optionalAttrs (!stdenv.isDarwin) { + inherit http-parser; + }); + + inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms; +in stdenv.mkDerivation { + name = "nodejs-${version}"; + + src = fetchurl { + url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz"; + sha256 = "025lqmhvl7xpx1ip97jwkz21a97sw9zb4zi3y7fgfag59vv0ac25"; + }; + + configureFlags = map (name: "--shared-${name}") (builtins.attrNames deps) ++ [ "--without-dtrace" ]; + + dontDisableStatic = true; + + prePatch = '' + patchShebangs . + ''; + + patches = stdenv.lib.optional stdenv.isDarwin ./no-xcode-4.1.0.patch; + + buildInputs = [ python which ] ++ (builtins.attrValues deps) + ++ optional stdenv.isLinux utillinux + ++ optionals stdenv.isDarwin [ openssl libtool ]; + setupHook = ./setup-hook.sh; + + enableParallelBuilding = true; + + passthru.interpreterName = "nodejs"; + + meta = { + description = "Event-driven I/O framework for the V8 JavaScript engine"; + homepage = http://nodejs.org; + license = licenses.mit; + maintainers = [ maintainers.goibhniu maintainers.havvy ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5f1f09c355..bccccc12bae 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2006,6 +2006,11 @@ let ninka = callPackage ../development/tools/misc/ninka { }; + nodejs-4_1 = callPackage ../development/web/nodejs/v4_1_0.nix { + libuv = libuvVersions.v1_7_5; + openssl = openssl_1_0_2; + }; + nodejs-0_12 = callPackage ../development/web/nodejs { libuv = libuvVersions.v1_6_1; }; @@ -2019,8 +2024,8 @@ let else nodejs-0_12; + nodePackages_4_1 = recurseIntoAttrs (callPackage ./node-packages.nix { self = nodePackages_4_1; nodejs = nodejs-4_1; }); nodePackages_0_12 = callPackage ./node-packages.nix { self = nodePackages_0_12; nodejs = nodejs-0_12; }; - nodePackages_0_10 = callPackage ./node-packages.nix { self = nodePackages_0_10; nodejs = nodejs-0_10; }; nodePackages = if stdenv.system == "armv5tel-linux" then