From de13527000165c566e47d2146a1a6480fc67da59 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 11 Mar 2004 17:26:14 +0000 Subject: [PATCH] * Finally got stdenv-nix-linux working again. Still not perfect, though. * libxml2: upgrade to latest. * octavefront/rna: keep debug info. svn path=/nixpkgs/trunk/; revision=830 --- pkgs/build-support/gcc-wrapper/builder.sh | 11 +++----- pkgs/build-support/gcc-wrapper/default.nix | 19 +++++++------- pkgs/build-support/gcc-wrapper/gcc-wrapper.sh | 17 ++++++++----- pkgs/build-support/gcc-wrapper/ld-wrapper.sh | 12 +++++---- pkgs/build-support/gcc-wrapper/setup-hook.sh | 3 --- pkgs/development/compilers/gcc/builder.sh | 4 +-- pkgs/development/compilers/gcc/default.nix | 4 +-- pkgs/development/interpreters/perl/builder.sh | 7 +++++- pkgs/development/libraries/glibc/builder.sh | 1 + pkgs/development/libraries/glibc/default.nix | 6 +++-- pkgs/development/libraries/libxml2/builder.sh | 2 +- .../development/libraries/libxml2/default.nix | 6 ++--- .../libraries/libxml2/libxml2-2.6.5.nix | 15 ----------- pkgs/development/libraries/rna/builder.sh | 3 +++ pkgs/development/libraries/xft/builder.sh | 2 ++ .../tools/misc/binutils/builder.sh | 2 +- .../tools/misc/binutils/default.nix | 4 +-- .../tools/misc/octavefront/builder.sh | 9 +++++-- pkgs/stdenv/generic/builder.sh | 16 ++++++++---- pkgs/stdenv/generic/setup.sh | 6 +++-- pkgs/stdenv/native/default.nix | 3 ++- pkgs/stdenv/native/prehook.sh | 2 ++ pkgs/stdenv/nix-linux/boot.nix | 13 ++++++---- pkgs/stdenv/nix-linux/default.nix | 8 +++--- pkgs/stdenv/nix-linux/prehook-boot.sh | 4 ++- pkgs/stdenv/nix/default.nix | 24 +++++++++++------- pkgs/stdenv/nix/prehook.sh | 6 ----- pkgs/system/all-packages-generic.nix | 22 +++++++++------- pkgs/system/all-packages.nix | 2 +- pkgs/system/populate-cache.nix | 6 ++--- pkgs/system/stdenvs.nix | 25 ++++++++++--------- pkgs/test/simple/builder.sh | 9 ++++--- pkgs/test/simple/default.nix | 2 +- pkgs/tools/text/gnugrep/builder.sh | 18 +++++++------ 34 files changed, 162 insertions(+), 131 deletions(-) delete mode 100644 pkgs/development/libraries/libxml2/libxml2-2.6.5.nix diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh index e704c8b67942..352a5895135f 100755 --- a/pkgs/build-support/gcc-wrapper/builder.sh +++ b/pkgs/build-support/gcc-wrapper/builder.sh @@ -6,7 +6,7 @@ # Force gcc to use ld-wrapper.sh when calling ld. cflagsCompile="-B$out/bin" -if test -n "$glibc"; then +if test -z "$nativeGlibc"; then # The "-B$glibc/lib" flag 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 @@ -15,14 +15,11 @@ if test -n "$glibc"; then ldflags="$ldflags -L$glibc/lib -rpath $glibc/lib -dynamic-linker $glibc/lib/ld-linux.so.2" fi -if test -n "$gcc"; then - ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib" -fi - -if test -n "$isNative"; then +if test -n "$nativeTools"; then gccPath="$nativePrefix/bin" ldPath="$nativePrefix/bin" else + ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib" gccPath="$gcc/bin" ldPath="$binutils/bin" fi @@ -76,8 +73,6 @@ NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS" EOF sed \ - -e "s^@isNative@^$isNative^g" \ - -e "s^@enforcePurity@^$enforcePurity^g" \ -e "s^@gcc@^$gcc^g" \ -e "s^@binutils@^$binutils^g" \ -e "s^@glibc@^$glibc^g" \ diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 631212a9f227..a9c3f3382b85 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -5,11 +5,13 @@ # derivation provides a wrapper that sets up the right environment # variables so that the compiler and the linker just "work". -{ name, stdenv, isNative, nativePrefix ? "" -, gcc ? null, glibc ? null, binutils ? null}: +{ name, stdenv, nativeTools, nativeGlibc, nativePrefix ? "" +, gcc ? null, glibc ? null, binutils ? null +}: -assert isNative -> nativePrefix != ""; -assert !isNative -> gcc != null && glibc != null && binutils != null; +assert nativeTools -> nativePrefix != ""; +assert !nativeTools -> gcc != null && binutils != null; +assert !nativeGlibc -> glibc != null; derivation { system = stdenv.system; @@ -17,9 +19,8 @@ derivation { setupHook = ./setup-hook.sh; gccWrapper = ./gcc-wrapper.sh; ldWrapper = ./ld-wrapper.sh; - inherit name stdenv isNative nativePrefix gcc glibc binutils; - enforcePurity = if isNative then false else gcc.enforcePurity; - langC = if isNative then true else gcc.langC; - langCC = if isNative then true else gcc.langCC; - langF77 = if isNative then false else gcc.langF77; + inherit name stdenv nativeTools nativeGlibc nativePrefix gcc glibc binutils; + langC = if nativeTools then true else gcc.langC; + langCC = if nativeTools then true else gcc.langCC; + langF77 = if nativeTools then false else gcc.langF77; } diff --git a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh index 7bc01eb035be..29d3ffb8e492 100644 --- a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh +++ b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh @@ -40,22 +40,27 @@ skip () { fi } +badPath() { + p=$1 + test "${p:0:${#NIX_STORE}}" = "$NIX_STORE" -o "${p:0:4}" = "/tmp" +} + params=("$@") -if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then +if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then rest=() n=0 while test $n -lt ${#params[*]}; do p=${params[n]} p2=${params[$((n+1))]} - if test "${p:0:3}" = "-L/" -a "${p:2:${#NIX_STORE}}" != "$NIX_STORE"; then + if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then skip $p - elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then + elif test "$p" = "-L" && badPath "$p2"; then n=$((n + 1)); skip $p2 - elif test "${p:0:3}" = "-I/" -a "${p:2:${#NIX_STORE}}" != "$NIX_STORE"; then + elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then skip $p - elif test "$p" = "-I" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then + elif test "$p" = "-I" && badPath "$p2"; then n=$((n + 1)); skip $p2 - elif test "$p" = "-isystem" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then + elif test "$p" = "-isystem" && badPath "$p2"; then n=$((n + 1)); skip $p2 else rest=("${rest[@]}" "$p") diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh index c94f24833c70..bf59b2a8afbb 100644 --- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh @@ -12,7 +12,7 @@ skip () { } params=("$@") -if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then +if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then rest=() n=0 while test $n -lt ${#params[*]}; do @@ -22,10 +22,12 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then skip $p elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then n=$((n + 1)); skip $p2 - elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then - # We cannot skip this; barf. - echo "impure path \`$p' used in link" - exit 1 + elif test "$p" = "-dynamic-linker" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then + n=$((n + 1)); skip $p2 +# elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then +# # We cannot skip this; barf. +# echo "impure path \`$p' used in link" +# exit 1 else rest=("${rest[@]}" "$p") fi diff --git a/pkgs/build-support/gcc-wrapper/setup-hook.sh b/pkgs/build-support/gcc-wrapper/setup-hook.sh index 4385ab0602ba..a52ca43d9df8 100644 --- a/pkgs/build-support/gcc-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-wrapper/setup-hook.sh @@ -10,9 +10,6 @@ addCVars () { envHooks=(${envHooks[@]} addCVars) -export NIX_IS_NATIVE=@isNative@ -export NIX_ENFORCE_PURITY=@enforcePurity@ - # Note: these come *after* $out in the PATH (see setup.sh). if test -n "@gcc@"; then diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index ce772d07a78c..c1438e6d0e88 100755 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -5,7 +5,7 @@ buildinputs="$binutils" tar xvfj $src -if test "$enforcePurity" = "1"; then +if test "$noSysDirs" = "1"; then # Disable the standard include directories. cd gcc-* cat >> ./gcc/cppdefault.h < /dev/tty 2>&1 + +#exit 1 mkdir $out mkdir $out/bin @@ -24,8 +29,6 @@ gcc -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello $out/bin/hello -exit 0 - cat > hello2.cc < diff --git a/pkgs/test/simple/default.nix b/pkgs/test/simple/default.nix index 9374a6ede281..39b0416fc9a1 100644 --- a/pkgs/test/simple/default.nix +++ b/pkgs/test/simple/default.nix @@ -6,7 +6,7 @@ let { allPackages = import ../../system/all-packages-generic.nix; }; - stdenv = stdenvs.stdenvLinuxBoot1; + stdenv = stdenvs.stdenvLinuxBoot2; test = derivation { name = "simple-test"; diff --git a/pkgs/tools/text/gnugrep/builder.sh b/pkgs/tools/text/gnugrep/builder.sh index 3453b5b0cb87..cb2c91a6b078 100755 --- a/pkgs/tools/text/gnugrep/builder.sh +++ b/pkgs/tools/text/gnugrep/builder.sh @@ -1,10 +1,14 @@ -#! /bin/sh +#! /bin/sh -e +set -x +export NIX_DEBUG=1 buildinputs="$pcre" -. $stdenv/setup || exit 1 +. $stdenv/setup -tar xvfj $src || exit 1 -cd grep-* || exit 1 -./configure --prefix=$out || exit 1 -make || exit 1 -make install || exit 1 +echo $NIX_LDFLAGS + +tar xvfj $src +cd grep-* +./configure --prefix=$out +make +make install