From 635880a17aa3efb14869ba80a5785f8663dee6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 26 Dec 2012 21:38:58 +0100 Subject: [PATCH 1/4] 2nd approach at getting a check for /niximpure in stdenv-updates --- pkgs/stdenv/generic/builder.sh | 4 ++++ pkgs/stdenv/generic/default.nix | 3 ++- pkgs/stdenv/generic/setup.sh | 1 + pkgs/stdenv/linux/default.nix | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh index fd4c17ca2519..81e11c2df650 100644 --- a/pkgs/stdenv/generic/builder.sh +++ b/pkgs/stdenv/generic/builder.sh @@ -13,6 +13,10 @@ sed -e "s^@initialPath@^$initialPath^g" \ -e "s^@gcc@^$gcc^g" \ -e "s^@shell@^$shell^g" \ < $out/setup > $out/setup.tmp +if [ -n "$withNixImpure" ]; then + sed -i -e 's^@niximpure@^test -f /niximupure/impure.sh && . /niximpure/impure.sh^g' \ + $out/setup.tmp +fi mv $out/setup.tmp $out/setup # Allow the user to install stdenv using nix-env and get the packages diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 20cbb1b455ca..0494d6f00f5d 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -1,5 +1,6 @@ { system, name ? "stdenv", preHook ? "", initialPath, gcc, shell , extraAttrs ? {}, overrides ? (pkgs: {}) +, withNixImpure ? false , # The `fetchurl' to use for downloading curl and its dependencies # (see all-packages.nix). @@ -26,7 +27,7 @@ let setup = setupScript; - inherit preHook initialPath gcc shell; + inherit preHook initialPath gcc shell withNixImpure; propagatedUserEnvPkgs = [gcc] ++ lib.filter lib.isDerivation initialPath; diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index e30b0656e623..230694ccf35c 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -270,6 +270,7 @@ elif [ "$NIX_BUILD_CORES" -le 0 ]; then fi export NIX_BUILD_CORES +@niximpure@ ###################################################################### # Misc. helper functions. diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 3105e76f8177..df89b3714f8a 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -264,7 +264,7 @@ rec { inherit system; preHook = commonPreHook; - + initialPath = ((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;}) ++ [stdenvLinuxBoot4Pkgs.patchelf]; @@ -281,6 +281,8 @@ rec { shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash"; fetchurlBoot = fetchurl; + + withNixImpure = if platform ? nixImpure then platform.nixImpure else false; extraAttrs = { inherit (stdenvLinuxBoot3Pkgs) glibc; From b190e6cd93616f67e981e4a3c37e2d296553ef89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 26 Dec 2012 22:20:43 +0100 Subject: [PATCH 2/4] Fixing problems in the previous commit. It didn't work. --- pkgs/stdenv/generic/builder.sh | 10 ++++++---- pkgs/stdenv/linux/default.nix | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh index 81e11c2df650..6274200900cc 100644 --- a/pkgs/stdenv/generic/builder.sh +++ b/pkgs/stdenv/generic/builder.sh @@ -9,14 +9,16 @@ mkdir $out echo "$preHook" > $out/setup cat "$setup" >> $out/setup +if [ "$withNixImpure" == 1 ]; then + # sed wants \&\& for a && + niximpure='test -f /niximpure/impure.sh \&\& . /niximpure/impure.sh' +fi + sed -e "s^@initialPath@^$initialPath^g" \ -e "s^@gcc@^$gcc^g" \ -e "s^@shell@^$shell^g" \ + -e "s^@niximpure@^$niximpure^g" \ < $out/setup > $out/setup.tmp -if [ -n "$withNixImpure" ]; then - sed -i -e 's^@niximpure@^test -f /niximupure/impure.sh && . /niximpure/impure.sh^g' \ - $out/setup.tmp -fi mv $out/setup.tmp $out/setup # Allow the user to install stdenv using nix-env and get the packages diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index df89b3714f8a..73768e8f40e7 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -94,6 +94,7 @@ rec { initialPath = [bootstrapTools] ++ extraPath; fetchurlBoot = fetchurl; inherit gcc; + withNixImpure = if platform ? nixImpure then platform.nixImpure else false; # Having the proper 'platform' in all the stdenvs allows getting proper # linuxHeaders for example. extraAttrs = extraAttrs // { inherit platform; }; From f94f53a54e514c818243426bed5c03a5777ad82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 27 Dec 2012 14:54:44 +0000 Subject: [PATCH 3/4] gcc46: moving the bootstrap logic into nix It was in the builder.sh. --- pkgs/development/compilers/gcc/4.6/builder.sh | 9 --------- pkgs/development/compilers/gcc/4.6/default.nix | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.6/builder.sh b/pkgs/development/compilers/gcc/4.6/builder.sh index 2f655ece1703..2bb185417390 100644 --- a/pkgs/development/compilers/gcc/4.6/builder.sh +++ b/pkgs/development/compilers/gcc/4.6/builder.sh @@ -243,13 +243,4 @@ postInstall() { eval "$postInstallGhdl" } - -if test -z "$targetConfig" && test -z "$crossConfig"; then - if test -z "$profiledCompiler"; then - buildFlags="bootstrap $buildFlags" - else - buildFlags="profiledbootstrap $buildFlags" - fi -fi - genericBuild diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix index e27f1a47f9c1..9a15faeaf1db 100644 --- a/pkgs/development/compilers/gcc/4.6/default.nix +++ b/pkgs/development/compilers/gcc/4.6/default.nix @@ -153,6 +153,8 @@ let version = "4.6.3"; "-stage-final"; crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else ""; + bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips; + in # We need all these X libraries when building AWT with GTK+. @@ -227,7 +229,7 @@ stdenv.mkDerivation ({ '' else null; - inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; buildNativeInputs = [ texinfo which gettext ] @@ -294,10 +296,15 @@ stdenv.mkDerivation ({ ${if langAda then " --enable-libada" else ""} ${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""} ${if cross != null then crossConfigureFlags else ""} + ${if !bootstrap then "--disable-bootstrap" else ""} "; targetConfig = if (cross != null) then cross.config else null; + buildFlags = if bootstrap then + (if profiledCompiler then "profiledbootstrap" else "bootstrap") + else ""; + installTargets = if stripped then "install-strip" @@ -347,6 +354,7 @@ stdenv.mkDerivation ({ ${if cross != null then crossConfigureFlags else ""} --target=${stdenv.cross.config} ''; + buildFlags = ""; }; From 636303797fa55c6c99de11d3c5a6ff3657fe4ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 27 Dec 2012 14:57:32 +0000 Subject: [PATCH 4/4] gcc47: moving the bootstrap logic into nix It was in the builder.sh. Similar to the previous patch to gcc46. --- pkgs/development/compilers/gcc/4.7/builder.sh | 9 --------- pkgs/development/compilers/gcc/4.7/default.nix | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.7/builder.sh b/pkgs/development/compilers/gcc/4.7/builder.sh index 4ae7a1c193b9..a6c855f4e185 100644 --- a/pkgs/development/compilers/gcc/4.7/builder.sh +++ b/pkgs/development/compilers/gcc/4.7/builder.sh @@ -237,13 +237,4 @@ postInstall() { eval "$postInstallGhdl" } - -if test -z "$targetConfig" && test -z "$crossConfig"; then - if test -z "$profiledCompiler"; then - buildFlags="bootstrap $buildFlags" - else - buildFlags="profiledbootstrap $buildFlags" - fi -fi - genericBuild diff --git a/pkgs/development/compilers/gcc/4.7/default.nix b/pkgs/development/compilers/gcc/4.7/default.nix index 60ef44f2a901..438760499502 100644 --- a/pkgs/development/compilers/gcc/4.7/default.nix +++ b/pkgs/development/compilers/gcc/4.7/default.nix @@ -151,6 +151,8 @@ let version = "4.7.2"; "-stage-final"; crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else ""; + bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips; + in # We need all these X libraries when building AWT with GTK+. @@ -222,7 +224,7 @@ stdenv.mkDerivation ({ '' else null; - inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; buildNativeInputs = [ texinfo which gettext ] @@ -296,10 +298,15 @@ stdenv.mkDerivation ({ ${if langAda then " --enable-libada" else ""} ${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""} ${if cross != null then crossConfigureFlags else ""} + ${if !bootstrap then "--disable-bootstrap" else ""} "; targetConfig = if (cross != null) then cross.config else null; + buildFlags = if bootstrap then + (if profiledCompiler then "profiledbootstrap" else "bootstrap") + else ""; + installTargets = if stripped then "install-strip" @@ -348,6 +355,7 @@ stdenv.mkDerivation ({ ${if cross != null then crossConfigureFlags else ""} --target=${stdenv.cross.config} ''; + buildFlags = ""; };