stdenvs: Distinguish between extraBuildInputs and extraNativeBuildInputs

This version continues to use bash + stdenv/setup for the default
inputs.
This commit is contained in:
John Ericson 2017-08-15 11:30:45 -04:00
parent 7320fa9d45
commit fbab1d485b
6 changed files with 46 additions and 22 deletions

View file

@ -59,11 +59,12 @@ in rec {
stageFun = step: last: {shell ? "${bootstrapTools}/bin/bash", stageFun = step: last: {shell ? "${bootstrapTools}/bin/bash",
overrides ? (self: super: {}), overrides ? (self: super: {}),
extraPreHook ? "", extraPreHook ? "",
extraNativeBuildInputs,
extraBuildInputs, extraBuildInputs,
allowedRequisites ? null}: allowedRequisites ? null}:
let let
thisStdenv = import ../generic { thisStdenv = import ../generic {
inherit config shell extraBuildInputs; inherit config shell extraNativeBuildInputs extraBuildInputs;
allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [ allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [
thisStdenv.cc.expand-response-params thisStdenv.cc.expand-response-params
]; ];
@ -162,6 +163,7 @@ in rec {
}; };
extraNativeBuildInputs = [];
extraBuildInputs = []; extraBuildInputs = [];
}; };
@ -169,6 +171,7 @@ in rec {
stage1 = prevStage: with prevStage; stageFun 1 prevStage { stage1 = prevStage: with prevStage; stageFun 1 prevStage {
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
extraNativeBuildInputs = [];
extraBuildInputs = [ pkgs.libcxx ]; extraBuildInputs = [ pkgs.libcxx ];
allowedRequisites = allowedRequisites =
@ -195,7 +198,8 @@ in rec {
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
''; '';
extraBuildInputs = with pkgs; [ xz darwin.CF libcxx ]; extraNativeBuildInputs = [ pkgs.xz ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
allowedRequisites = allowedRequisites =
[ bootstrapTools ] ++ [ bootstrapTools ] ++
@ -226,7 +230,8 @@ in rec {
# enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting # enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting
# and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and # and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
# patches our shebangs back to point at bootstrapTools. This makes sure bash comes first. # patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ]; extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraPreHook = '' extraPreHook = ''
export PATH=${pkgs.bash}/bin:$PATH export PATH=${pkgs.bash}/bin:$PATH
@ -260,7 +265,8 @@ in rec {
stage4 = prevStage: with prevStage; stageFun 4 prevStage { stage4 = prevStage: with prevStage; stageFun 4 prevStage {
shell = "${pkgs.bash}/bin/bash"; shell = "${pkgs.bash}/bin/bash";
extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ]; extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraPreHook = '' extraPreHook = ''
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
''; '';
@ -321,6 +327,7 @@ in rec {
libc = pkgs.darwin.Libsystem; libc = pkgs.darwin.Libsystem;
}; };
extraNativeBuildInputs = [];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraAttrs = { extraAttrs = {

View file

@ -9,6 +9,7 @@ mkdir $out
echo "export SHELL=$shell" > $out/setup echo "export SHELL=$shell" > $out/setup
echo "initialPath=\"$initialPath\"" >> $out/setup echo "initialPath=\"$initialPath\"" >> $out/setup
echo "defaultNativeBuildInputs=\"$defaultNativeBuildInputs\"" >> $out/setup echo "defaultNativeBuildInputs=\"$defaultNativeBuildInputs\"" >> $out/setup
echo "defaultBuildInputs=\"$defaultBuildInputs\"" >> $out/setup
echo "$preHook" >> $out/setup echo "$preHook" >> $out/setup
cat "$setup" >> $out/setup cat "$setup" >> $out/setup

View file

@ -9,6 +9,7 @@ let lib = import ../../../lib; in lib.makeOverridable (
, setupScript ? ./setup.sh , setupScript ? ./setup.sh
, extraNativeBuildInputs ? []
, extraBuildInputs ? [] , extraBuildInputs ? []
, __stdenvImpureHostDeps ? [] , __stdenvImpureHostDeps ? []
, __extraImpureHostDeps ? [] , __extraImpureHostDeps ? []
@ -41,7 +42,7 @@ let lib = import ../../../lib; in lib.makeOverridable (
}: }:
let let
defaultNativeBuildInputs = extraBuildInputs ++ defaultNativeBuildInputs = extraNativeBuildInputs ++
[ ../../build-support/setup-hooks/move-docs.sh [ ../../build-support/setup-hooks/move-docs.sh
../../build-support/setup-hooks/compress-man-pages.sh ../../build-support/setup-hooks/compress-man-pages.sh
../../build-support/setup-hooks/strip.sh ../../build-support/setup-hooks/strip.sh
@ -58,11 +59,16 @@ let
cc cc
]; ];
defaultBuildInputs = extraBuildInputs;
# The stdenv that we are producing. # The stdenv that we are producing.
stdenv = stdenv =
derivation ( derivation (
(if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) // lib.optionalAttrs (allowedRequisites != null) {
{ allowedRequisites = allowedRequisites
++ defaultNativeBuildInputs ++ defaultBuildInputs;
}
// {
inherit name; inherit name;
# Nix itself uses the `system` field of a derivation to decide where to # Nix itself uses the `system` field of a derivation to decide where to
@ -75,7 +81,8 @@ let
setup = setupScript; setup = setupScript;
inherit preHook initialPath shell defaultNativeBuildInputs; inherit preHook initialPath shell
defaultNativeBuildInputs defaultBuildInputs;
} }
// lib.optionalAttrs buildPlatform.isDarwin { // lib.optionalAttrs buildPlatform.isDarwin {
__sandboxProfile = stdenvSandboxProfile; __sandboxProfile = stdenvSandboxProfile;
@ -91,7 +98,8 @@ let
inherit buildPlatform hostPlatform targetPlatform; inherit buildPlatform hostPlatform targetPlatform;
inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile; inherit extraNativeBuildInputs extraBuildInputs
__extraImpureHostDeps extraSandboxProfile;
# Utility flags to test the type of platform. # Utility flags to test the type of platform.
inherit (hostPlatform) inherit (hostPlatform)

View file

@ -65,13 +65,21 @@ rec {
"sandboxProfile" "propagatedSandboxProfile"]) "sandboxProfile" "propagatedSandboxProfile"])
// (let // (let
computedSandboxProfile = computedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies); lib.concatMap (input: input.__propagatedSandboxProfile or [])
(stdenv.extraNativeBuildInputs
++ stdenv.extraBuildInputs
++ lib.concatLists dependencies);
computedPropagatedSandboxProfile = computedPropagatedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies); lib.concatMap (input: input.__propagatedSandboxProfile or [])
(lib.concatLists propagatedDependencies);
computedImpureHostDeps = computedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies)); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
(stdenv.extraNativeBuildInputs
++ stdenv.extraBuildInputs
++ lib.concatLists dependencies));
computedPropagatedImpureHostDeps = computedPropagatedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies)); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
(lib.concatLists propagatedDependencies));
in in
{ {
name = name + lib.optionalString name = name + lib.optionalString

View file

@ -47,7 +47,7 @@ let
# the bootstrap. In all stages, we build an stdenv and the package # the bootstrap. In all stages, we build an stdenv and the package
# set that can be built with that stdenv. # set that can be built with that stdenv.
stageFun = prevStage: stageFun = prevStage:
{ name, overrides ? (self: super: {}), extraBuildInputs ? [] }: { name, overrides ? (self: super: {}), extraNativeBuildInputs ? [] }:
let let
@ -56,7 +56,7 @@ let
buildPlatform = localSystem; buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;
inherit config extraBuildInputs; inherit config extraNativeBuildInputs;
preHook = preHook =
'' ''
# Don't patch #!/interpreter because it leads to retained # Don't patch #!/interpreter because it leads to retained
@ -219,7 +219,7 @@ in
isl = isl_0_14; isl = isl_0_14;
}; };
}; };
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
}) })
@ -253,7 +253,7 @@ in
shell = self.bash + "/bin/bash"; shell = self.bash + "/bin/bash";
}; };
}; };
extraBuildInputs = [ prevStage.patchelf prevStage.xz ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
}) })
@ -283,7 +283,7 @@ in
initialPath = initialPath =
((import ../common-path.nix) {pkgs = prevStage;}); ((import ../common-path.nix) {pkgs = prevStage;});
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;

View file

@ -66,7 +66,7 @@ let
export lt_cv_deplibs_check_method=pass_all export lt_cv_deplibs_check_method=pass_all
''; '';
extraBuildInputsCygwin = [ extraNativeBuildInputsCygwin = [
../cygwin/all-buildinputs-as-runtimedep.sh ../cygwin/all-buildinputs-as-runtimedep.sh
../cygwin/wrap-exes-to-find-dlls.sh ../cygwin/wrap-exes-to-find-dlls.sh
] ++ (if system == "i686-cygwin" then [ ] ++ (if system == "i686-cygwin" then [
@ -94,9 +94,9 @@ let
if system == "x86_64-cygwin" then prehookCygwin else if system == "x86_64-cygwin" then prehookCygwin else
prehookBase; prehookBase;
extraBuildInputs = extraNativeBuildInputs =
if system == "i686-cygwin" then extraBuildInputsCygwin else if system == "i686-cygwin" then extraNativeBuildInputsCygwin else
if system == "x86_64-cygwin" then extraBuildInputsCygwin else if system == "x86_64-cygwin" then extraNativeBuildInputsCygwin else
[]; [];
initialPath = extraPath ++ path; initialPath = extraPath ++ path;