* stdenv-nix-linux should more-or-less work again now.

svn path=/nixpkgs/trunk/; revision=826
This commit is contained in:
Eelco Dolstra 2004-03-09 17:16:02 +00:00
parent ab73ec398b
commit a1b3ae0c81
19 changed files with 79 additions and 90 deletions

View File

@ -5,22 +5,22 @@ export NIX_NO_SELF_RPATH=1
. $stdenv/setup . $stdenv/setup
tar xvfj $glibcSrc 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 mkdir build
cd 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
make install 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/lib/*.a $out/lib/*.so $out/lib/gconv/*.so || true
strip -s $out/bin/* $out/sbin/* $out/libexec/* || 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 exit 0

View File

@ -1,17 +1,17 @@
#! /bin/sh #! /bin/sh -e
. $stdenv/setup || exit 1 . $stdenv/setup
tar xvfj $src || exit 1 tar xvfj $src
cd binutils-* || exit 1 cd binutils-*
# Clear the default library search path. # Clear the default library search path.
if test "$noSysDirs" == "1"; then if test "$enforcePurity" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt || exit 1 echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi fi
./configure --prefix=$out || exit 1 ./configure --prefix=$out
make || exit 1 make
make install || exit 1 make install
strip -S $out/lib/*.a || exit 1 strip -S $out/lib/*.a

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation { {stdenv, fetchurl, enforcePurity ? true}:
derivation {
name = "binutils-2.14"; name = "binutils-2.14";
system = stdenv.system; system = stdenv.system;
builder = ./builder.sh; builder = ./builder.sh;
@ -6,6 +8,5 @@
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";
}; };
stdenv = stdenv; inherit stdenv enforcePurity;
noSysDirs = stdenv.noSysDirs;
} }

View File

@ -1,4 +1,4 @@
{ stdenv, name, preHook, postHook, initialPath, gcc { stdenv, name, preHook ? null, postHook ? null, initialPath, gcc
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? "" , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
}: }:

View File

@ -1,9 +1,11 @@
set -e set -e
test -z $NIX_GCC && NIX_GCC=@gcc@
# Set up the initial path. # Set up the initial path.
PATH= PATH=
for i in @gcc@ @initialPath@; do for i in $NIX_GCC @initialPath@; do
PATH=$PATH${PATH:+:}$i/bin PATH=$PATH${PATH:+:}$i/bin
done done
@ -18,12 +20,18 @@ param2=@param2@
param3=@param3@ param3=@param3@
param4=@param4@ param4=@param4@
param5=@param5@ 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. # Hack: run gcc's setup hook.
if test -f @gcc@/nix-support/setup-hook; then if test -f $NIX_GCC/nix-support/setup-hook; then
. @gcc@/nix-support/setup-hook . $NIX_GCC/nix-support/setup-hook
fi fi
@ -93,7 +101,9 @@ export TZ=UTC
# Execute the post-hook. # Execute the post-hook.
. @postHook@ if test -n "@postHook@"; then
. @postHook@
fi
PATH=$_PATH${_PATH:+:}$PATH PATH=$_PATH${_PATH:+:}$PATH
if test "$NIX_DEBUG" = "1"; then if test "$NIX_DEBUG" = "1"; then

View File

@ -3,15 +3,14 @@
(import ../generic) { (import ../generic) {
name = "stdenv-native"; name = "stdenv-native";
preHook = ./prehook.sh; preHook = ./prehook.sh;
postHook = ./posthook.sh;
initialPath = "/usr/local /usr /"; initialPath = "/usr/local /usr /";
inherit stdenv; inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) { gcc = (import ../../build-support/gcc-wrapper) {
inherit stdenv;
name = "gcc-native"; name = "gcc-native";
isNative = true; isNative = true;
gcc = "/usr"; nativePrefix = "/usr";
inherit stdenv;
}; };
} }

View File

@ -1,13 +1,16 @@
{system, glibc}: (import ../generic) { {stdenv, glibc}:
name = "stdenv-linux-boot";
system = system; (import ../generic) {
prehook = ./prehook-boot.sh; name = "stdenv-nix-linux-boot";
posthook = ./posthook.sh; preHook = ./prehook-boot.sh;
initialPath = "/usr/local /usr /"; initialPath = "/usr/local /usr /";
param1 = "";
param2 = ""; inherit stdenv;
param3 = "";
param4 = glibc; gcc = (import ../../build-support/gcc-wrapper) {
param5 = ""; name = "gcc-native";
noSysDirs = true; isNative = true;
nativePrefix = "/usr";
inherit stdenv glibc;
};
} }

View File

@ -1,13 +1,19 @@
{bootStdenv, pkgs, glibc}: (import ../generic) { {stdenv, glibc, pkgs}:
(import ../generic) {
name = "stdenv-nix-linux"; name = "stdenv-nix-linux";
system = bootStdenv.system; preHook = ./prehook.sh;
prehook = ./prehook.sh;
posthook = ./posthook.sh;
initialPath = (import ../nix/path.nix) {pkgs = pkgs;}; 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; param1 = pkgs.bash;
param2 = pkgs.gcc;
param3 = pkgs.binutils;
param4 = glibc;
param5 = "";
noSysDirs = true;
} }

View File

@ -1,18 +1 @@
export SHELL=/bin/sh 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"

View File

@ -1,18 +1,3 @@
export SHELL=$param1 export SHELL=$param1
export NIX_CC=$param2/bin/gcc export NIX_ENFORCE_PURITY=1
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"

View File

@ -198,12 +198,12 @@
}; };
gcc = (import ../development/compilers/gcc) { gcc = (import ../development/compilers/gcc) {
inherit fetchurl stdenv binutils; inherit fetchurl stdenv;
}; };
g77 = (import ../build-support/gcc-wrapper) { g77 = (import ../build-support/gcc-wrapper) {
inherit stdenv; inherit stdenv;
gcc = (import ../development/compilers/gcc-new) { gcc = (import ../development/compilers/gcc) {
inherit fetchurl stdenv; inherit fetchurl stdenv;
langF77 = true; langF77 = true;
langCC = false; langCC = false;

View File

@ -44,7 +44,7 @@
# 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) {
system = system; stdenv = stdenvInitial;
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
}; };
@ -56,7 +56,7 @@
# might end up linking against /lib/libncurses). So repeat, but # might end up linking against /lib/libncurses). So repeat, but
# now use the Nix-built tools from step 2/3. # now use the Nix-built tools from step 2/3.
stdenvLinuxBoot2 = (import ../stdenv/nix-linux) { stdenvLinuxBoot2 = (import ../stdenv/nix-linux) {
bootStdenv = stdenvLinuxBoot1; stdenv = stdenvLinuxBoot1;
pkgs = stdenvLinuxBoot1Pkgs; pkgs = stdenvLinuxBoot1Pkgs;
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
}; };

View File

@ -4,7 +4,7 @@ export NIX_DEBUG=1
. $stdenv/setup . $stdenv/setup
#export NIX_CFLAGS_COMPILE="-v $NIX_CFLAGS_COMPILE" export NIX_ENFORCE_PURITY=1
mkdir $out mkdir $out
mkdir $out/bin 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 $out/bin/hello
exit 0
cat > hello2.cc <<EOF cat > hello2.cc <<EOF
#include <iostream> #include <iostream>

View File

@ -1,12 +1,12 @@
let { let {
system = "i686-linux"; system = "i686-linux";
stdenvInitial = (import ../../stdenv/initial) { stdenvs = (import ../../system/stdenvs.nix) {
name = "stdenv-initial"; system = "i686-linux";
inherit system; allPackages = import ../../system/all-packages-generic.nix;
}; };
stdenv = (import ../../stdenv/native) {stdenv = stdenvInitial;}; stdenv = stdenvs.stdenvLinuxBoot1;
test = derivation { test = derivation {
name = "simple-test"; name = "simple-test";