From 15bfee85f35231be92e439e7f3f02e9aba34dcdf Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 22 Mar 2018 01:22:05 +0300 Subject: impureUseNativeOptimizations: add stdenv adapter This allows one to force a compiler to use native machine optimizations. This goes contrary to all the usual guarantees of Nix and so should be used only by end-user and only in specific cases when they know what are they doing. In my case this is needed to get a noticeable FPS boost in RPCS3 which is very CPU-hungry PlayStation 3 emulator. --- pkgs/stdenv/adapters.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 734119491a0b..d3f7e4e99331 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -210,4 +210,19 @@ rec { NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -fuse-ld=gold"; }); }; + + + /* Modify a stdenv so that it builds binaries optimized specifically + for the machine they are built on. + + WARNING: this breaks purity! */ + impureUseNativeOptimizations = stdenv: stdenv // + { mkDerivation = args: stdenv.mkDerivation (args // { + NIX_CFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " -march=native"; + NIX_ENFORCE_NO_NATIVE = false; + + preferLocalBuild = true; + allowSubstitutes = false; + }); + }; } -- cgit 1.4.1 From e841ffec180ea911148a0147cea5e656d79802b3 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Mon, 13 Aug 2018 08:47:26 +0900 Subject: darwin stdenv stage1: use default cmake --- pkgs/stdenv/darwin/default.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 22dd700b2dda..3dcb37773959 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -190,7 +190,6 @@ in rec { stage1 = prevStage: let persistent = self: super: with prevStage; { cmake = super.cmake.override { - majorVersion = "3.9"; # FIXME: update ApplicationServices patch isBootstrap = true; useSharedLibraries = false; }; -- cgit 1.4.1 From 7931d455a469a3f5ac533f13f4f713ea8cb9c1cf Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 22:03:51 +0000 Subject: stdenv: linux: cleanup a bit --- pkgs/stdenv/linux/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index de58178a34ba..b29a96314d2c 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -343,8 +343,8 @@ in # Mainly avoid reference to bootstrap tools allowedRequisites = with prevStage; with lib; # Simple executable tools - concatMap (p: [ (getBin p) (getLib p) ]) - [ gzip bzip2 xz bash binutils.bintools coreutils diffutils findutils + concatMap (p: [ (getBin p) (getLib p) ]) [ + gzip bzip2 xz bash binutils.bintools coreutils diffutils findutils gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl ] # Library dependencies -- cgit 1.4.1 From c63ca0a431a7a3bdf2aaae05b2acca86d8c1e7bd Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Wed, 5 Sep 2018 01:08:14 +0000 Subject: stdenv: implement enableParallelChecking option Works similarly to `enableParallelBuilding`, but is set by default when `enableParallelBuilding` is set. In my experience most packages that build fine in parallel also check fine in parallel. --- pkgs/stdenv/generic/make-derivation.nix | 2 ++ pkgs/stdenv/generic/setup.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index e1ce3200e8c9..3f35dce2eb29 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -227,6 +227,8 @@ rec { inherit doCheck doInstallCheck; inherit outputs; + } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { + enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 141e94c5ed46..e51dc1f1a0a6 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1044,7 +1044,7 @@ checkPhase() { # Old bash empty array hack # shellcheck disable=SC2086 local flagsArray=( - ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} + ${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget} @@ -1176,7 +1176,7 @@ installCheckPhase() { # Old bash empty array hack # shellcheck disable=SC2086 local flagsArray=( - ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} + ${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck} -- cgit 1.4.1 From 4efd4053ed183d63f09615cf30ea822e708a4fbe Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Sun, 9 Sep 2018 13:36:05 -0400 Subject: stdenv/darwin: integrate a new CoreFoundation This also updates the bootstrap tool builder to LLVM 5, but not the ones we actually use for bootstrap. I'll make that change in a subsequent commit so as to provide traceable provenance of the bootstrap tools. --- .../interpreters/python/cpython/2.7/boot.nix | 9 +++ .../development/libraries/libunistring/default.nix | 14 +++- pkgs/development/libraries/libuv/default.nix | 2 +- .../tools/build-managers/ninja/default.nix | 12 ++-- .../apple-source-releases/CF/add-cfmachport.patch | 22 ------- .../apple-source-releases/CF/cf-bridging.patch | 39 ------------ .../darwin/apple-source-releases/CF/default.nix | 51 --------------- .../apple-source-releases/CF/remove-xpc.patch | 17 ----- .../darwin/apple-source-releases/default.nix | 1 - .../libsecurity_generic/default.nix | 1 - .../libsecurity_keychain/default.nix | 4 -- pkgs/os-specific/darwin/cf-private/default.nix | 74 ++++++++++++++++------ .../darwin/swift-corelibs/corefoundation.nix | 23 +++++-- pkgs/os-specific/darwin/swift-corelibs/default.nix | 8 --- pkgs/stdenv/darwin/default.nix | 47 +++++++++++--- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 3 +- pkgs/top-level/darwin-packages.nix | 10 +-- 17 files changed, 148 insertions(+), 189 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/CF/default.nix delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch delete mode 100644 pkgs/os-specific/darwin/swift-corelibs/default.nix (limited to 'pkgs/stdenv') diff --git a/pkgs/development/interpreters/python/cpython/2.7/boot.nix b/pkgs/development/interpreters/python/cpython/2.7/boot.nix index 7d6f2541d3d1..976d30819dbe 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/boot.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/boot.nix @@ -43,6 +43,15 @@ stdenv.mkDerivation rec { ./deterministic-build.patch ]; + # Hack hack hack to stop shit from failing from a missing _scproxy on Darwin. Since + # we only use this python for bootstrappy things, it doesn't really matter if it + # doesn't have perfect proxy support in urllib :) this just makes it fall back on env + # vars instead of attempting to read the proxy configuration automatically, so not a + # huge loss even if for whatever reason we did want proxy support. + postPatch = '' + substituteInPlace Lib/urllib.py --replace "if sys.platform == 'darwin'" "if False" + ''; + DETERMINISTIC_BUILD = 1; preConfigure = '' diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix index 24da3a8e2c7d..312a5c118103 100644 --- a/pkgs/development/libraries/libunistring/default.nix +++ b/pkgs/development/libraries/libunistring/default.nix @@ -19,7 +19,19 @@ stdenv.mkDerivation rec { doCheck = true; - enableParallelBuilding = true; + /* This seems to cause several random failures like these, which I assume + is because of bad or missing target dependencies in their build system: + + ./unistdio/test-u16-vasnprintf2.sh: line 16: ./test-u16-vasnprintf1: No such file or directory + FAIL unistdio/test-u16-vasnprintf2.sh (exit status: 1) + + FAIL: unistdio/test-u16-vasnprintf3.sh + ====================================== + + ./unistdio/test-u16-vasnprintf3.sh: line 16: ./test-u16-vasnprintf1: No such file or directory + FAIL unistdio/test-u16-vasnprintf3.sh (exit status: 1) + */ + enableParallelBuilding = false; meta = { homepage = http://www.gnu.org/software/libunistring/; diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix index 9ee934cd78bb..f75ce4396a6d 100644 --- a/pkgs/development/libraries/libuv/default.nix +++ b/pkgs/development/libraries/libuv/default.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot" "multiple_listen" "delayed_accept" "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack" - "tty_pty" + "tty_pty" "condvar_5" ]; tdRegexp = lib.concatStringsSep "\\|" toDisable; in lib.optionalString doCheck '' diff --git a/pkgs/development/tools/build-managers/ninja/default.nix b/pkgs/development/tools/build-managers/ninja/default.nix index b1df54f9bd5c..e1637e2f2cab 100644 --- a/pkgs/development/tools/build-managers/ninja/default.nix +++ b/pkgs/development/tools/build-managers/ninja/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchFromGitHub, python, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }: +{ stdenv, fetchFromGitHub, python, buildDocs ? true, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }: + +with stdenv.lib; stdenv.mkDerivation rec { name = "ninja-${version}"; @@ -11,25 +13,27 @@ stdenv.mkDerivation rec { sha256 = "16scq9hcq6c5ap6sy8j4qi75qps1zvrf3p79j1vbrvnqzp928i5f"; }; - nativeBuildInputs = [ python asciidoc docbook_xml_dtd_45 docbook_xsl libxslt.bin re2c ]; + nativeBuildInputs = [ python ] ++ optionals buildDocs [ asciidoc docbook_xml_dtd_45 docbook_xsl libxslt.bin re2c ]; buildPhase = '' python configure.py --bootstrap # "./ninja -vn manual" output copied here to support cross compilation. + '' + optionalString buildDocs '' asciidoc -b docbook -d book -o build/manual.xml doc/manual.asciidoc xsltproc --nonet doc/docbook.xsl build/manual.xml > doc/manual.html ''; installPhase = '' install -Dm555 -t $out/bin ninja - install -Dm444 -t $out/share/doc/ninja doc/manual.asciidoc doc/manual.html install -Dm444 misc/bash-completion $out/share/bash-completion/completions/ninja install -Dm444 misc/zsh-completion $out/share/zsh/site-functions/_ninja + '' + optionalString buildDocs '' + install -Dm444 -t $out/share/doc/ninja doc/manual.asciidoc doc/manual.html ''; setupHook = ./setup-hook.sh; - meta = with stdenv.lib; { + meta = { description = "Small build system with a focus on speed"; longDescription = '' Ninja is a small build system with a focus on speed. It differs from diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch deleted file mode 100644 index a1018d389c14..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- CF-855.17/CoreFoundation.h 2015-01-03 00:17:41.000000000 -0500 -+++ CF-855.17/CoreFoundation.h.new 2015-01-03 00:18:35.000000000 -0500 -@@ -72,6 +72,7 @@ - #include - #include - #include -+#include - #include - #include - #include - ---- CF-855.17/Makefile 2015-01-03 00:32:52.000000000 -0500 -+++ CF-855.17/Makefile.new 2015-01-03 00:33:07.000000000 -0500 -@@ -9,7 +9,7 @@ - HFILES = $(wildcard *.h) - INTERMEDIATE_HFILES = $(addprefix $(OBJBASE)/CoreFoundation/,$(HFILES)) - --PUBLIC_HEADERS=CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CFAvailability.h CFUtilities.h CoreFoundation.h -+PUBLIC_HEADERS=CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMachPort.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CFAvailability.h CFUtilities.h CoreFoundation.h - - PRIVATE_HEADERS=CFBundlePriv.h CFCharacterSetPriv.h CFError_Private.h CFLogUtilities.h CFPriv.h CFRuntime.h CFStorage.h CFStreamAbstract.h CFStreamPriv.h CFStreamInternal.h CFStringDefaultEncoding.h CFStringEncodingConverter.h CFStringEncodingConverterExt.h CFUniChar.h CFUnicodeDecomposition.h CFUnicodePrecomposition.h ForFoundationOnly.h CFBurstTrie.h CFICULogging.h - diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch deleted file mode 100644 index 068a6311a9cb..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/CFBase.h b/CFBase.h -index ffddd2b..e5a926b 100644 ---- a/CFBase.h -+++ b/CFBase.h -@@ -249,6 +249,33 @@ CF_EXTERN_C_BEGIN - #endif - #endif - -+#if __has_attribute(objc_bridge) && __has_feature(objc_bridge_id) && __has_feature(objc_bridge_id_on_typedefs) -+ -+#ifdef __OBJC__ -+@class NSArray; -+@class NSAttributedString; -+@class NSString; -+@class NSNull; -+@class NSCharacterSet; -+@class NSData; -+@class NSDate; -+@class NSTimeZone; -+@class NSDictionary; -+@class NSError; -+@class NSLocale; -+@class NSNumber; -+@class NSSet; -+@class NSURL; -+#endif -+ -+#define CF_BRIDGED_TYPE(T) __attribute__((objc_bridge(T))) -+#define CF_BRIDGED_MUTABLE_TYPE(T) __attribute__((objc_bridge_mutable(T))) -+#define CF_RELATED_TYPE(T,C,I) __attribute__((objc_bridge_related(T,C,I))) -+#else -+#define CF_BRIDGED_TYPE(T) -+#define CF_BRIDGED_MUTABLE_TYPE(T) -+#define CF_RELATED_TYPE(T,C,I) -+#endif - - CF_EXPORT double kCFCoreFoundationVersionNumber; - - diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix b/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix deleted file mode 100644 index 5589d1592f46..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ stdenv, appleDerivation, ICU, dyld, libdispatch, libplatform, launchd, libclosure }: - -# this project uses blocks, a clang-only extension -assert stdenv.cc.isClang; - -appleDerivation { - buildInputs = [ dyld ICU libdispatch libplatform launchd libclosure ]; - - patches = [ ./add-cfmachport.patch ./cf-bridging.patch ./remove-xpc.patch ]; - - __propagatedImpureHostDeps = [ "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" ]; - - preBuild = '' - substituteInPlace Makefile \ - --replace "/usr/bin/clang" "clang" \ - --replace "-arch i386 " "" \ - --replace "/usr/bin/" "" \ - --replace "/usr/sbin/" "" \ - --replace "/bin/" "" \ - --replace "INSTALLNAME=/System" "INSTALLNAME=$out" \ - --replace "install_name_tool -id /System/Library/Frameworks" "install_name_tool -id @rpath" \ - --replace 'chown -RH -f root:wheel $(DSTBASE)/CoreFoundation.framework' "" \ - --replace 'chmod -RH' 'chmod -R' - - # with this file present, CoreFoundation gets a _main symbol defined, which can - # interfere with linking other programs - rm plconvert.c - - replacement=''$'#define __PTK_FRAMEWORK_COREFOUNDATION_KEY5 55\n#define _pthread_getspecific_direct(key) pthread_getspecific((key))\n#define _pthread_setspecific_direct(key, val) pthread_setspecific((key), (val))' - - substituteInPlace CFPlatform.c --replace "#include " "$replacement" - - substituteInPlace CFRunLoop.c --replace "#include " "" - - substituteInPlace CFURLPriv.h \ - --replace "#include " "" \ - --replace "#include " "" \ - --replace "CFFileSecurityRef" "void *" \ - --replace "CFURLEnumeratorResult" "void *" \ - --replace "CFURLEnumeratorRef" "void *" - - export DSTROOT=$out - ''; - - postInstall = '' - mv $out/System/* $out - rmdir $out/System - mv $out/Library/Frameworks/CoreFoundation.framework/Versions/A/PrivateHeaders/* \ - $out/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers - ''; -} diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch deleted file mode 100644 index a7b9fe486434..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CFBundlePriv.h b/CFBundlePriv.h -index d4feb5f..e7b52e8 100644 ---- a/CFBundlePriv.h -+++ b/CFBundlePriv.h -@@ -254,12 +254,6 @@ Boolean _CFBundleGetStringsFilesShared(CFBundleRef bundle); - CF_EXPORT - CFURLRef _CFBundleCopyFrameworkURLForExecutablePath(CFStringRef executablePath); - --#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) --#include --CF_EXPORT --void _CFBundleSetupXPCBootstrap(xpc_object_t bootstrap) CF_AVAILABLE(10_10, 8_0); --#endif -- - /* Functions deprecated as SPI */ - - CF_EXPORT diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index e2d62cef1ba4..d490048c4df3 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -204,7 +204,6 @@ let bootstrap_cmds = applePackage "bootstrap_cmds" "dev-tools-7.0" "1v5dv2q3af1xwj5kz0a5g54fd5dm6j4c9dd2g66n4kc44ixyrhp3" {}; bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {}; CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {}; - CF = applePackage "CF" "osx-10.10.5" "07f5psjxi7wyd13ci4x83ya5hy6p69sjfqcpp2mmxdlhd8yzkf74" {}; CommonCrypto = applePackage "CommonCrypto" "osx-10.11.6" "0vllfpb8f4f97wj2vpdd7w5k9ibnsbr6ff1zslpp6q323h01n25y" {}; configd = applePackage "configd" "osx-10.8.5" "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" {}; copyfile = applePackage "copyfile" "osx-10.11.6" "1rkf3iaxmjz5ycgrmf0g971kh90jb2z1zqxg5vlqz001s4y457gs" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix index fe68ee78d1f0..714524e8da58 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix @@ -33,7 +33,6 @@ name: version: sha256: args: let pkgs.gnustep.make pkgs.darwin.apple_sdk.frameworks.AppKit pkgs.darwin.apple_sdk.frameworks.Foundation - pkgs.darwin.cf-private ]; makeFlags = [ "-f${makeFile}" diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix index 609d07fda100..724c4788b6cc 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix @@ -39,9 +39,5 @@ appleDerivation { --replace 'return mLoginDLDbIdentifier;' 'return mLoginDLDbIdentifier; }' \ --replace '_xpc_runtime_is_app_sandboxed()' 'false' # hope that doesn't hurt anything - - substituteInPlace lib/KCEventNotifier.h --replace \ - 'CoreFoundation/CFNotificationCenter.h' \ - '${apple_sdk.sdk.out}/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFNotificationCenter.h' ''; } diff --git a/pkgs/os-specific/darwin/cf-private/default.nix b/pkgs/os-specific/darwin/cf-private/default.nix index 603c0f652b01..3fac20d23c78 100644 --- a/pkgs/os-specific/darwin/cf-private/default.nix +++ b/pkgs/os-specific/darwin/cf-private/default.nix @@ -1,21 +1,59 @@ -{ stdenv, osx_private_sdk, CF }: +{ CF, apple_sdk }: -stdenv.mkDerivation { - name = "${CF.name}-private"; - phases = [ "installPhase" "fixupPhase" ]; - installPhase = '' - dest=$out/Library/Frameworks/CoreFoundation.framework/Headers - mkdir -p $dest - pushd $dest - for file in ${CF}/Library/Frameworks/CoreFoundation.framework/Headers/*; do - ln -sf $file - done - - # Copy or overwrite private headers, some of these might already - # exist in CF but the private versions have more information. - cp -Lfv ${osx_private_sdk}/include/CoreFoundationPrivateHeaders/* $dest - popd - ''; +# cf-private is a bit weird, but boils down to CF with a weird setup-hook that +# makes a build link against the system CoreFoundation rather than our pure one. +# The reason it exists is that although our CF headers and build are pretty legit +# now, the underlying runtime is quite different. Apple's in a bit of flux around CF +# right now, and support three different backends for it: swift, "C", and an ObjC +# one. The former two can be built from public sources, but the ObjC one isn't really +# public. Unfortunately, it's also one of the core underpinnings of a lot of Mac- +# specific behavior, and defines a lot of symbols that some Objective C apps depend +# on, even though one might expect those symbols to derive from Foundation. So if +# your app relies on NSArray and several other basic ObjC types, it turns out that +# because of their magic "toll-free bridging" support, the symbols for those types +# live in CoreFoundation with an ObjC runtime. And because that isn't public, we have +# this hack in place to let people link properly anyway. Phew! +# +# This can be revisited if Apple ever decide to release the ObjC backend in a publicly +# buildable form. +# +# This doesn't really need to rebuild CF, but it's cheap, and adding a setup hook to +# an existing package was annoying. We need a buildEnv that knows how to add those +CF.overrideAttrs (orig: { + # PLEASE if you add things to this derivation, explain in reasonable detail why + # you're adding them and when the workaround can go away. This whole derivation is + # a workaround and if you don't explain what you're working around, it makes it + # very hard for people to clean it up later. + name = "${orig.name}-private"; setupHook = ./setup-hook.sh; -} + + # TODO: consider re-adding https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch + # once the missing headers are in and see if that fixes all need for this. + + # This can go away once https://bugs.swift.org/browse/SR-8741 happens, which is + # looking more likely these days with the friendly people at Apple! We only need + # the header because the setup hook takes care of linking us against a version + # of the framework with the functionality built into it. The main user I know of + # this is watchman, who can almost certainly switch to the pure CF once the header + # and functionality is merged in. + installPhase = orig.installPhase + '' + basepath="Library/Frameworks/CoreFoundation.framework/Headers" + path="$basepath/CFFileDescriptor.h" + + # Append the include at top level or nobody will notice the header we're about to add + sed -i '/CFNotificationCenter.h/a #include ' \ + "$out/$basepath/CoreFoundation.h" + + cp ${apple_sdk.frameworks.CoreFoundation}/$path $out/$path + '' + + # This one is less likely to go away, but I'll mention it anyway. The issue is at + # https://bugs.swift.org/browse/SR-8744, and the main user I know of is qtbase + '' + path="$basepath/CFURLEnumerator.h" + sed -i '/CFNotificationCenter.h/a #include ' \ + "$out/$basepath/CoreFoundation.h" + + cp ${apple_sdk.frameworks.CoreFoundation}/$path $out/$path + ''; +}) \ No newline at end of file diff --git a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix index 1dea55cccc9e..f819429f4deb 100644 --- a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix +++ b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix @@ -14,11 +14,12 @@ in stdenv.mkDerivation { src = fetchFromGitHub { owner = "apple"; repo = "swift-corelibs-foundation"; - rev = "85c640e7ce50e6ca61a134c72270e214bc63fdba"; # https://github.com/apple/swift-corelibs-foundation/pull/1686 - sha256 = "0z2v278wy7jh0c92g1dszd8hj8naxari660sqx6yab5dwapd46qc"; + rev = "71aaba20e1450a82c516af1342fe23268e15de0a"; + sha256 = "17kpql0f27xxz4jjw84vpas5f5sn4vdqwv10g151rc3rswbwln1z"; }; - buildInputs = [ ninja python libxml2 objc4 ICU curl ]; + nativeBuildInputs = [ ninja python ]; + buildInputs = [ libxml2 objc4 ICU curl ]; sourceRoot = "source/CoreFoundation"; @@ -31,8 +32,7 @@ in stdenv.mkDerivation { # 3. Use the legit CoreFoundation.h, not the one telling you not to use it because of Swift substituteInPlace build.py \ --replace "cf.CFLAGS += '-DDEPLOYMENT" '#' \ - --replace "cf.LDFLAGS += '-ldispatch" '#' \ - --replace "Base.subproj/SwiftRuntime/CoreFoundation.h" 'Base.subproj/CoreFoundation.h' + --replace "cf.LDFLAGS += '-ldispatch" '#' # Includes xpc for some initialization routine that they don't define anyway, so no harm here substituteInPlace PlugIn.subproj/CFBundlePriv.h \ @@ -53,8 +53,11 @@ in stdenv.mkDerivation { BUILD_DIR = "./Build"; CFLAGS = "-DINCLUDE_OBJC -I${libxml2.dev}/include/libxml2"; # They seem to assume we include objc in some places and not in others, make a PR; also not sure why but libxml2 include path isn't getting picked up from buildInputs - LDFLAGS = "-install_name ${placeholder "out"}/Frameworks/CoreFoundation.framework/CoreFoundation -current_version 1234.56.7 -compatibility_version 150.0.0 -init ___CFInitialize"; - configurePhase = "../configure --sysroot unused"; + + # I'm guessing at the version here. https://github.com/apple/swift-corelibs-foundation/commit/df3ec55fe6c162d590a7653d89ad669c2b9716b1 imported "high sierra" + # and this version is a version from there. No idea how accurate it is. + LDFLAGS = "-current_version 1454.90.0 -compatibility_version 150.0.0 -init ___CFInitialize"; + configurePhase = "../configure release --sysroot UNUSED"; enableParallelBuilding = true; buildPhase = "ninja -j $NIX_BUILD_CORES"; @@ -66,6 +69,12 @@ in stdenv.mkDerivation { mkdir -p $base/Versions/A/{Headers,PrivateHeaders,Modules} cp ./Build/CoreFoundation/libCoreFoundation.dylib $base/Versions/A/CoreFoundation + + # Note that this could easily live in the ldflags above as `-install_name @rpath/...` but + # https://github.com/NixOS/nixpkgs/issues/46434 thwarts that, so for now I'm hacking it up + # after the fact. + install_name_tool -id '@rpath/CoreFoundation.framework/Versions/A/CoreFoundation' $base/Versions/A/CoreFoundation + cp ./Build/CoreFoundation/usr/include/CoreFoundation/*.h $base/Versions/A/Headers cp ./Build/CoreFoundation/usr/include/CoreFoundation/module.modulemap $base/Versions/A/Modules diff --git a/pkgs/os-specific/darwin/swift-corelibs/default.nix b/pkgs/os-specific/darwin/swift-corelibs/default.nix deleted file mode 100644 index 0d96b8fd008e..000000000000 --- a/pkgs/os-specific/darwin/swift-corelibs/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ callPackage, darwin }: - -rec { - corefoundation = callPackage ./corefoundation.nix { inherit (darwin) objc4 ICU; }; - libdispatch = callPackage ./libdispatch.nix { - inherit (darwin) apple_sdk_sierra xnu; - }; -} diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 6d224e4cc44f..d287517e8868 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -198,6 +198,9 @@ in rec { CF = null; # use CoreFoundation from bootstrap-tools configd = null; }; + python2 = self.python; + + ninja = super.ninja.override { buildDocs = false; }; }; in with prevStage; stageFun 1 prevStage { extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; @@ -217,11 +220,12 @@ in rec { zlib patchutils m4 scons flex perl bison unifdef unzip openssl python libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz - findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils; + findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils + libssh2 nghttp2 libkrb5 python2 ninja; darwin = super.darwin // { inherit (darwin) - dyld Libsystem xnu configd ICU libdispatch libclosure launchd; + dyld Libsystem xnu configd ICU libdispatch libclosure launchd CF; }; }; in with prevStage; stageFun 2 prevStage { @@ -235,7 +239,10 @@ in rec { allowedRequisites = [ bootstrapTools ] ++ - (with pkgs; [ xz.bin xz.out libcxx libcxxabi ]) ++ + (with pkgs; [ + xz.bin xz.out libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out + nghttp2.lib libkrb5 + ]) ++ (with pkgs.darwin; [ dyld Libsystem CF ICU locale ]); overrides = persistent; @@ -247,9 +254,10 @@ in rec { patchutils m4 scons flex perl bison unifdef unzip openssl python gettext sharutils libarchive pkg-config groff bash subversion openssh sqlite sed serf openldap db cyrus-sasl expat apr-util - findfreetype libssh curl cmake autoconf automake libtool cpio; + findfreetype libssh curl cmake autoconf automake libtool cpio + libssh2 nghttp2 libkrb5 python2 ninja; - # Avoid pulling in a full python and it's extra dependencies for the llvm/clang builds. + # Avoid pulling in a full python and its extra dependencies for the llvm/clang builds. libxml2 = super.libxml2.override { pythonSupport = false; }; llvmPackages_5 = super.llvmPackages_5 // (let @@ -281,7 +289,10 @@ in rec { allowedRequisites = [ bootstrapTools ] ++ - (with pkgs; [ xz.bin xz.out bash libcxx libcxxabi ]) ++ + (with pkgs; [ + xz.bin xz.out bash libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out + nghttp2.lib libkrb5 + ]) ++ (with pkgs.darwin; [ dyld ICU Libsystem locale ]); overrides = persistent; @@ -292,7 +303,7 @@ in rec { inherit gnumake gzip gnused bzip2 gawk ed xz patch bash ncurses libffi zlib gmp pcre gnugrep - coreutils findutils diffutils patchutils; + coreutils findutils diffutils patchutils ninja; # Hack to make sure we don't link ncurses in bootstrap tools. The proper # solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib, @@ -312,8 +323,14 @@ in rec { }); in { inherit tools libraries; } // tools // libraries); - darwin = super.darwin // { + darwin = super.darwin // rec { inherit (darwin) dyld Libsystem libiconv locale; + + libxml2-nopython = super.libxml2.override { pythonSupport = false; }; + CF = super.darwin.CF.override { + libxml2 = libxml2-nopython; + python = prevStage.python; + }; }; }; in with prevStage; stageFun 4 prevStage { @@ -345,6 +362,17 @@ in rec { }); in { inherit tools libraries; } // tools // libraries); + # N.B: the important thing here is to ensure that python == python2 + # == python27 or you get weird issues with inconsistent package sets. + # In a particularly subtle bug, I overrode python2 instead of python27 + # here, and it caused gnome-doc-utils to complain about: + # "PyThreadState_Get: no current thread". This is because Python gets + # really unhappy if you have Python A which loads a native python lib + # which was linked against Python B, which in our case was happening + # because we didn't override python "deeply enough". Anyway, this works + # and I'm just leaving this blurb here so people realize why it matters + python27 = super.python27.override { CF = prevStage.darwin.CF; }; + darwin = super.darwin // { inherit (darwin) dyld ICU Libsystem libiconv; } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { @@ -398,9 +426,10 @@ in rec { gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.lib patch pcre.out gettext binutils.bintools darwin.binutils darwin.binutils.bintools + curl.out openssl.out libssh2.out nghttp2.lib libkrb5 cc.expand-response-params ]) ++ (with pkgs.darwin; [ - dyld Libsystem CF cctools ICU libiconv locale + dyld Libsystem CF cctools ICU libiconv locale libxml2-nopython.out ]); overrides = lib.composeExtensions persistent (self: super: { diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 66c5f419f2f6..d128be7019bd 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -3,7 +3,7 @@ with import pkgspath { inherit system; }; let - llvmPackages = llvmPackages_4; + llvmPackages = llvmPackages_5; in rec { coreutils_ = coreutils.override (args: { # We want coreutils without ACL support. @@ -73,6 +73,7 @@ in rec { cp -d ${gettext}/lib/libintl*.dylib $out/lib chmod +x $out/lib/libintl*.dylib cp -d ${ncurses.out}/lib/libncurses*.dylib $out/lib + cp -d ${libxml2.out}/lib/libxml2*.dylib $out/lib # Copy what we need of clang cp -d ${llvmPackages.clang-unwrapped}/bin/clang $out/bin diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index b0c82508c114..3bf7c31b7008 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -31,10 +31,7 @@ in libcxxabi = pkgs.libcxxabi; }; - cf-private = callPackage ../os-specific/darwin/cf-private { - inherit (apple-source-releases) CF; - inherit (darwin) osx_private_sdk; - }; + cf-private = callPackage ../os-specific/darwin/cf-private { inherit (darwin) CF apple_sdk; }; DarwinTools = callPackage ../os-specific/darwin/DarwinTools { }; @@ -76,7 +73,10 @@ in CoreSymbolication = callPackage ../os-specific/darwin/CoreSymbolication { }; - swift-corelibs = callPackages ../os-specific/darwin/swift-corelibs { }; + CF = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { inherit (darwin) objc4 ICU; }; + + # As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in + # libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { inherit (darwin) apple_sdk_sierra xnu; }; darling = callPackage ../os-specific/darwin/darling/default.nix { }; -- cgit 1.4.1 From 110c2528709ee10466a6b4bee5a2adefe11a0c3f Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Sat, 15 Sep 2018 16:49:44 -0400 Subject: cctools: support LTO on Darwin LTO is disabled during bootstrap to keep the bootstrap tools small and avoid unnecessary LLVM rebuilds, but is enabled in the final stdenv stage and should be usable by normal packages. --- pkgs/development/compilers/llvm/5/llvm.nix | 4 +++- pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix | 4 +--- pkgs/os-specific/darwin/apple-source-releases/default.nix | 2 +- pkgs/os-specific/darwin/cctools/port.nix | 4 ++-- pkgs/stdenv/darwin/default.nix | 1 + pkgs/stdenv/darwin/make-bootstrap-tools.nix | 10 +++++++--- 6 files changed, 15 insertions(+), 10 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix index 3abba0ed340f..6dae8be97c88 100644 --- a/pkgs/development/compilers/llvm/5/llvm.nix +++ b/pkgs/development/compilers/llvm/5/llvm.nix @@ -119,12 +119,14 @@ in stdenv.mkDerivation (rec { + stdenv.lib.optionalString enableSharedLibraries '' moveToOutput "lib/libLLVM-*" "$lib" moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" + moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-" '' + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ - --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib" ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ''; diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix index 89ff68266a29..761ff3ea9252 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix @@ -1,8 +1,6 @@ -{ cctools, appleDerivation }: +{ appleDerivation }: appleDerivation { - nativeBuildInputs = [ cctools ]; - patches = [ ./clang-5.patch ]; postPatch = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index d490048c4df3..4fa0c0e3e47f 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -215,7 +215,7 @@ let # Splicing is currently broken in Nixpkgs # cctools need to be specified manually here to handle this - ICU = applePackage "ICU" "osx-10.10.5" "1qihlp42n5g4dl0sn0f9pc0bkxy1452dxzf0vr6y5gqpshlzy03p" { inherit (buildPackages.darwin) cctools; }; + ICU = applePackage "ICU" "osx-10.10.5" "1qihlp42n5g4dl0sn0f9pc0bkxy1452dxzf0vr6y5gqpshlzy03p" {}; IOKit = applePackage "IOKit" "osx-10.11.6" "0kcbrlyxcyirvg5p95hjd9k8a01k161zg0bsfgfhkb90kh2s8x00" { inherit IOKitSrcs; }; launchd = applePackage "launchd" "osx-10.9.5" "0w30hvwqq8j5n90s3qyp0fccxflvrmmjnicjri4i1vd2g196jdgj" {}; diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index fff6eaaa5c1d..bad17cf6de46 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub, autoconf, automake, libtool_2, autoreconfHook -, libcxxabi, libuuid +, libcxxabi, libuuid, llvm , libobjc ? null, maloader ? null , enableDumpNormalizedLibArgs ? false }: @@ -56,7 +56,7 @@ let autoreconfHook ]; buildInputs = [ libuuid ] ++ - stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ]; + stdenv.lib.optionals stdenv.isDarwin [ llvm libcxxabi libobjc ]; patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index d287517e8868..c361ae6e4021 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -201,6 +201,7 @@ in rec { python2 = self.python; ninja = super.ninja.override { buildDocs = false; }; + darwin = super.darwin // { cctools = super.darwin.cctools.override { llvm = null; }; }; }; in with prevStage; stageFun 1 prevStage { extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index d128be7019bd..eee3b1ce0759 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -12,6 +12,10 @@ in rec { singleBinary = false; }); + # We want a version of cctools without LLVM, because the LTO support ends up making + # the bootstrap tools huge and isn't really necessary for bootstrap + cctools_ = darwin.cctools.override { llvm = null; }; + # Avoid debugging larger changes for now. bzip2_ = bzip2.override (args: { linkStatic = true; }); @@ -95,7 +99,7 @@ in rec { # Copy binutils. for i in as ld ar ranlib nm strip otool install_name_tool dsymutil lipo; do - cp ${darwin.cctools}/bin/$i $out/bin + cp ${cctools_}/bin/$i $out/bin done cp -rd ${pkgs.darwin.CF}/Library $out @@ -105,9 +109,9 @@ in rec { nuke-refs $out/bin/* rpathify() { - local libs=$(${darwin.cctools}/bin/otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true + local libs=$(${cctools_}/bin/otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true for lib in $libs; do - ${darwin.cctools}/bin/install_name_tool -change $lib "@rpath/$(basename $lib)" "$1" + ${cctools_}/bin/install_name_tool -change $lib "@rpath/$(basename $lib)" "$1" done } -- cgit 1.4.1 From a4630c65caf8a239b9ba5c013466d485c4fd7fde Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 16 Sep 2018 15:58:21 -0500 Subject: stdenv: add shell to HOST_PATH for backwards compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid breaking things, we need to make sure SHELL goes into HOST_PATH. This reflects my changes to patch-shebangs to make it cross compilation ready. When a script is patched from the Nix store it now looks to HOST_PATH to get the targeted machine’s executables. Unfortunately, this only works in native builds. --- pkgs/stdenv/generic/setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index e51dc1f1a0a6..9a620abfbade 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -257,6 +257,7 @@ shopt -s nullglob # Set up the initial path. PATH= +HOST_PATH= for i in $initialPath; do if [ "$i" = / ]; then i=; fi addToSearchPath PATH "$i/bin" @@ -272,6 +273,12 @@ if [ -z "${SHELL:-}" ]; then echo "SHELL not set"; exit 1; fi BASH="$SHELL" export CONFIG_SHELL="$SHELL" +# For backward compatibility, we add SHELL to HOST_PATH so it can be +# used in auto patch-shebangs. Unfortunately this will not work with +# cross compilation because it will be for the builder’s platform. +if [ -z "${strictDeps-}" ]; then + addToSearchPath HOST_PATH "$SHELL/bin" +fi # Dummy implementation of the paxmark function. On Linux, this is # overwritten by paxctl's setup hook. -- cgit 1.4.1 From ba5717a6f5d2e474a4caf65a1be5750469b447bd Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 17 Sep 2018 14:13:43 -0500 Subject: stdenv: fix HOST_PATH change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a4630c65caf was incorrect in assuming $SHELL would be a path to the bash derivation. In fact $SHELL will be a path to the bash executable. Unfortunately this did not fix the original issue. So instead, we just have to reuse initialPath can be added like PATH is. Sorry for the inconvenience! I hadn’t thought through the effects of the last commit. /cc @copumpkin @ericson2314 --- pkgs/stdenv/generic/setup.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 9a620abfbade..11d0f1fbce43 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -261,6 +261,13 @@ HOST_PATH= for i in $initialPath; do if [ "$i" = / ]; then i=; fi addToSearchPath PATH "$i/bin" + + # For backward compatibility, we add initial path to HOST_PATH so + # it can be used in auto patch-shebangs. Unfortunately this will + # not work with cross compilation. + if [ -z "${strictDeps-}" ]; then + addToSearchPath HOST_PATH "$i/bin" + fi done if (( "${NIX_DEBUG:-0}" >= 1 )); then @@ -273,13 +280,6 @@ if [ -z "${SHELL:-}" ]; then echo "SHELL not set"; exit 1; fi BASH="$SHELL" export CONFIG_SHELL="$SHELL" -# For backward compatibility, we add SHELL to HOST_PATH so it can be -# used in auto patch-shebangs. Unfortunately this will not work with -# cross compilation because it will be for the builder’s platform. -if [ -z "${strictDeps-}" ]; then - addToSearchPath HOST_PATH "$SHELL/bin" -fi - # Dummy implementation of the paxmark function. On Linux, this is # overwritten by paxctl's setup hook. paxmark() { true; } -- cgit 1.4.1 From dc5c68a7bb03e8807f8ab8ad30e5eb11d1f29302 Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Mon, 17 Sep 2018 18:46:26 -0400 Subject: stdenv/darwin: bump bootstrap tools You can verify the provenance of these yourself by checking Hydra here: https://hydra.nixos.org/build/81511173 --- pkgs/stdenv/darwin/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index c361ae6e4021..a08ea3b34bac 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -4,15 +4,15 @@ # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools , bootstrapFiles ? let fetch = { file, sha256, executable ? true }: import { - url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/d5bdfcbfe6346761a332918a267e82799ec954d2/${file}"; + url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/a257d64f333caa50facc57c0e3fc6a64620ed348/${file}"; inherit (localSystem) system; inherit sha256 executable; }; in { - sh = fetch { file = "sh"; sha256 = "07wm33f1yzfpcd3rh42f8g096k4cvv7g65p968j28agzmm2s7s8m"; }; - bzip2 = fetch { file = "bzip2"; sha256 = "0y9ri2aprkrp2dkzm6229l0mw4rxr2jy7vvh3d8mxv2698v2kdbm"; }; - mkdir = fetch { file = "mkdir"; sha256 = "0sb07xpy66ws6f2jfnpjibyimzb71al8n8c6y4nr8h50al3g90nr"; }; - cpio = fetch { file = "cpio"; sha256 = "0r5c54hg678w7zydx27bzl9p3v9fs25y5ix6vdfi1ilqim7xh65n"; }; - tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "18hp5w6klr8g307ap4368r255qpzg9r0vwg9vqvj8f2zy1xilcjf"; executable = false; }; + sh = fetch { file = "sh"; sha256 = "0a8q8sdqwvs5kn9ia6rkmr36xa5y6g44a9nww5kxbyvsvwmw22y6"; }; + bzip2 = fetch { file = "bzip2"; sha256 = "0j256wrz1a5d21800h6k8cr20bka6fhpb47qig01n2mc0bc3db2m"; }; + mkdir = fetch { file = "mkdir"; sha256 = "1rqzhcc0rccnck31a728j8va4xw54r17k4d58c5bi5z8hjz4458f"; }; + cpio = fetch { file = "cpio"; sha256 = "1680lxhqfldsvg9as19xv34kjpka6vn3nm9d91w0rh90sbqpa610"; }; + tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "0cvwj6q16f6b2q6lx43lly1a8dwkxpvck2946qln2fmcmgin3rpq"; executable = false; }; } }: -- cgit 1.4.1 From b80c9ce4a962661f5589092f618ca8ae70f56a1e Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 18 Sep 2018 09:30:59 -0400 Subject: stdenv: Validate meta.outputsToInstall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If meta.outputsToInstall is set to include absent outputs, various tools break including channel updates and nix-env. grahamc@Morbo> nix-env -i -f . -A elf-header-real installing 'elf-header' error: this derivation has bad 'meta.outputsToInstall' This patch verifies each value in meta.outputsToInstall is a valid output. It validates this condition only if checkMeta is true. grahamc@Morbo> nix-build . -A elf-header-real error: Package ‘elf-header’ in /home/grahamc/projects/nixpkgs/pkgs/development/libraries/elf-header/default.nix:36 has invalid meta.outputsToInstall, refusing to evaluate. The package elf-header has set meta.outputsToInstall to: bin however elf-header only has the outputs: out and is missing the following ouputs: - bin (use '--show-trace' to show detailed location information) Note, now the nix-env experience is decidedly worse for users who have checkMeta set to true: grahamc@Morbo> nix-env -i -f . -A elf-header-real; echo $? 0 though since this is already an issue for unfree, broken, unsupported, and insecure validity problems I'm not sure we should do something different here. --- pkgs/stdenv/generic/check-meta.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index a5c8ca705231..28b69f5c2dc9 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -81,6 +81,7 @@ let unsupported = remediate_whitelist "UnsupportedSystem"; blacklisted = x: ""; insecure = remediate_insecure; + broken-outputs = remediateOutputsToInstall; unknown-meta = x: ""; }; remediate_whitelist = allow_attr: attrs: @@ -125,6 +126,20 @@ let ''; + remediateOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in '' + The package ${attrs.name} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} + + however ${attrs.name} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} + + and is missing the following ouputs: + + ${lib.concatStrings (builtins.map (output: " - ${output}\n") missingOutputs)} + ''; + handleEvalIssue = attrs: { reason , errormsg ? "" }: let msg = '' @@ -185,6 +200,14 @@ let in anyMatch (attrs.meta.platforms or lib.platforms.all) && ! anyMatch (attrs.meta.badPlatforms or []); + checkOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in if shouldCheckMeta + then builtins.length missingOutputs > 0 + else false; + # Check if a derivation is valid, that is whether it passes checks for # e.g brokenness or license. # @@ -202,6 +225,8 @@ let { valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.config}’"; } else if !(hasAllowedInsecure attrs) then { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; } + else if checkOutputsToInstall attrs then + { valid = false; reason = "broken-outputs"; errormsg = "has invalid meta.outputsToInstall"; } else let res = checkMeta (attrs.meta or {}); in if res != [] then { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; } else { valid = true; }; -- cgit 1.4.1 From eeeeacc9a61d44ada034e5eec72487fbbe10744f Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Thu, 20 Sep 2018 23:43:53 -0400 Subject: Revert "stdenv/darwin: bump bootstrap tools" This accidentally added some unwanted dependencies on the bootstrap tools, and I don't have time to fix before I go on vacation, so I'm backing it out until I have time to address it properly. This reverts commit dc5c68a7bb03e8807f8ab8ad30e5eb11d1f29302. --- pkgs/stdenv/darwin/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index a08ea3b34bac..c361ae6e4021 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -4,15 +4,15 @@ # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools , bootstrapFiles ? let fetch = { file, sha256, executable ? true }: import { - url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/a257d64f333caa50facc57c0e3fc6a64620ed348/${file}"; + url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/d5bdfcbfe6346761a332918a267e82799ec954d2/${file}"; inherit (localSystem) system; inherit sha256 executable; }; in { - sh = fetch { file = "sh"; sha256 = "0a8q8sdqwvs5kn9ia6rkmr36xa5y6g44a9nww5kxbyvsvwmw22y6"; }; - bzip2 = fetch { file = "bzip2"; sha256 = "0j256wrz1a5d21800h6k8cr20bka6fhpb47qig01n2mc0bc3db2m"; }; - mkdir = fetch { file = "mkdir"; sha256 = "1rqzhcc0rccnck31a728j8va4xw54r17k4d58c5bi5z8hjz4458f"; }; - cpio = fetch { file = "cpio"; sha256 = "1680lxhqfldsvg9as19xv34kjpka6vn3nm9d91w0rh90sbqpa610"; }; - tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "0cvwj6q16f6b2q6lx43lly1a8dwkxpvck2946qln2fmcmgin3rpq"; executable = false; }; + sh = fetch { file = "sh"; sha256 = "07wm33f1yzfpcd3rh42f8g096k4cvv7g65p968j28agzmm2s7s8m"; }; + bzip2 = fetch { file = "bzip2"; sha256 = "0y9ri2aprkrp2dkzm6229l0mw4rxr2jy7vvh3d8mxv2698v2kdbm"; }; + mkdir = fetch { file = "mkdir"; sha256 = "0sb07xpy66ws6f2jfnpjibyimzb71al8n8c6y4nr8h50al3g90nr"; }; + cpio = fetch { file = "cpio"; sha256 = "0r5c54hg678w7zydx27bzl9p3v9fs25y5ix6vdfi1ilqim7xh65n"; }; + tarball = fetch { file = "bootstrap-tools.cpio.bz2"; sha256 = "18hp5w6klr8g307ap4368r255qpzg9r0vwg9vqvj8f2zy1xilcjf"; executable = false; }; } }: -- cgit 1.4.1 From 0b9d9ab256012a9007695a174895e9d32eca809d Mon Sep 17 00:00:00 2001 From: Benjamin Hipple Date: Sun, 23 Sep 2018 12:45:03 -0400 Subject: Remove dead code from stdenv check-meta license logic The `unfree` and `unfreeRedistributable` licenses both have `free = false`, which will trigger the first portion of logic. This removes dead code to simplify the logic. As a follow-up, I plan to add an attribute `redistributable = [true|false]`, which can be used by Hydra to determine whether a given package with a given license can be included in the channel. --- pkgs/stdenv/generic/check-meta.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 28b69f5c2dc9..26cd9f8beb96 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -42,8 +42,7 @@ let allowUnsupportedSystem = config.allowUnsupportedSystem or false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"; - isUnfree = licenses: lib.lists.any (l: - !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses; + isUnfree = licenses: lib.lists.any (l: !l.free or true) licenses; # Alow granular checks to allow only some unfree packages # Example: @@ -56,7 +55,7 @@ let # Check whether unfree packages are allowed and if not, whether the # package has an unfree license and is not explicitely allowed by the - # `allowUNfreePredicate` function. + # `allowUnfreePredicate` function. hasDeniedUnfreeLicense = attrs: !allowUnfree && hasLicense attrs && -- cgit 1.4.1 From b2c7a5a271269175bbcb2907ca821139a7ee465f Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Wed, 5 Sep 2018 18:33:56 +0000 Subject: bintools-wrapper, cc-wrapper, stdenv: infer propagateDoc automatically 02c09e01712ce0b61e5c8f7159047699a434f7fc (NixOS/nixpkgs#44558) was reverted in c981787db951afb11c1328461df82d4277ebec07 but, as it turns out, it fixed an issue I didn't know about at the time: the values of `propagateDoc` options were (and now again are) inconsistent with the underlying things those wrappers wrap (see NixOS/nixpkgs#46119), which was (and now is) likely to produce more instances of NixOS/nixpkgs#43547, if not now, then eventually as stdenv changes. This patch (which is a simplified version of the original reverted patch) is the simplest solution to this whole thing: it forces wrappers to directly inspect the outputs of the things they are wrapping instead of making stdenv guess the correct values. --- pkgs/build-support/bintools-wrapper/default.nix | 7 ++++--- pkgs/build-support/cc-wrapper/default.nix | 4 +++- pkgs/stdenv/darwin/default.nix | 1 - pkgs/stdenv/linux/default.nix | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 7948f726c629..f9ca245beea6 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -6,9 +6,10 @@ # compiler and the linker just "work". { name ? "" -, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" -, bintools ? null, libc ? null -, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null +, stdenvNoCC +, bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null +, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, propagateDoc ? bintools != null && bintools ? man , extraPackages ? [], extraBuildCommands ? "" , buildPackages ? {} , useMacosReexportHack ? false diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 301bc2694c4f..e59758371a38 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -6,8 +6,10 @@ # compiler and the linker just "work". { name ? "" -, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, stdenvNoCC , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell +, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, propagateDoc ? cc != null && cc ? man , extraPackages ? [], extraBuildCommands ? "" , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 6d224e4cc44f..bfeac09ea650 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -88,7 +88,6 @@ in rec { extraPackages = lib.optional (libcxx != null) libcxx; nativeTools = false; - propagateDoc = false; nativeLibc = false; inherit buildPackages coreutils gnugrep bintools; libc = last.pkgs.darwin.Libsystem; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 08703b6934e5..978beea692c6 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -92,7 +92,6 @@ let else lib.makeOverridable (import ../../build-support/cc-wrapper) { name = "${name}-gcc-wrapper"; nativeTools = false; - propagateDoc = false; nativeLibc = false; buildPackages = lib.optionalAttrs (prevStage ? stdenv) { inherit (prevStage) stdenv; -- cgit 1.4.1 From 4d9f9f171b776ede7765aabb4cd4ae588f9fbf68 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sun, 23 Sep 2018 14:54:09 -0500 Subject: make-bootstrap-tools: fix with latest coreutils Since gcc.lib/lib64 is a symlink to 'lib', the use of "lib*/libgcc_s.so*" triggered a warning (error) with the latest coreutils. Essentially we were doing: $ cp a/x b/x y/ And latest coreutils rejects such invocations. Just copy from 'lib', lib64 is a link to it anyway. * Nothing else in this file bothers looking at lib* * AFAICT lib* only ever possibly matched lib64 anyway --- pkgs/stdenv/linux/make-bootstrap-tools.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 4fc9999b538c..59ded9d81108 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -112,8 +112,8 @@ in with pkgs; rec { cp -d ${gcc.cc.out}/bin/gcc $out/bin cp -d ${gcc.cc.out}/bin/cpp $out/bin cp -d ${gcc.cc.out}/bin/g++ $out/bin - cp -d ${gcc.cc.lib}/lib*/libgcc_s.so* $out/lib - cp -d ${gcc.cc.lib}/lib*/libstdc++.so* $out/lib + cp -d ${gcc.cc.lib}/lib/libgcc_s.so* $out/lib + cp -d ${gcc.cc.lib}/lib/libstdc++.so* $out/lib cp -rd ${gcc.cc.out}/lib/gcc $out/lib chmod -R u+w $out/lib rm -f $out/lib/gcc/*/*/include*/linux -- cgit 1.4.1 From b25b6e0c75867cd0ae9866b7a8f0d6e3a4be54d5 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 23 Sep 2018 20:32:19 +0200 Subject: stdenv: Improve ELF detection for isELF The isELF function only checks whether ELF is contained within the first 4 bytes of the file, which is a bit fuzzy and will also return successful if it's a text file starting with ELF, for example: ELF headers ----------- Some text here about ELF headers... So instead, we're now doing a precise match on \x7fELF. Signed-off-by: aszlig Acked-by: @Ericson2314 Closes: https://github.com/NixOS/nixpkgs/pull/47244 --- pkgs/stdenv/generic/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 11d0f1fbce43..8af369b1d17d 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -211,7 +211,7 @@ isELF() { exec {fd}< "$fn" read -r -n 4 -u "$fd" magic exec {fd}<&- - if [[ "$magic" =~ ELF ]]; then return 0; else return 1; fi + if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi } # Return success if the specified file is a script (i.e. starts with -- cgit 1.4.1 From b3041b44552f50109760e7fa41a16636e4b4d5c0 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:50:37 -0500 Subject: make-derivation: set CMAKE_SYSTEM_* when cross compiling Uses uname data to find what to set these variables: - CMAKE_SYSTEM_NAME - CMAKE_SYSTEM_PROCESSOR - CMAKE_SYSTEM_VERSION - CMAKE_HOST_SYSTEM_NAME - CMAKE_HOST_SYSTEM_PROCESSOR - CMAKE_HOST_SYSTEM_VERSION --- pkgs/stdenv/generic/make-derivation.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 2db40fc43e36..e06faed30a1e 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -41,6 +41,7 @@ rec { # Configure Phase , configureFlags ? [] + , cmakeFlags ? [] , # Target is not included by default because most programs don't care. # Including it then would cause needless mass rebuilds. # @@ -225,6 +226,17 @@ rec { inherit doCheck doInstallCheck; inherit outputs; + } // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { + cmakeFlags = + (/**/ if lib.isString cmakeFlags then [cmakeFlags] + else if cmakeFlags == null then [] + else cmakeFlags) + ++ lib.optional (stdenv.hostPlatform.uname.system != null) "-DCMAKE_SYSTEM_NAME=${stdenv.hostPlatform.uname.system}" + ++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}" + ++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}" + ++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}" + ++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}" + ++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}"; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { -- cgit 1.4.1