* Added the GNU C Library (glibc), a big step towards full Nixification of

the build and execution environment.

  This is very useful.  For example, it allows packages built on a SuSE 
  8.2 system to run on a SuSE 8.1 system (this is because 8.2 has a newer 
  glibc; packages built against it cannot be dynamically linked against 
  older glibcs).

  Of course, Fix packages should not directly import glibc since that is 
  very system-specific.  Rather, they should import stdenv/stdenv.fix and 
  in their build scripts source in $stdenv/setup, which will setup the 
  right environment variables.  The idea is that stdenv.fix provides the 
  basic C/Unix build environment (C compiler, POSIX utilities, etc.).

  Note that only the ATerm package currently uses this.

svn path=/nixpkgs/trunk/; revision=203
This commit is contained in:
Eelco Dolstra 2003-07-24 15:15:48 +00:00
parent 1a5e75c192
commit 1dda526c66
7 changed files with 84 additions and 2 deletions

View file

@ -1,9 +1,10 @@
#! /bin/sh
export PATH=/bin:/usr/bin
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd aterm-* || exit 1
LDFLAGS=-s ./configure --prefix=$out --with-gcc || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
(cd $out/lib && ln -s libATerm.a libATerm-gcc.a) || exit 1

View file

@ -1,9 +1,12 @@
Package(
[ ("name", "aterm-2.0")
, ("build", Relative("aterm/aterm-build.sh"))
, ("src", App(IncludeFix("fetchurl/fetchurl.fix"),
[ ("url", "http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz")
, ("md5", "853474e4bcf4a85f7d38a0676b36bded")
]))
, ("stdenv", IncludeFix("stdenv/stdenv.fix"))
]
)

13
pkgs/glibc/glibc-build.sh Executable file
View file

@ -0,0 +1,13 @@
#! /bin/sh
export PATH=/bin:/usr/bin
tar xvfj $glibcSrc || exit 1
(cd glibc-* && tar xvfj $linuxthreadsSrc) || exit 1
mkdir build || exit 1
cd build || exit 1
../glibc-*/configure --prefix=$out --enable-add-ons || exit 1
make || exit 1
make install || exit 1

16
pkgs/glibc/glibc.fix Normal file
View file

@ -0,0 +1,16 @@
Package(
[ ("name", "glibc-2.3.2")
, ("build", Relative("glibc/glibc-build.sh"))
, ("glibcSrc", App(IncludeFix("fetchurl/fetchurl.fix"),
[ ("url", "ftp://ftp.nl.net/pub/gnu/glibc/glibc-2.3.2.tar.bz2")
, ("md5", "ede969aad568f48083e413384f20753c")
]))
, ("linuxthreadsSrc", App(IncludeFix("fetchurl/fetchurl.fix"),
[ ("url", "ftp://ftp.nl.net/pub/gnu/glibc/glibc-linuxthreads-2.3.2.tar.bz2")
, ("md5", "894b8969cfbdf787c73e139782167607")
]))
]
)

View file

@ -0,0 +1,18 @@
#! /bin/sh
realgcc=@GCC@
libc=@LIBC@
justcompile=0
for i in $*; do
if test "$i" == "-c"; then
justcompile=1
fi
done
extra="-isystem $libc/include"
if test "$justcompile" != "1"; then
extra="$extra -L $libc/lib -Wl,-dynamic-linker,$libc/lib/ld-linux.so.2,-rpath,$libc/lib"
fi
exec $realgcc $* $extra

22
pkgs/stdenv/stdenv-build.sh Executable file
View file

@ -0,0 +1,22 @@
#! /bin/sh
export PATH=/bin:/usr/bin
mkdir $out || exit 1
mkdir $out/bin || exit 1
echo "export PATH=$out/bin:/bin:/usr/bin" >> $out/setup || exit 1
gcc=/usr/bin/gcc
sed \
-e s^@GCC\@^$gcc^g \
-e s^@LIBC\@^$glibc^g \
< $gccwrapper > $out/bin/gcc || exit 1
chmod +x $out/bin/gcc || exit 1
sed \
-e s^@GCC\@^$g++^g \
-e s^@LIBC\@^$glibc^g \
< $gccwrapper > $out/bin/g++ || exit 1
chmod +x $out/bin/g++ || exit 1

9
pkgs/stdenv/stdenv.fix Normal file
View file

@ -0,0 +1,9 @@
Package(
[ ("name", "stdenv-linux")
, ("build", Relative("stdenv/stdenv-build.sh"))
, ("gccwrapper", Relative("stdenv/gcc-wrapper.sh"))
, ("glibc", IncludeFix("glibc/glibc.fix"))
]
)