* 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
This commit is contained in:
Eelco Dolstra 2004-03-11 17:26:14 +00:00
parent a1b3ae0c81
commit de13527000
34 changed files with 162 additions and 131 deletions

View file

@ -6,7 +6,7 @@
# Force gcc to use ld-wrapper.sh when calling ld. # Force gcc to use ld-wrapper.sh when calling ld.
cflagsCompile="-B$out/bin" 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 # 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 # 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 # /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" ldflags="$ldflags -L$glibc/lib -rpath $glibc/lib -dynamic-linker $glibc/lib/ld-linux.so.2"
fi fi
if test -n "$gcc"; then if test -n "$nativeTools"; then
ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib"
fi
if test -n "$isNative"; then
gccPath="$nativePrefix/bin" gccPath="$nativePrefix/bin"
ldPath="$nativePrefix/bin" ldPath="$nativePrefix/bin"
else else
ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib"
gccPath="$gcc/bin" gccPath="$gcc/bin"
ldPath="$binutils/bin" ldPath="$binutils/bin"
fi fi
@ -76,8 +73,6 @@ NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS"
EOF EOF
sed \ sed \
-e "s^@isNative@^$isNative^g" \
-e "s^@enforcePurity@^$enforcePurity^g" \
-e "s^@gcc@^$gcc^g" \ -e "s^@gcc@^$gcc^g" \
-e "s^@binutils@^$binutils^g" \ -e "s^@binutils@^$binutils^g" \
-e "s^@glibc@^$glibc^g" \ -e "s^@glibc@^$glibc^g" \

View file

@ -5,11 +5,13 @@
# derivation provides a wrapper that sets up the right environment # derivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work". # variables so that the compiler and the linker just "work".
{ name, stdenv, isNative, nativePrefix ? "" { name, stdenv, nativeTools, nativeGlibc, nativePrefix ? ""
, gcc ? null, glibc ? null, binutils ? null}: , gcc ? null, glibc ? null, binutils ? null
}:
assert isNative -> nativePrefix != ""; assert nativeTools -> nativePrefix != "";
assert !isNative -> gcc != null && glibc != null && binutils != null; assert !nativeTools -> gcc != null && binutils != null;
assert !nativeGlibc -> glibc != null;
derivation { derivation {
system = stdenv.system; system = stdenv.system;
@ -17,9 +19,8 @@ derivation {
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh; gccWrapper = ./gcc-wrapper.sh;
ldWrapper = ./ld-wrapper.sh; ldWrapper = ./ld-wrapper.sh;
inherit name stdenv isNative nativePrefix gcc glibc binutils; inherit name stdenv nativeTools nativeGlibc nativePrefix gcc glibc binutils;
enforcePurity = if isNative then false else gcc.enforcePurity; langC = if nativeTools then true else gcc.langC;
langC = if isNative then true else gcc.langC; langCC = if nativeTools then true else gcc.langCC;
langCC = if isNative then true else gcc.langCC; langF77 = if nativeTools then false else gcc.langF77;
langF77 = if isNative then false else gcc.langF77;
} }

View file

@ -40,22 +40,27 @@ skip () {
fi fi
} }
badPath() {
p=$1
test "${p:0:${#NIX_STORE}}" = "$NIX_STORE" -o "${p:0:4}" = "/tmp"
}
params=("$@") params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then
rest=() rest=()
n=0 n=0
while test $n -lt ${#params[*]}; do while test $n -lt ${#params[*]}; do
p=${params[n]} p=${params[n]}
p2=${params[$((n+1))]} 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 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 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 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 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 n=$((n + 1)); skip $p2
else else
rest=("${rest[@]}" "$p") rest=("${rest[@]}" "$p")

View file

@ -12,7 +12,7 @@ skip () {
} }
params=("$@") params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then
rest=() rest=()
n=0 n=0
while test $n -lt ${#params[*]}; do while test $n -lt ${#params[*]}; do
@ -22,10 +22,12 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
skip $p skip $p
elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
n=$((n + 1)); skip $p2 n=$((n + 1)); skip $p2
elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then elif test "$p" = "-dynamic-linker" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
# We cannot skip this; barf. n=$((n + 1)); skip $p2
echo "impure path \`$p' used in link" # elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then
exit 1 # # We cannot skip this; barf.
# echo "impure path \`$p' used in link"
# exit 1
else else
rest=("${rest[@]}" "$p") rest=("${rest[@]}" "$p")
fi fi

View file

@ -10,9 +10,6 @@ addCVars () {
envHooks=(${envHooks[@]} 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). # Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@gcc@"; then if test -n "@gcc@"; then

View file

@ -5,7 +5,7 @@ buildinputs="$binutils"
tar xvfj $src tar xvfj $src
if test "$enforcePurity" = "1"; then if test "$noSysDirs" = "1"; then
# Disable the standard include directories. # Disable the standard include directories.
cd gcc-* cd gcc-*
cat >> ./gcc/cppdefault.h <<EOF cat >> ./gcc/cppdefault.h <<EOF
@ -29,7 +29,7 @@ mkdir build
cd build cd build
../gcc-*/configure --prefix=$out --enable-languages="$langs" ../gcc-*/configure --prefix=$out --enable-languages="$langs"
if test "$enforcePurity" = "1"; then if test "$noSysDirs" = "1"; then
# Patch some of the makefiles to force linking against our own glibc. # Patch some of the makefiles to force linking against our own glibc.
. $NIX_GCC/nix-support/add-flags # add glibc/gcc flags . $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK" extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, enforcePurity ? true { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langF77 ? false , langC ? true, langCC ? true, langF77 ? false
}: }:
@ -16,5 +16,5 @@ derivation {
# url = ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-3.3.3/gcc-3.3.3.tar.bz2; # url = ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-3.3.3/gcc-3.3.3.tar.bz2;
# md5 = "3c6cfd9fcd180481063b4058cf6faff2"; # md5 = "3c6cfd9fcd180481063b4058cf6faff2";
# }; # };
inherit stdenv enforcePurity langC langCC langF77; inherit stdenv noSysDirs langC langCC langF77;
} }

View file

@ -23,6 +23,11 @@ fi
patch -p1 < $srcPatch patch -p1 < $srcPatch
./Configure -de -Dcc=gcc -Dprefix=$out -Uinstallusrbinperl if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
GLIBC=$(cat $NIX_GCC/nix-support/orig-glibc)
extraflags="-Dlocincpth=$GLIBC/include -Dloclibpth=$GLIBC/lib"
fi
./Configure -de -Dcc=gcc -Dprefix=$out -Uinstallusrbinperl $extraflags
make make
make install make install

View file

@ -2,6 +2,7 @@
# glibc cannot have itself in its rpath. # glibc cannot have itself in its rpath.
export NIX_NO_SELF_RPATH=1 export NIX_NO_SELF_RPATH=1
buildinputs="$patch"
. $stdenv/setup . $stdenv/setup
tar xvfj $glibcSrc tar xvfj $glibcSrc

View file

@ -1,4 +1,6 @@
{stdenv, fetchurl, kernelHeaders}: {stdenv, fetchurl, kernelHeaders, patch}:
assert patch != null;
derivation { derivation {
name = "glibc-2.3.2"; name = "glibc-2.3.2";
@ -18,5 +20,5 @@ derivation {
# later releases of glibc won't need this. # later releases of glibc won't need this.
vaargsPatch = ./glibc-2.3.2-sscanf-1.patch; vaargsPatch = ./glibc-2.3.2-sscanf-1.patch;
inherit stdenv kernelHeaders; inherit stdenv kernelHeaders patch;
} }

View file

@ -3,7 +3,7 @@
buildinputs="$zlib" buildinputs="$zlib"
. $stdenv/setup . $stdenv/setup
tar xvfz $src tar xvfj $src
cd libxml2-* cd libxml2-*
./configure --prefix=$out ./configure --prefix=$out
make make

View file

@ -3,12 +3,12 @@
assert !isNull zlib; assert !isNull zlib;
derivation { derivation {
name = "libxml2-2.6.2"; name = "libxml2-2.6.7";
system = stdenv.system; system = stdenv.system;
builder = ./builder.sh; builder = ./builder.sh;
src = fetchurl { src = fetchurl {
url = http://rpmfind.net/pub/libxml/libxml2-2.6.2.tar.gz; url = ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.7.tar.bz2;
md5 = "56e7f74d3d44cc16790ad08624faef64"; md5 = "bdbef92cbdc5b4bd0365313ba22b75ce";
}; };
stdenv = stdenv; stdenv = stdenv;
zlib = zlib; zlib = zlib;

View file

@ -1,15 +0,0 @@
{stdenv, fetchurl, zlib}:
assert !isNull zlib;
derivation {
name = "libxml2-2.6.5";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://rpmfind.net/pub/libxml/libxml2-2.6.5.tar.gz;
md5 = "0ac5dd9902c9bf20f7bc50de1034d49f";
};
stdenv = stdenv;
zlib = zlib;
}

View file

@ -3,6 +3,9 @@
buildinputs="$zlib" buildinputs="$zlib"
. $stdenv/setup . $stdenv/setup
export NIX_STRIP_DEBUG=
export NIX_CFLAGS_COMPILE="-g $NIX_CFLAGS_COMPILE"
tar xvfz $src tar xvfz $src
cd rna-* cd rna-*
./configure --prefix=$out ./configure --prefix=$out

View file

@ -1,5 +1,7 @@
#! /bin/sh -e #! /bin/sh -e
set -x
buildinputs="$pkgconfig $fontconfig $x11" buildinputs="$pkgconfig $fontconfig $x11"
. $stdenv/setup . $stdenv/setup

View file

@ -6,7 +6,7 @@ tar xvfj $src
cd binutils-* cd binutils-*
# Clear the default library search path. # Clear the default library search path.
if test "$enforcePurity" = "1"; then if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi fi

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, enforcePurity ? true}: {stdenv, fetchurl, noSysDirs}:
derivation { derivation {
name = "binutils-2.14"; name = "binutils-2.14";
@ -8,5 +8,5 @@ derivation {
url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2; url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2;
md5 = "2da8def15d28af3ec6af0982709ae90a"; md5 = "2da8def15d28af3ec6af0982709ae90a";
}; };
inherit stdenv enforcePurity; inherit stdenv noSysDirs;
} }

View file

@ -1,15 +1,20 @@
#! /bin/sh -e #! /bin/sh -e
set -x
buildinputs="$autoconf $g77 $texinfo $bison $flex $gperf $rna $aterm" buildinputs="$autoconf $g77 $texinfo $bison $flex $gperf $rna $aterm"
. $stdenv/setup . $stdenv/setup
g77orig=$(cat $g77/orig-gcc) g77orig=$(cat $g77/nix-support/orig-gcc)
export NIX_LDFLAGS="-rpath $g77orig/lib $NIX_LDFLAGS" export NIX_LDFLAGS="-rpath $g77orig/lib $NIX_LDFLAGS"
export NIX_STRIP_DEBUG=
export NIX_CFLAGS_COMPILE="-g $NIX_CFLAGS_COMPILE"
tar xvfz $src tar xvfz $src
cd octavefront-* cd octavefront-*
./autogen.sh ./autogen.sh
./configure --prefix=$out --disable-readline --enable-rna=$rna --enable-aterm ./configure --prefix=$out --disable-readline --enable-rna=$rna --enable-aterm
make make
make install make install
strip -S $out/lib/*/*.a #strip -S $out/lib/*/*.a

View file

@ -1,5 +1,11 @@
#! /bin/sh #! /bin/sh
p1=$param1
p2=$param2
p3=$param3
p4=$param4
p5=$param5
. $stdenv/setup . $stdenv/setup
mkdir $out || exit 1 mkdir $out || exit 1
@ -9,9 +15,9 @@ sed \
-e "s^@postHook@^$postHook^g" \ -e "s^@postHook@^$postHook^g" \
-e "s^@initialPath@^$initialPath^g" \ -e "s^@initialPath@^$initialPath^g" \
-e "s^@gcc@^$gcc^g" \ -e "s^@gcc@^$gcc^g" \
-e "s^@param1@^$param1^g" \ -e "s^@param1@^$p1^g" \
-e "s^@param2@^$param2^g" \ -e "s^@param2@^$p2^g" \
-e "s^@param3@^$param3^g" \ -e "s^@param3@^$p3^g" \
-e "s^@param4@^$param4^g" \ -e "s^@param4@^$p4^g" \
-e "s^@param5@^$param5^g" \ -e "s^@param5@^$p5^g" \
< $setup > $out/setup || exit 1 < $setup > $out/setup || exit 1

View file

@ -30,6 +30,7 @@ if test -z "$SHELL"; then echo "SHELL not set"; exit 1; fi
# Hack: run gcc's setup hook. # Hack: run gcc's setup hook.
envHooks=()
if test -f $NIX_GCC/nix-support/setup-hook; then if test -f $NIX_GCC/nix-support/setup-hook; then
. $NIX_GCC/nix-support/setup-hook . $NIX_GCC/nix-support/setup-hook
fi fi
@ -47,13 +48,12 @@ findInputs()
if test -f $pkg/nix-support/propagated-build-inputs; then if test -f $pkg/nix-support/propagated-build-inputs; then
for i in $(cat $pkg/nix-support/propagated-build-inputs); do for i in $(cat $pkg/nix-support/propagated-build-inputs); do
addToEnv $pkg findInputs $i
done done
fi fi
} }
pkgs=() pkgs=()
envHooks=()
for i in $buildinputs; do for i in $buildinputs; do
findInputs $i findInputs $i
done done
@ -69,6 +69,8 @@ addToEnv()
export _PATH=$_PATH:$1/bin export _PATH=$_PATH:$1/bin
fi fi
echo "${envHooks[@]}"
for i in "${envHooks[@]}"; do for i in "${envHooks[@]}"; do
$i $pkg $i $pkg
done done

View file

@ -9,7 +9,8 @@
gcc = (import ../../build-support/gcc-wrapper) { gcc = (import ../../build-support/gcc-wrapper) {
name = "gcc-native"; name = "gcc-native";
isNative = true; nativeTools = true;
nativeGlibc = true;
nativePrefix = "/usr"; nativePrefix = "/usr";
inherit stdenv; inherit stdenv;
}; };

View file

@ -1 +1,3 @@
export SHELL=/bin/sh export SHELL=/bin/sh
export NIX_ENFORCE_PURITY=

View file

@ -1,16 +1,19 @@
{stdenv, glibc}: {stdenv, pkgs, glibc}:
(import ../generic) { (import ../generic) {
name = "stdenv-nix-linux-boot"; name = "stdenv-nix-linux-boot";
preHook = ./prehook-boot.sh; preHook = ./prehook-boot.sh;
initialPath = "/usr/local /usr /"; initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
inherit stdenv; inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) { gcc = (import ../../build-support/gcc-wrapper) {
name = "gcc-native"; name = pkgs.gcc.name;
isNative = true; nativeTools = false;
nativePrefix = "/usr"; nativeGlibc = false;
inherit (pkgs) gcc binutils;
inherit stdenv glibc; inherit stdenv glibc;
}; };
param1 = pkgs.bash;
} }

View file

@ -8,10 +8,10 @@
inherit stdenv; inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) { gcc = (import ../../build-support/gcc-wrapper) {
name = "gcc-native"; name = pkgs.gcc.name;
isNative = false; nativeTools = false;
gcc = pkgs.gcc; nativeGlibc = false;
binutils = pkgs.binutils; inherit (pkgs) gcc binutils;
inherit stdenv glibc; inherit stdenv glibc;
}; };

View file

@ -1 +1,3 @@
export SHELL=/bin/sh export SHELL=$param1
export NIX_ENFORCE_PURITY=

View file

@ -1,13 +1,19 @@
{bootStdenv, pkgs}: (import ../generic) { {stdenv, pkgs}:
(import ../generic) {
name = "stdenv-nix"; name = "stdenv-nix";
system = bootStdenv.system; preHook = ./prehook.sh;
prehook = ./prehook.sh;
posthook = ./posthook.sh;
initialPath = (import ./path.nix) {pkgs = pkgs;}; initialPath = (import ./path.nix) {pkgs = pkgs;};
inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) {
name = pkgs.gcc.name;
nativeTools = false;
nativeGlibc = true;
inherit (pkgs) gcc binutils;
inherit stdenv;
};
param1 = pkgs.bash; param1 = pkgs.bash;
param2 = pkgs.gcc;
param3 = pkgs.binutils;
param4 = "";
param5 = "";
noSysDirs = false;
} }

View file

@ -1,7 +1 @@
export SHELL=$param1 export SHELL=$param1
echo "SHELL = $SHELL"
export NIX_CC=$param2/bin/gcc
export NIX_CXX=$param2/bin/g++
export NIX_LD=$param3/bin/ld

View file

@ -2,7 +2,9 @@
# identifier and a standard build environment, returns the set of all # identifier and a standard build environment, returns the set of all
# packages provided by the Nix Package Collection. # packages provided by the Nix Package Collection.
{system, stdenv}: rec { {stdenv, noSysDirs ? true}:
rec {
inherit stdenv; inherit stdenv;
@ -112,7 +114,7 @@
### DEVELOPMENT ### DEVELOPMENT
binutils = (import ../development/tools/misc/binutils) { binutils = (import ../development/tools/misc/binutils) {
inherit fetchurl stdenv; inherit fetchurl stdenv noSysDirs;
}; };
gnum4 = (import ../development/tools/misc/gnum4) { gnum4 = (import ../development/tools/misc/gnum4) {
@ -198,16 +200,21 @@
}; };
gcc = (import ../development/compilers/gcc) { gcc = (import ../development/compilers/gcc) {
inherit fetchurl stdenv; inherit fetchurl stdenv noSysDirs;
}; };
g77 = (import ../build-support/gcc-wrapper) { g77 = (import ../build-support/gcc-wrapper) {
inherit stdenv; name = "g77";
nativeTools = false;
nativeGlibc = false;
gcc = (import ../development/compilers/gcc) { gcc = (import ../development/compilers/gcc) {
inherit fetchurl stdenv; inherit fetchurl stdenv noSysDirs;
langF77 = true; langF77 = true;
langCC = false; langCC = false;
}; };
binutils = stdenv.gcc.binutils;
glibc = stdenv.gcc.glibc;
inherit stdenv;
}; };
jikes = (import ../development/compilers/jikes) { jikes = (import ../development/compilers/jikes) {
@ -275,6 +282,7 @@
glibc = (import ../development/libraries/glibc) { glibc = (import ../development/libraries/glibc) {
inherit fetchurl stdenv kernelHeaders; inherit fetchurl stdenv kernelHeaders;
patch = gnupatch;
}; };
aterm = (import ../development/libraries/aterm) { aterm = (import ../development/libraries/aterm) {
@ -351,10 +359,6 @@
inherit fetchurl stdenv libxml2; inherit fetchurl stdenv libxml2;
}; };
libxml2_265 = (import ../development/libraries/libxml2/libxml2-2.6.5.nix) {
inherit fetchurl stdenv zlib;
};
gettext = (import ../development/libraries/gettext) { gettext = (import ../development/libraries/gettext) {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };

View file

@ -12,6 +12,6 @@
# Select the right instantiation. # Select the right instantiation.
body = body =
if system == "i686-linux" if system == "i686-linux"
then stdenvs.stdenvNativePkgs #stdenvs.stdenvLinuxPkgs then stdenvs.stdenvLinuxPkgs
else stdenvs.stdenvNixPkgs; else stdenvs.stdenvNixPkgs;
} }

View file

@ -23,7 +23,7 @@ let {
# pkgs.binutils # pkgs.binutils
# pkgs.gnum4 # pkgs.gnum4
# pkgs.valgrind # pkgs.valgrind
pkgs.texinfo # pkgs.texinfo
pkgs.octavefront pkgs.octavefront
# pkgs.gnumake # pkgs.gnumake
# pkgs.bisonnew # pkgs.bisonnew
@ -38,8 +38,8 @@ let {
# pkgs.libxslt # pkgs.libxslt
# pkgs.docbook_xml_dtd # pkgs.docbook_xml_dtd
# pkgs.docbook_xml_xslt # pkgs.docbook_xml_xslt
# pkgs.subversion pkgs.subversion
# pkgs.pan pkgs.pan
# pkgs.sylpheed # pkgs.sylpheed
# pkgs.firefox # pkgs.firefox
# pkgs.MPlayer # pkgs.MPlayer

View file

@ -22,34 +22,35 @@
# with it (e.g., because they require GNU Make). # with it (e.g., because they require GNU Make).
stdenvNative = (import ../stdenv/native) {stdenv = stdenvInitial;}; stdenvNative = (import ../stdenv/native) {stdenv = stdenvInitial;};
stdenvNativePkgs = allPackages {system = system; stdenv = stdenvNative;}; stdenvNativePkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
# The Nix build environment. # The Nix build environment.
stdenvNix = (import ../stdenv/nix) { stdenvNix = (import ../stdenv/nix) {
bootStdenv = stdenvNative; stdenv = stdenvNative;
pkgs = stdenvNativePkgs; pkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
}; };
stdenvNixPkgs = allPackages {system = system; stdenv = stdenvNix;}; stdenvNixPkgs = allPackages {stdenv = stdenvNix;};
# The Linux build environment is a fully bootstrapped Nix # The Linux build environment is a fully bootstrapped Nix
# environment, that is, it should contain no external references. # environment, that is, it should contain no external references.
# 1) Build glibc in the native build environment. The result is # 1) Build glibc in the Nix build environment. The result is
# pure (I promise!). # pure.
stdenvLinuxGlibc = stdenvNativePkgs.glibc; stdenvLinuxGlibc = stdenvNativePkgs.glibc; # !!! should be NixPkgs, but doesn't work
# 2) Construct a stdenv consisting of the native build environment, # 2) Construct a stdenv consisting of the native build environment,
# plus the pure glibc. # plus the pure glibc.
stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) { stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) {
stdenv = stdenvInitial; stdenv = stdenvNative;
pkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
}; };
# 3) Now we can build packages that will have the Nix glibc. # 3) Now we can build packages that will have the Nix glibc.
stdenvLinuxBoot1Pkgs = allPackages {system = system; stdenv = stdenvLinuxBoot1;}; stdenvLinuxBoot1Pkgs = allPackages {stdenv = stdenvLinuxBoot1;};
# 4) However, since these packages are built by an native C compiler # 4) However, since these packages are built by an native C compiler
# and linker, they may well pick up impure references (e.g., bash # and linker, they may well pick up impure references (e.g., bash
@ -62,11 +63,11 @@
}; };
# 5) These packages should be pure. # 5) These packages should be pure.
stdenvLinuxBoot2Pkgs = allPackages {system = system; stdenv = stdenvLinuxBoot2;}; stdenvLinuxBoot2Pkgs = allPackages {stdenv = stdenvLinuxBoot2;};
# 6) So finally we can construct the Nix build environment. # 6) So finally we can construct the Nix build environment.
stdenvLinux = (import ../stdenv/nix-linux) { stdenvLinux = (import ../stdenv/nix-linux) {
bootStdenv = stdenvLinuxBoot2; stdenv = stdenvLinuxBoot2;
pkgs = stdenvLinuxBoot2Pkgs; pkgs = stdenvLinuxBoot2Pkgs;
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
}; };
@ -74,7 +75,7 @@
# 7) And we can build all packages against that, but we don't # 7) And we can build all packages against that, but we don't
# rebuild stuff from step 6. # rebuild stuff from step 6.
stdenvLinuxPkgs = stdenvLinuxPkgs =
allPackages {system = system; stdenv = stdenvLinux;} // allPackages {stdenv = stdenvLinux;} //
{inherit (stdenvLinuxBoot2Pkgs) {inherit (stdenvLinuxBoot2Pkgs)
gzip bzip2 bash binutils coreutils diffutils findutils gawk gcc gzip bzip2 bash binutils coreutils diffutils findutils gawk gcc
gnumake gnused gnutar gnugrep wget; gnumake gnused gnutar gnugrep wget;

View file

@ -1,10 +1,15 @@
#! /bin/sh #! /bin/sh
set -x
export NIX_DEBUG=1 export NIX_DEBUG=1
. $stdenv/setup . $stdenv/setup
export NIX_ENFORCE_PURITY=1 #echo starting shell
#/bin/sh < /dev/tty > /dev/tty 2>&1
#exit 1
mkdir $out mkdir $out
mkdir $out/bin 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 $out/bin/hello
exit 0
cat > hello2.cc <<EOF cat > hello2.cc <<EOF
#include <iostream> #include <iostream>

View file

@ -6,7 +6,7 @@ let {
allPackages = import ../../system/all-packages-generic.nix; allPackages = import ../../system/all-packages-generic.nix;
}; };
stdenv = stdenvs.stdenvLinuxBoot1; stdenv = stdenvs.stdenvLinuxBoot2;
test = derivation { test = derivation {
name = "simple-test"; name = "simple-test";

View file

@ -1,10 +1,14 @@
#! /bin/sh #! /bin/sh -e
set -x
export NIX_DEBUG=1
buildinputs="$pcre" buildinputs="$pcre"
. $stdenv/setup || exit 1 . $stdenv/setup
tar xvfj $src || exit 1 echo $NIX_LDFLAGS
cd grep-* || exit 1
./configure --prefix=$out || exit 1 tar xvfj $src
make || exit 1 cd grep-*
make install || exit 1 ./configure --prefix=$out
make
make install