diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-07 15:22:35 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-07 15:22:35 +0100 |
commit | 5f554279ec31e8d42266a3f4477035fa8e43a5c7 (patch) | |
tree | 0edb6eea939ec15ed533ca44b4d26ff4b97aea21 /pkgs/stdenv | |
parent | 13ee78018cc0ebb8ff0ae25b6d86c9c273fd55b9 (diff) | |
parent | cb2a447c510848c925977c0ecc440eef7443c12f (diff) | |
download | nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.gz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.bz2 nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.lz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.xz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.zst nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.zip |
Merge master into staging-next
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/adapters.nix | 8 | ||||
-rw-r--r-- | pkgs/stdenv/cross/default.nix | 13 | ||||
-rw-r--r-- | pkgs/stdenv/custom/default.nix | 2 | ||||
-rw-r--r-- | pkgs/stdenv/darwin/default.nix | 4 | ||||
-rw-r--r-- | pkgs/stdenv/darwin/portable-libsystem.sh | 12 | ||||
-rw-r--r-- | pkgs/stdenv/default.nix | 4 | ||||
-rw-r--r-- | pkgs/stdenv/freebsd/default.nix | 2 | ||||
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 4 | ||||
-rw-r--r-- | pkgs/stdenv/native/default.nix | 2 | ||||
-rw-r--r-- | pkgs/stdenv/nix/default.nix | 4 |
10 files changed, 37 insertions, 18 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 671306f6e6f2..850785cd881f 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -32,13 +32,15 @@ rec { # Return a modified stdenv that tries to build statically linked # binaries. makeStaticBinaries = stdenv: stdenv // - { mkDerivation = args: stdenv.mkDerivation (args // { - NIX_CFLAGS_LINK = "-static"; + { mkDerivation = args: + if stdenv.hostPlatform.isDarwin + then throw "Cannot build fully static binaries on Darwin/macOS" + else stdenv.mkDerivation (args // { + NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + "-static"; configureFlags = (args.configureFlags or []) ++ [ "--disable-shared" # brrr... ]; }); - isStatic = true; }; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index daa9f66615c9..a6063049a3ad 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -1,11 +1,14 @@ { lib -, localSystem, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays, crossOverlays ? [] }: let bootStages = import ../. { inherit lib localSystem overlays; - crossSystem = null; + + crossSystem = localSystem; + crossOverlays = []; + # Ignore custom stdenvs when cross compiling for compatability config = builtins.removeAttrs config [ "replaceStdenv" ]; }; @@ -33,7 +36,8 @@ in lib.init bootStages ++ [ # Run Packages (buildPackages: { - inherit config overlays; + inherit config; + overlays = overlays ++ crossOverlays; selfBuild = false; stdenv = buildPackages.stdenv.override (old: rec { buildPlatform = localSystem; @@ -48,7 +52,7 @@ in lib.init bootStages ++ [ cc = if crossSystem.useiOSPrebuilt or false then buildPackages.darwin.iosSdkPkgs.clang - else if crossSystem.useAndroidPrebuilt + else if crossSystem.useAndroidPrebuilt or false then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc else buildPackages.gcc; @@ -56,6 +60,7 @@ in lib.init bootStages ++ [ ++ lib.optionals (hostPlatform.isLinux && !buildPlatform.isLinux) [ buildPackages.patchelf buildPackages.paxctl ] + ++ lib.optional hostPlatform.isDarwin buildPackages.clang ++ lib.optional (let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform)) buildPackages.updateAutotoolsGnuConfigScriptsHook diff --git a/pkgs/stdenv/custom/default.nix b/pkgs/stdenv/custom/default.nix index b6ea8685f8e6..e86face95195 100644 --- a/pkgs/stdenv/custom/default.nix +++ b/pkgs/stdenv/custom/default.nix @@ -2,7 +2,7 @@ , localSystem, crossSystem, config, overlays }: -assert crossSystem == null; +assert crossSystem == localSystem; let bootStages = import ../. { diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 5fb410b64ebd..b7d8e3ba5236 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1,5 +1,5 @@ { lib -, localSystem, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays, crossOverlays ? [] # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools , bootstrapFiles ? let @@ -16,7 +16,7 @@ } }: -assert crossSystem == null; +assert crossSystem == localSystem; let inherit (localSystem) system platform; diff --git a/pkgs/stdenv/darwin/portable-libsystem.sh b/pkgs/stdenv/darwin/portable-libsystem.sh new file mode 100644 index 000000000000..f50ccc8d32ee --- /dev/null +++ b/pkgs/stdenv/darwin/portable-libsystem.sh @@ -0,0 +1,12 @@ +# Make /nix/store/...-libSystem “portable” for static built binaries. +# This just rewrites everything in $1/bin to use the +# /usr/lib/libSystem.B.dylib that is provided on every macOS system. + +fixupOutputHooks+=('fixLibsystemRefs $prefix') + +fixLibsystemRefs() { + if [ -d "$1/bin" ]; then + find "$1/bin" -exec \ + install_name_tool -change @libsystem@ /usr/lib/libSystem.B.dylib {} \; + fi +} diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 210e0439c0b8..c0bbe24e5219 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -7,7 +7,7 @@ { # Args just for stdenvs' usage lib # Args to pass on to the pkgset builder, too -, localSystem, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays, crossOverlays ? [] } @ args: let @@ -36,7 +36,7 @@ let # Select the appropriate stages for the platform `system'. in - if crossSystem != null then stagesCross + if crossSystem != localSystem || crossOverlays != [] then stagesCross else if config ? replaceStdenv then stagesCustom else { # switch "i686-linux" = stagesLinux; diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index b3a6cedad841..dbb4a0564558 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -2,7 +2,7 @@ , localSystem, crossSystem, config, overlays }: -assert crossSystem == null; +assert crossSystem == localSystem; let inherit (localSystem) system; in diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index cfba5e7b88af..28c3b9f3fb45 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -4,7 +4,7 @@ # compiler and linker that do not search in default locations, # ensuring purity of components produced by it. { lib -, localSystem, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays, crossOverlays ? [] , bootstrapFiles ? let table = { @@ -32,7 +32,7 @@ in files }: -assert crossSystem == null; +assert crossSystem == localSystem; let inherit (localSystem) system platform; diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 37795b11f6dd..810cf16301f4 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -2,7 +2,7 @@ , localSystem, crossSystem, config, overlays }: -assert crossSystem == null; +assert crossSystem == localSystem; let inherit (localSystem) system; diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index ffff8bdf51d4..a8311f49609a 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -1,10 +1,10 @@ { lib -, crossSystem, config, overlays +, crossSystem, localSystem, config, overlays , bootStages , ... }: -assert crossSystem == null; +assert crossSystem == localSystem; bootStages ++ [ (prevStage: { |