diff options
Diffstat (limited to 'pkgs')
19 files changed, 79 insertions, 90 deletions
diff --git a/pkgs/development/compilers/gcc-new/builder.sh b/pkgs/development/compilers/gcc/builder.sh index ce772d07a78c6..ce772d07a78c6 100755 --- a/pkgs/development/compilers/gcc-new/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh diff --git a/pkgs/development/compilers/gcc-new/default.nix b/pkgs/development/compilers/gcc/default.nix index 9e79b21cd7a6e..9e79b21cd7a6e 100644 --- a/pkgs/development/compilers/gcc-new/default.nix +++ b/pkgs/development/compilers/gcc/default.nix diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh index e3842a81c1db7..b671d269cbff4 100755 --- a/pkgs/development/libraries/glibc/builder.sh +++ b/pkgs/development/libraries/glibc/builder.sh @@ -5,22 +5,22 @@ export NIX_NO_SELF_RPATH=1 . $stdenv/setup tar xvfj $glibcSrc -(cd glibc-* && tar xvfj $linuxthreadsSrc) +(cd glibc-* && tar xvfj $linuxthreadsSrc) || false -(cd glibc-* && patch -p1 < $vaargsPatch) +(cd glibc-* && patch -p1 < $vaargsPatch) || false mkdir build cd build -LDFLAGS=-Wl,-S ../glibc-*/configure --prefix=$out --enable-add-ons --disable-profile +../glibc-*/configure --prefix=$out --enable-add-ons --disable-profile make make install -#make localedata/install-locales +make localedata/install-locales strip -S $out/lib/*.a $out/lib/*.so $out/lib/gconv/*.so || true strip -s $out/bin/* $out/sbin/* $out/libexec/* || true -ln -sf /etc/ld.so.cache $out/etc/ld.so.cache +rm $out/etc/ld.so.cache -(cd $out/include && ln -s $kernelHeaders/include/* .) +(cd $out/include && ln -s $kernelHeaders/include/* .) || false exit 0 diff --git a/pkgs/development/tools/misc/binutils/builder.sh b/pkgs/development/tools/misc/binutils/builder.sh index 7782ea0898898..f76eb534c558e 100755 --- a/pkgs/development/tools/misc/binutils/builder.sh +++ b/pkgs/development/tools/misc/binutils/builder.sh @@ -1,17 +1,17 @@ -#! /bin/sh +#! /bin/sh -e -. $stdenv/setup || exit 1 +. $stdenv/setup -tar xvfj $src || exit 1 -cd binutils-* || exit 1 +tar xvfj $src +cd binutils-* # Clear the default library search path. -if test "$noSysDirs" == "1"; then - echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt || exit 1 +if test "$enforcePurity" = "1"; then + echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt fi -./configure --prefix=$out || exit 1 -make || exit 1 -make install || exit 1 +./configure --prefix=$out +make +make install -strip -S $out/lib/*.a || exit 1 +strip -S $out/lib/*.a diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 07d6b416a54a7..3f027d90fcc6c 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -1,4 +1,6 @@ -{stdenv, fetchurl}: derivation { +{stdenv, fetchurl, enforcePurity ? true}: + +derivation { name = "binutils-2.14"; system = stdenv.system; builder = ./builder.sh; @@ -6,6 +8,5 @@ url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2; md5 = "2da8def15d28af3ec6af0982709ae90a"; }; - stdenv = stdenv; - noSysDirs = stdenv.noSysDirs; + inherit stdenv enforcePurity; } diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index c816e58880802..9c877252e2be6 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -1,4 +1,4 @@ -{ stdenv, name, preHook, postHook, initialPath, gcc +{ stdenv, name, preHook ? null, postHook ? null, initialPath, gcc , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? "" }: diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index c1b2ef99236bf..259417afaa3be 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1,9 +1,11 @@ set -e +test -z $NIX_GCC && NIX_GCC=@gcc@ + # Set up the initial path. PATH= -for i in @gcc@ @initialPath@; do +for i in $NIX_GCC @initialPath@; do PATH=$PATH${PATH:+:}$i/bin done @@ -18,12 +20,18 @@ param2=@param2@ param3=@param3@ param4=@param4@ param5=@param5@ -. @preHook@ +if test -n "@preHook@"; then + . @preHook@ +fi + + +# Check that the pre-hook initialised SHELL. +if test -z "$SHELL"; then echo "SHELL not set"; exit 1; fi # Hack: run gcc's setup hook. -if test -f @gcc@/nix-support/setup-hook; then - . @gcc@/nix-support/setup-hook +if test -f $NIX_GCC/nix-support/setup-hook; then + . $NIX_GCC/nix-support/setup-hook fi @@ -93,7 +101,9 @@ export TZ=UTC # Execute the post-hook. -. @postHook@ +if test -n "@postHook@"; then + . @postHook@ +fi PATH=$_PATH${_PATH:+:}$PATH if test "$NIX_DEBUG" = "1"; then diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index cf5a1da198788..2fd6b670c3996 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -3,15 +3,14 @@ (import ../generic) { name = "stdenv-native"; preHook = ./prehook.sh; - postHook = ./posthook.sh; initialPath = "/usr/local /usr /"; inherit stdenv; gcc = (import ../../build-support/gcc-wrapper) { - inherit stdenv; name = "gcc-native"; isNative = true; - gcc = "/usr"; + nativePrefix = "/usr"; + inherit stdenv; }; } diff --git a/pkgs/stdenv/native/posthook.sh b/pkgs/stdenv/native/posthook.sh deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/pkgs/stdenv/native/posthook.sh +++ /dev/null diff --git a/pkgs/stdenv/nix-linux/boot.nix b/pkgs/stdenv/nix-linux/boot.nix index c42b3f33302af..cc5ab2122e871 100644 --- a/pkgs/stdenv/nix-linux/boot.nix +++ b/pkgs/stdenv/nix-linux/boot.nix @@ -1,13 +1,16 @@ -{system, glibc}: (import ../generic) { - name = "stdenv-linux-boot"; - system = system; - prehook = ./prehook-boot.sh; - posthook = ./posthook.sh; +{stdenv, glibc}: + +(import ../generic) { + name = "stdenv-nix-linux-boot"; + preHook = ./prehook-boot.sh; initialPath = "/usr/local /usr /"; - param1 = ""; - param2 = ""; - param3 = ""; - param4 = glibc; - param5 = ""; - noSysDirs = true; + + inherit stdenv; + + gcc = (import ../../build-support/gcc-wrapper) { + name = "gcc-native"; + isNative = true; + nativePrefix = "/usr"; + inherit stdenv glibc; + }; } diff --git a/pkgs/stdenv/nix-linux/default.nix b/pkgs/stdenv/nix-linux/default.nix index b0898826b5d72..518939757488c 100644 --- a/pkgs/stdenv/nix-linux/default.nix +++ b/pkgs/stdenv/nix-linux/default.nix @@ -1,13 +1,19 @@ -{bootStdenv, pkgs, glibc}: (import ../generic) { +{stdenv, glibc, pkgs}: + +(import ../generic) { name = "stdenv-nix-linux"; - system = bootStdenv.system; - prehook = ./prehook.sh; - posthook = ./posthook.sh; + preHook = ./prehook.sh; initialPath = (import ../nix/path.nix) {pkgs = pkgs;}; + + inherit stdenv; + + gcc = (import ../../build-support/gcc-wrapper) { + name = "gcc-native"; + isNative = false; + gcc = pkgs.gcc; + binutils = pkgs.binutils; + inherit stdenv glibc; + }; + param1 = pkgs.bash; - param2 = pkgs.gcc; - param3 = pkgs.binutils; - param4 = glibc; - param5 = ""; - noSysDirs = true; } diff --git a/pkgs/stdenv/nix-linux/posthook.sh b/pkgs/stdenv/nix-linux/posthook.sh deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/pkgs/stdenv/nix-linux/posthook.sh +++ /dev/null diff --git a/pkgs/stdenv/nix-linux/prehook-boot.sh b/pkgs/stdenv/nix-linux/prehook-boot.sh index 193f232c33746..af1ba16ccbeb6 100644 --- a/pkgs/stdenv/nix-linux/prehook-boot.sh +++ b/pkgs/stdenv/nix-linux/prehook-boot.sh @@ -1,18 +1 @@ export SHELL=/bin/sh - -export NIX_CC=/usr/bin/gcc -export NIX_CXX=/usr/bin/g++ -export NIX_LD=/usr/bin/ld - -# The "-B$param4/lib" is a quick hack to force gcc to link against the -# crt1.o from our own glibc, rather than the one in /usr/lib. The -# real solution is of course to prevent those paths from being used by -# gcc in the first place. -# !!! -B should really be in NIX_CFLAGS_LINK, but ld-wrapper also uses -# that one (incorrectly?). -export NIX_CFLAGS_COMPILE="-B$param4/lib -isystem $param4/include $NIX_CFLAGS_COMPILE" -export NIX_CFLAGS_LINK="-L$param4/lib $NIX_CFLAGS_LINK" -export NIX_LDFLAGS="-dynamic-linker $param4/lib/ld-linux.so.2 -rpath $param4/lib $NIX_LDFLAGS" - -export NIX_LIBC_INCLUDES="$param4/include" -export NIX_LIBC_LIBS="$param4/lib" diff --git a/pkgs/stdenv/nix-linux/prehook.sh b/pkgs/stdenv/nix-linux/prehook.sh index 087b245401cb2..0e0bada4fcb26 100644 --- a/pkgs/stdenv/nix-linux/prehook.sh +++ b/pkgs/stdenv/nix-linux/prehook.sh @@ -1,18 +1,3 @@ export SHELL=$param1 -export NIX_CC=$param2/bin/gcc -export NIX_CXX=$param2/bin/g++ -export NIX_LD=$param3/bin/ld - -# The "-B$param4/lib" is a quick hack to force gcc to link against the -# crt1.o from our own glibc, rather than the one in /usr/lib. The -# real solution is of course to prevent those paths from being used by -# gcc in the first place. -# !!! -B should really be in NIX_CFLAGS_LINK, but ld-wrapper also uses -# that one (incorrectly?). -export NIX_CFLAGS_COMPILE="-B$param4/lib -isystem $param4/include $NIX_CFLAGS_COMPILE" -export NIX_CFLAGS_LINK="-L$param4/lib -L$param2/lib $NIX_CFLAGS_LINK" -export NIX_LDFLAGS="-dynamic-linker $param4/lib/ld-linux.so.2 -rpath $param4/lib -rpath $param2/lib $NIX_LDFLAGS" - -export NIX_LIBC_INCLUDES="$param4/include" -export NIX_LIBC_LIBS="$param4/lib" +export NIX_ENFORCE_PURITY=1 diff --git a/pkgs/stdenv/nix/posthook.sh b/pkgs/stdenv/nix/posthook.sh deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/pkgs/stdenv/nix/posthook.sh +++ /dev/null diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix index 4de6e4ca502af..d656845994e7d 100644 --- a/pkgs/system/all-packages-generic.nix +++ b/pkgs/system/all-packages-generic.nix @@ -198,12 +198,12 @@ }; gcc = (import ../development/compilers/gcc) { - inherit fetchurl stdenv binutils; + inherit fetchurl stdenv; }; g77 = (import ../build-support/gcc-wrapper) { inherit stdenv; - gcc = (import ../development/compilers/gcc-new) { + gcc = (import ../development/compilers/gcc) { inherit fetchurl stdenv; langF77 = true; langCC = false; diff --git a/pkgs/system/stdenvs.nix b/pkgs/system/stdenvs.nix index 06a9fc50fedff..d770d6874992e 100644 --- a/pkgs/system/stdenvs.nix +++ b/pkgs/system/stdenvs.nix @@ -44,7 +44,7 @@ # 2) Construct a stdenv consisting of the native build environment, # plus the pure glibc. stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) { - system = system; + stdenv = stdenvInitial; glibc = stdenvLinuxGlibc; }; @@ -56,7 +56,7 @@ # might end up linking against /lib/libncurses). So repeat, but # now use the Nix-built tools from step 2/3. stdenvLinuxBoot2 = (import ../stdenv/nix-linux) { - bootStdenv = stdenvLinuxBoot1; + stdenv = stdenvLinuxBoot1; pkgs = stdenvLinuxBoot1Pkgs; glibc = stdenvLinuxGlibc; }; diff --git a/pkgs/test/simple/builder.sh b/pkgs/test/simple/builder.sh index 282fc520bd1f7..58bf16c43b342 100755 --- a/pkgs/test/simple/builder.sh +++ b/pkgs/test/simple/builder.sh @@ -4,7 +4,7 @@ export NIX_DEBUG=1 . $stdenv/setup -#export NIX_CFLAGS_COMPILE="-v $NIX_CFLAGS_COMPILE" +export NIX_ENFORCE_PURITY=1 mkdir $out mkdir $out/bin @@ -24,6 +24,8 @@ gcc -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello $out/bin/hello +exit 0 + cat > hello2.cc <<EOF #include <iostream> diff --git a/pkgs/test/simple/default.nix b/pkgs/test/simple/default.nix index 2d582f03a5112..9374a6ede281d 100644 --- a/pkgs/test/simple/default.nix +++ b/pkgs/test/simple/default.nix @@ -1,12 +1,12 @@ let { system = "i686-linux"; - stdenvInitial = (import ../../stdenv/initial) { - name = "stdenv-initial"; - inherit system; + stdenvs = (import ../../system/stdenvs.nix) { + system = "i686-linux"; + allPackages = import ../../system/all-packages-generic.nix; }; - stdenv = (import ../../stdenv/native) {stdenv = stdenvInitial;}; + stdenv = stdenvs.stdenvLinuxBoot1; test = derivation { name = "simple-test"; |