1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 05:00:16 +00:00

* 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.
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" \

View file

@ -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;
}

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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 <<EOF
@ -29,7 +29,7 @@ mkdir build
cd build
../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.
. $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
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
}:
@ -16,5 +16,5 @@ derivation {
# url = ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-3.3.3/gcc-3.3.3.tar.bz2;
# md5 = "3c6cfd9fcd180481063b4058cf6faff2";
# };
inherit stdenv enforcePurity langC langCC langF77;
inherit stdenv noSysDirs langC langCC langF77;
}

View file

@ -23,6 +23,11 @@ fi
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 install

View file

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

View file

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

View file

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

View file

@ -3,12 +3,12 @@
assert !isNull zlib;
derivation {
name = "libxml2-2.6.2";
name = "libxml2-2.6.7";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://rpmfind.net/pub/libxml/libxml2-2.6.2.tar.gz;
md5 = "56e7f74d3d44cc16790ad08624faef64";
url = ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.7.tar.bz2;
md5 = "bdbef92cbdc5b4bd0365313ba22b75ce";
};
stdenv = stdenv;
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"
. $stdenv/setup
export NIX_STRIP_DEBUG=
export NIX_CFLAGS_COMPILE="-g $NIX_CFLAGS_COMPILE"
tar xvfz $src
cd rna-*
./configure --prefix=$out

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,11 @@
#! /bin/sh
p1=$param1
p2=$param2
p3=$param3
p4=$param4
p5=$param5
. $stdenv/setup
mkdir $out || exit 1
@ -9,9 +15,9 @@ sed \
-e "s^@postHook@^$postHook^g" \
-e "s^@initialPath@^$initialPath^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@param1@^$param1^g" \
-e "s^@param2@^$param2^g" \
-e "s^@param3@^$param3^g" \
-e "s^@param4@^$param4^g" \
-e "s^@param5@^$param5^g" \
-e "s^@param1@^$p1^g" \
-e "s^@param2@^$p2^g" \
-e "s^@param3@^$p3^g" \
-e "s^@param4@^$p4^g" \
-e "s^@param5@^$p5^g" \
< $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.
envHooks=()
if test -f $NIX_GCC/nix-support/setup-hook; then
. $NIX_GCC/nix-support/setup-hook
fi
@ -47,13 +48,12 @@ findInputs()
if test -f $pkg/nix-support/propagated-build-inputs; then
for i in $(cat $pkg/nix-support/propagated-build-inputs); do
addToEnv $pkg
findInputs $i
done
fi
}
pkgs=()
envHooks=()
for i in $buildinputs; do
findInputs $i
done
@ -69,6 +69,8 @@ addToEnv()
export _PATH=$_PATH:$1/bin
fi
echo "${envHooks[@]}"
for i in "${envHooks[@]}"; do
$i $pkg
done

View file

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

View file

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

View file

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

View file

@ -8,10 +8,10 @@
inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) {
name = "gcc-native";
isNative = false;
gcc = pkgs.gcc;
binutils = pkgs.binutils;
name = pkgs.gcc.name;
nativeTools = false;
nativeGlibc = false;
inherit (pkgs) gcc binutils;
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";
system = bootStdenv.system;
prehook = ./prehook.sh;
posthook = ./posthook.sh;
preHook = ./prehook.sh;
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;
param2 = pkgs.gcc;
param3 = pkgs.binutils;
param4 = "";
param5 = "";
noSysDirs = false;
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,10 +1,15 @@
#! /bin/sh
set -x
export NIX_DEBUG=1
. $stdenv/setup
export NIX_ENFORCE_PURITY=1
#echo starting shell
#/bin/sh < /dev/tty > /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 <<EOF
#include <iostream>

View file

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

View file

@ -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