From ee45e160b1fc2a8d32233bd7647e5e5fb72a486a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Jan 2012 15:56:17 +0000 Subject: [PATCH] * Prepend the "prehook" rather than sourcing it. * Don't call xargs with the -r flag in the Darwin bootstrap. svn path=/nixpkgs/branches/stdenv-updates/; revision=31703 --- pkgs/stdenv/generic/builder.sh | 9 +++++---- pkgs/stdenv/generic/default.nix | 2 +- pkgs/stdenv/generic/setup.sh | 2 +- pkgs/stdenv/linux/default.nix | 12 ++++++------ pkgs/stdenv/linux/scripts/prehook.sh | 3 --- pkgs/stdenv/native/default.nix | 23 ++++++++++++----------- pkgs/stdenv/nix/default.nix | 16 +++++++++++++++- pkgs/stdenv/nix/prehook.sh | 10 ---------- 8 files changed, 40 insertions(+), 37 deletions(-) delete mode 100644 pkgs/stdenv/linux/scripts/prehook.sh delete mode 100644 pkgs/stdenv/nix/prehook.sh diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh index 6895d104309a..98b90144611a 100644 --- a/pkgs/stdenv/generic/builder.sh +++ b/pkgs/stdenv/generic/builder.sh @@ -6,12 +6,13 @@ done mkdir $out -sed \ - -e "s^@preHook@^$preHook^g" \ +echo "$preHook" > $out/setup +cat "$setup" >> $out/setup + +sed -i "$out/setup" \ -e "s^@initialPath@^$initialPath^g" \ -e "s^@gcc@^$gcc^g" \ - -e "s^@shell@^$shell^g" \ - < "$setup" > "$out/setup" + -e "s^@shell@^$shell^g" # Allow the user to install stdenv using nix-env and get the packages # in stdenv. diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index b0cee743f8c4..91e6af01578f 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -1,4 +1,4 @@ -{ system, name, preHook ? null, initialPath, gcc, shell +{ system, name, preHook ? "", initialPath, gcc, shell , extraAttrs ? {}, overrides ? (pkgs: {}) , # The `fetchurl' to use for downloading curl and its dependencies diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index aa5f01a75c39..1ec05bc26134 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -103,7 +103,6 @@ fi # Execute the pre-hook. export SHELL=@shell@ if [ -z "$shell" ]; then export shell=@shell@; fi -if [ -n "@preHook@" ]; then source @preHook@; fi runHook preHook @@ -174,6 +173,7 @@ for i in $buildNativeInputs $propagatedBuildNativeInputs; do findInputs $i nativePkgs propagated-build-native-inputs done + # Set the relevant environment variables to point to the build inputs # found above. addToNativeEnv() { diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 9937fd5db6ef..90ce61b25c88 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -55,10 +55,10 @@ rec { builder = bootstrapFiles.sh; - args = if (system == "armv5tel-linux") then - ([ ./scripts/unpack-bootstrap-tools-arm.sh ]) - else - ([ ./scripts/unpack-bootstrap-tools.sh ]); + args = + if system == "armv5tel-linux" + then [ ./scripts/unpack-bootstrap-tools-arm.sh ] + else [ ./scripts/unpack-bootstrap-tools.sh ]; inherit (bootstrapFiles) bzip2 mkdir curl cpio; @@ -82,7 +82,7 @@ rec { import ../generic { inherit system; name = "stdenv-linux-boot"; - preHook = builtins.toFile "prehook.sh" + preHook = '' # Don't patch #!/interpreter because it leads to retained # dependencies on the bootstrapTools in the final stdenv. @@ -263,7 +263,7 @@ rec { inherit system; - preHook = builtins.toFile "prehook.sh" commonPreHook; + preHook = commonPreHook; initialPath = ((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;}) diff --git a/pkgs/stdenv/linux/scripts/prehook.sh b/pkgs/stdenv/linux/scripts/prehook.sh deleted file mode 100644 index 29c02e2eaf2e..000000000000 --- a/pkgs/stdenv/linux/scripts/prehook.sh +++ /dev/null @@ -1,3 +0,0 @@ -export NIX_ENFORCE_PURITY=1 - -havePatchELF=1 diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 1f3fa69d51b0..3319a0d92719 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -11,22 +11,23 @@ rec { (if system == "i686-netbsd" then [ "/usr/pkg" ] else []) ++ ["/" "/usr" "/usr/local"]; - prehookBase = builtins.toFile "prehook-base.sh" '' + prehookBase = '' # Disable purity tests; it's allowed (even needed) to link to # libraries outside the Nix store (like the C library). export NIX_ENFORCE_PURITY= ''; - prehookDarwin = builtins.toFile "prehook-darwin.sh" '' - source ${prehookBase} + prehookDarwin = '' + ${prehookBase} export NIX_DONT_SET_RPATH=1 export NIX_NO_SELF_RPATH=1 dontFixLibtool=1 stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" + xargsFlags=" " ''; - prehookFreeBSD = builtins.toFile "prehook-freebsd.sh" '' - source ${prehookBase} + prehookFreeBSD = '' + ${prehookBase} alias make=gmake alias tar=gtar @@ -38,8 +39,8 @@ rec { export NIX_GCC_NEEDS_GREP=1 ''; - prehookOpenBSD = builtins.toFile "prehook-openbsd.sh" '' - source ${prehookBase} + prehookOpenBSD = '' + ${prehookBase} alias make=gmake alias grep=ggrep @@ -55,8 +56,8 @@ rec { export NIX_GCC_NEEDS_GREP=1 ''; - prehookNetBSD = builtins.toFile "prehook-netbsd.sh" '' - source ${prehookBase} + prehookNetBSD = '' + ${prehookBase} alias make=gmake alias sed=gsed @@ -68,8 +69,8 @@ rec { export NIX_GCC_NEEDS_GREP=1 ''; - prehookCygwin = builtins.toFile "prehook-cygwin.sh" '' - source ${prehookBase} + prehookCygwin = '' + ${prehookBase} if test -z "$cygwinConfigureEnableShared"; then export configureFlags="$configureFlags --disable-shared" diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index 5b1b2af8285f..b7411290f9fd 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -2,7 +2,21 @@ import ../generic { name = "stdenv-nix"; - preHook = ./prehook.sh; + + preHook = + '' + export NIX_ENFORCE_PURITY=1 + export NIX_IGNORE_LD_THROUGH_GCC=1 + + if [ "$system" = "i686-darwin" -o "$system" = "powerpc-darwin" -o "$system" = "x86_64-darwin" ]; then + export NIX_DONT_SET_RPATH=1 + export NIX_NO_SELF_RPATH=1 + dontFixLibtool=1 + stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" + xargsFlags=" " + fi + ''; + initialPath = (import ../common-path.nix) {pkgs = pkgs;}; system = stdenv.system; diff --git a/pkgs/stdenv/nix/prehook.sh b/pkgs/stdenv/nix/prehook.sh deleted file mode 100644 index ea80355f6bb1..000000000000 --- a/pkgs/stdenv/nix/prehook.sh +++ /dev/null @@ -1,10 +0,0 @@ -export NIX_ENFORCE_PURITY=1 -export NIX_IGNORE_LD_THROUGH_GCC=1 - -if test "$system" = "i686-darwin" -o "$system" = "powerpc-darwin" -o "$system" = "x86_64-darwin"; then - export NIX_DONT_SET_RPATH=1 - export NIX_NO_SELF_RPATH=1 - dontFixLibtool=1 - stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" - xargsFlags=" " -fi