* Started reorganising stdenv:

- gcc/ld-wrappers have been factored out into a separate
    derivation.  This allows a working gcc to be installed in the user
    environment.  (Previously the Nix gcc didn't work because it
    needed a whole bunch of flags to point to glibc.)
    
  - Better modularity: packages can specify hooks into the setup
    scripts.  For instance, setup no longer knows about the
    PKG_CONFIG_PATH variable; pkgconfig can set it up instead.

  - gcc not longer depends on binutils.  This simplifies the bootstrap
    process.

svn path=/nixpkgs/trunk/; revision=816
This commit is contained in:
Eelco Dolstra
2004-03-08 16:02:46 +00:00
parent 1b8e9faf08
commit ce50734cf0
19 changed files with 374 additions and 246 deletions

View File

@@ -1,65 +0,0 @@
#! /bin/sh -e
. $stdenv/setup
mkdir $out
mkdir $out/bin
for i in $(cd $gcc/bin && ls); do
cat > $out/bin/$i <<EOF
#! /bin/sh
_NIX_CFLAGS_COMPILE="-B$glibc/lib -isystem $glibc/include $NIX_CFLAGS_COMPILE"
_NIX_CFLAGS_LINK="-L$glibc/lib -L$gcc/lib $NIX_CFLAGS_LINK"
_NIX_LDFLAGS="-dynamic-linker $glibc/lib/ld-linux.so.2 -rpath $glibc/lib -rpath $gcc/lib $NIX_LDFLAGS"
IFS=
justcompile=0
if test "\$*" = "-v"; then
justcompile=1
else
for i in \$@; do
if test "\$i" == "-c"; then
justcompile=1
elif test "\$i" == "-S"; then
justcompile=1
elif test "\$i" == "-E"; then
justcompile=1
elif test "\$i" == "-E"; then
justcompile=1
elif test "\$i" == "-M"; then
justcompile=1
elif test "\$i" == "-MM"; then
justcompile=1
fi
done
fi
IFS=" "
extra=(\$_NIX_CFLAGS_COMPILE)
if test "\$justcompile" != "1"; then
extra=(\${extra[@]} \$_NIX_CFLAGS_LINK)
for i in \$_NIX_LDFLAGS; do
extra=(\${extra[@]} "-Wl,\$i")
done
if test "\$_NIX_STRIP_DEBUG" == "1"; then
extra=(\${extra[@]} -g0 -Wl,-s)
fi
fi
if test "\$NIX_DEBUG" == "1"; then
echo "extra flags to @GCC@:" >&2
for i in \${extra[@]}; do
echo " \$i" >&2
done
fi
IFS=
exec $gcc/bin/$i \$@ \${extra[@]}
EOF
chmod +x $out/bin/$i
done
echo $gcc > $out/orig-gcc
echo $glibc > $out/orig-glibc

View File

@@ -1,17 +0,0 @@
# The Nix `gcc' derivation is not directly usable, since it doesn't
# know where the C library and standard header files are. Therefore
# the compiler produced by that package cannot be installed directly
# in a user environment and used from the command line. This
# derivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
{stdenv, gcc}:
derivation {
name = gcc.name; # maybe a bad idea
system = stdenv.system;
builder = ./builder.sh;
glibc = stdenv.param4; # !!! hack
inherit stdenv gcc;
inherit (gcc) langC langCC langF77;
}