From 01e38f9371e0d7a4db5457394b90d23a08eb03f7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Jul 2003 21:15:03 +0000 Subject: [PATCH] * Use rpaths to ensure that executable and dynamic libraries are automatically linked against the right dynamic libraries. set-env.sh add the right linker flags to the NIX_LDFLAGS environment variable, which is passed by gcc-wrapper to the linker. (In many cases these flags could just be passed through LDFLAGS to configure scripts; however, in many other cases this doesn't work properly.) --This line, and those below, will be ignored-- M pkgs/atk/atk-build.sh M pkgs/glibc/glibc-build.sh M pkgs/expat/expat-build.sh M pkgs/freetype/freetype-build.sh M pkgs/system/populate-linkdirs.pl M pkgs/sdf2/sdf2-build.sh M pkgs/pspell/pspell-build.sh M pkgs/subversion/subversion-build.sh M pkgs/helpers/set-env.sh M pkgs/pango/pango-build.sh M pkgs/strategoxt/strategoxt-build.sh M pkgs/aterm/aterm-build.sh M pkgs/libxml2/libxml2-build.sh M pkgs/glib-1/glib-build.sh M pkgs/glib/glib-build.sh M pkgs/pan/pan.fix M pkgs/pan/pan-build.sh M pkgs/libxslt/libxslt-build.sh M pkgs/httpd/httpd-build.sh M pkgs/openssl/openssl-build.sh M pkgs/gtkspell/gtkspell-build.sh M pkgs/fontconfig/fontconfig.fix M pkgs/fontconfig/fontconfig-build.sh M pkgs/gnet/gnet-build.sh M pkgs/gtk+-1/gtk+-build.sh M pkgs/gtk+/gtk+-build.sh M pkgs/stdenv/gcc-wrapper.sh M pkgs/stdenv/stdenv-build.sh M pkgs/db4/db4-build.sh M pkgs/db4/db4.fix M pkgs/MPlayer/MPlayer-build.sh M pkgs/swig/swig-build.sh svn path=/nixpkgs/trunk/; revision=213 --- pkgs/MPlayer/MPlayer-build.sh | 6 +++--- pkgs/aterm/aterm-build.sh | 6 ++++-- pkgs/atk/atk-build.sh | 7 +++++-- pkgs/db4/db4-build.sh | 4 +++- pkgs/db4/db4.fix | 2 +- pkgs/expat/expat-build.sh | 5 ++++- pkgs/fontconfig/fontconfig-build.sh | 11 ++++++++--- pkgs/fontconfig/fontconfig.fix | 1 + pkgs/freetype/freetype-build.sh | 4 +++- pkgs/glib-1/glib-build.sh | 4 +++- pkgs/glib/glib-build.sh | 4 +++- pkgs/glibc/glibc-build.sh | 3 +-- pkgs/gnet/gnet-build.sh | 5 ++++- pkgs/gtk+-1/gtk+-build.sh | 5 ++++- pkgs/gtk+/gtk+-build.sh | 8 +++++--- pkgs/gtkspell/gtkspell-build.sh | 5 ++++- pkgs/helpers/set-env.sh | 5 +++-- pkgs/httpd/httpd-build.sh | 6 ++++-- pkgs/libxml2/libxml2-build.sh | 4 +++- pkgs/libxslt/libxslt-build.sh | 6 ++++-- pkgs/openssl/openssl-build.sh | 4 +++- pkgs/pan/pan-build.sh | 5 +++-- pkgs/pan/pan.fix | 2 +- pkgs/pango/pango-build.sh | 9 ++++++--- pkgs/pspell/pspell-build.sh | 5 ++++- pkgs/sdf2/sdf2-build.sh | 4 +++- pkgs/stdenv/gcc-wrapper.sh | 19 +++++++++++++++++-- pkgs/stdenv/stdenv-build.sh | 8 ++++++-- pkgs/strategoxt/strategoxt-build.sh | 4 +++- pkgs/subversion/subversion-build.sh | 6 ++++-- pkgs/swig/swig-build.sh | 4 +++- pkgs/system/populate-linkdirs.pl | 16 ++++++++-------- 32 files changed, 131 insertions(+), 56 deletions(-) diff --git a/pkgs/MPlayer/MPlayer-build.sh b/pkgs/MPlayer/MPlayer-build.sh index eb9eea7f3331..cdac34bb45cb 100644 --- a/pkgs/MPlayer/MPlayer-build.sh +++ b/pkgs/MPlayer/MPlayer-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 envpkgs="$freetype" -. $setenv +. $setenv || exit 1 tar xvfj $src || exit 1 tar xvfj $fonts || exit 1 @@ -18,5 +20,3 @@ cd MPlayer-* || exit 1 make || exit 1 make install || exit 1 cp -p ../font-arial-iso-8859-1/font-arial-18-iso-8859-1/* $out/share/mplayer/font || exit 1 - -echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/aterm/aterm-build.sh b/pkgs/aterm/aterm-build.sh index 564af228db7f..22e1c8d29992 100755 --- a/pkgs/aterm/aterm-build.sh +++ b/pkgs/aterm/aterm-build.sh @@ -1,10 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd aterm-* || exit 1 -./configure --prefix=$out || exit 1 +./configure --prefix=$out --with-gcc || exit 1 make || exit 1 make install || exit 1 -(cd $out/lib && ln -s libATerm.a libATerm-gcc.a) || exit 1 +strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/atk/atk-build.sh b/pkgs/atk/atk-build.sh index 67f87930c431..0bb71d047a20 100755 --- a/pkgs/atk/atk-build.sh +++ b/pkgs/atk/atk-build.sh @@ -1,14 +1,17 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 export PATH=$pkgconfig/bin:$PATH envpkgs=$glib -. $setenv +. $setenv || exit 1 tar xvfj $src || exit 1 cd atk-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/db4/db4-build.sh b/pkgs/db4/db4-build.sh index 4298bfa1c594..57d12f3e485f 100755 --- a/pkgs/db4/db4-build.sh +++ b/pkgs/db4/db4-build.sh @@ -1,10 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd db-*/build_unix || exit 1 -LDFLAGS=-Wl,-S ../dist/configure --prefix=$out --enable-cxx --enable-compat185 || exit 1 +../dist/configure --prefix=$out --enable-cxx --enable-compat185 || exit 1 make || exit 1 make install || exit 1 rm -rf $out/doc || exit 1 diff --git a/pkgs/db4/db4.fix b/pkgs/db4/db4.fix index 32a033236159..561fcc267e59 100644 --- a/pkgs/db4/db4.fix +++ b/pkgs/db4/db4.fix @@ -1,5 +1,5 @@ Package( - [ ("name", "db-4.0.14") + [ ("name", "db4-4.0.14") , ("build", Relative("db4/db4-build.sh")) , ("src", App(IncludeFix("fetchurl/fetchurl.fix"), diff --git a/pkgs/expat/expat-build.sh b/pkgs/expat/expat-build.sh index 6b6561f99145..61286cc4a5a6 100755 --- a/pkgs/expat/expat-build.sh +++ b/pkgs/expat/expat-build.sh @@ -1,9 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd expat-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 +strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/fontconfig/fontconfig-build.sh b/pkgs/fontconfig/fontconfig-build.sh index e4b6f563d21d..04d3ba388eef 100755 --- a/pkgs/fontconfig/fontconfig-build.sh +++ b/pkgs/fontconfig/fontconfig-build.sh @@ -1,13 +1,18 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 -envpkgs=$freetype -. $setenv +envpkgs="$freetype $expat" +. $setenv || exit 1 tar xvfz $src || exit 1 cd fcpackage*/fontconfig || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --with-confdir=$out/etc/fonts --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 +./configure --prefix=$out --with-confdir=$out/etc/fonts \ + --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib \ + --with-expat-includes=$expat/include --with-expat-lib=$expat/lib || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/fontconfig/fontconfig.fix b/pkgs/fontconfig/fontconfig.fix index 07c00f1a193d..e953222c0cea 100644 --- a/pkgs/fontconfig/fontconfig.fix +++ b/pkgs/fontconfig/fontconfig.fix @@ -11,5 +11,6 @@ Package( , ("stdenv", IncludeFix("stdenv/stdenv.fix")) , ("freetype", IncludeFix("freetype/freetype.fix")) + , ("expat", IncludeFix("expat/expat.fix")) ] ) diff --git a/pkgs/freetype/freetype-build.sh b/pkgs/freetype/freetype-build.sh index 7c27e7ff373f..07b087ff1fe0 100755 --- a/pkgs/freetype/freetype-build.sh +++ b/pkgs/freetype/freetype-build.sh @@ -1,10 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfj $src || exit 1 cd freetype-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/glib-1/glib-build.sh b/pkgs/glib-1/glib-build.sh index 174ae5b2e1e6..d32fa470420c 100755 --- a/pkgs/glib-1/glib-build.sh +++ b/pkgs/glib-1/glib-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd glib-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/glib/glib-build.sh b/pkgs/glib/glib-build.sh index 946bab455f38..f6966d41a986 100755 --- a/pkgs/glib/glib-build.sh +++ b/pkgs/glib/glib-build.sh @@ -1,11 +1,13 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 export PATH=$pkgconfig/bin:$PATH tar xvfj $src || exit 1 cd glib-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/glibc/glibc-build.sh b/pkgs/glibc/glibc-build.sh index 3066121ca67a..138585ddf949 100755 --- a/pkgs/glibc/glibc-build.sh +++ b/pkgs/glibc/glibc-build.sh @@ -15,7 +15,6 @@ make localedata/install-locales || exit 1 strip -S $out/lib/*.a $out/lib/*.so $out/lib/gconv/*.so strip -s $out/bin/* $out/sbin/* $out/libexec/* -ln -s /etc/ld.so.conf $out/etc/ld.so.conf || exit 1 -$out/sbin/ldconfig /lib /usr/lib || exit 1 +ln -sf /etc/ld.so.cache $out/etc/ld.so.cache || exit 1 exit 0 diff --git a/pkgs/gnet/gnet-build.sh b/pkgs/gnet/gnet-build.sh index c57703ea77a5..b89a492480d8 100755 --- a/pkgs/gnet/gnet-build.sh +++ b/pkgs/gnet/gnet-build.sh @@ -1,5 +1,7 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 export PATH=$pkgconfig/bin:/bin:/usr/bin @@ -8,7 +10,8 @@ envpkgs=$glib tar xvfz $src || exit 1 cd gnet-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/gtk+-1/gtk+-build.sh b/pkgs/gtk+-1/gtk+-build.sh index 786002408378..16553ff2174b 100755 --- a/pkgs/gtk+-1/gtk+-build.sh +++ b/pkgs/gtk+-1/gtk+-build.sh @@ -1,5 +1,7 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 envpkgs="$glib" @@ -7,7 +9,8 @@ envpkgs="$glib" tar xvfz $src || exit 1 cd gtk+-* || exit 1 -LDFLAGS=-s ./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 +./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/gtk+/gtk+-build.sh b/pkgs/gtk+/gtk+-build.sh index 6ae4ffbdade5..bb6df1c3a1e7 100755 --- a/pkgs/gtk+/gtk+-build.sh +++ b/pkgs/gtk+/gtk+-build.sh @@ -1,14 +1,16 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 -export PATH=$pkgconfig/bin:/bin:/usr/bin +export PATH=$pkgconfig/bin:$PATH envpkgs="$glib $atk $pango" -. $setenv +. $setenv || exit 1 tar xvfj $src || exit 1 cd gtk+-* || exit 1 -LDFLAGS=-Wl,-s ./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 +./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/gtkspell/gtkspell-build.sh b/pkgs/gtkspell/gtkspell-build.sh index 452e179ad71b..ed442b652dc6 100755 --- a/pkgs/gtkspell/gtkspell-build.sh +++ b/pkgs/gtkspell/gtkspell-build.sh @@ -1,5 +1,7 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 export PATH=$pkgconfig/bin:$PATH @@ -10,7 +12,8 @@ export C_INCLUDE_PATH=$pspell/include:$C_INCLUDE_PATH tar xvfz $src || exit 1 cd gtkspell-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --disable-gtk-doc || exit 1 +./configure --prefix=$out --disable-gtk-doc || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/helpers/set-env.sh b/pkgs/helpers/set-env.sh index f28e9af18f15..cc36af509c1c 100644 --- a/pkgs/helpers/set-env.sh +++ b/pkgs/helpers/set-env.sh @@ -7,8 +7,7 @@ addtoenv() fi if test -d $1/lib; then - export LIBRARY_PATH=$1/lib:$LIBRARY_PATH - export LD_LIBRARY_PATH=$1/lib:$LD_LIBRARY_PATH + export NIX_LDFLAGS="-L $1/lib -Wl,-rpath,$1/lib $NIX_LDFLAGS" fi if test -d $1/lib/pkgconfig; then @@ -28,3 +27,5 @@ envpkgs= for i in $oldenvpkgs; do addtoenv $i done + +export NIX_LDFLAGS="-Wl,-rpath,$out/lib $NIX_LDFLAGS" diff --git a/pkgs/httpd/httpd-build.sh b/pkgs/httpd/httpd-build.sh index d226251eb024..c35e5d5b28ec 100755 --- a/pkgs/httpd/httpd-build.sh +++ b/pkgs/httpd/httpd-build.sh @@ -1,13 +1,15 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 envpkgs="$ssl $db4 $expat" -. $setenv +. $setenv || exit 1 tar xvfz $src || exit 1 cd httpd-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --enable-ssl --with-ssl=$ssl --with-berkeley-db=$db4 \ +./configure --prefix=$out --enable-ssl --with-ssl=$ssl --with-berkeley-db=$db4 \ --with-expat=$expat --enable-mods-shared=all --without-gdbm || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/libxml2/libxml2-build.sh b/pkgs/libxml2/libxml2-build.sh index e88ac55e069d..f691e1d5702b 100755 --- a/pkgs/libxml2/libxml2-build.sh +++ b/pkgs/libxml2/libxml2-build.sh @@ -1,10 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd libxml2-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/libxslt/libxslt-build.sh b/pkgs/libxslt/libxslt-build.sh index aa6db2f045f2..3b52df125f87 100755 --- a/pkgs/libxslt/libxslt-build.sh +++ b/pkgs/libxslt/libxslt-build.sh @@ -1,13 +1,15 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 envpkgs="$libxml" -. $setenv +. $setenv || exit 1 tar xvfz $src || exit 1 cd libxslt-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/openssl/openssl-build.sh b/pkgs/openssl/openssl-build.sh index 4884c288d979..bbc8b7e14b3d 100755 --- a/pkgs/openssl/openssl-build.sh +++ b/pkgs/openssl/openssl-build.sh @@ -1,10 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd openssl-* || exit 1 -LDFLAGS=-Wl,-S ./config --prefix=$out shared || exit 1 +./config --prefix=$out shared || exit 1 make || exit 1 mkdir $out || exit 1 make install || exit 1 diff --git a/pkgs/pan/pan-build.sh b/pkgs/pan/pan-build.sh index 2b3393e0cd67..efe51857f66b 100755 --- a/pkgs/pan/pan-build.sh +++ b/pkgs/pan/pan-build.sh @@ -1,5 +1,7 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 export PATH=$pkgconfig/bin:$PATH @@ -8,7 +10,6 @@ envpkgs="$gtk $gtkspell $gnet $libxml" tar xvfj $src || exit 1 cd pan-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 -echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/pan/pan.fix b/pkgs/pan/pan.fix index 60b474538754..be3c8066ca01 100644 --- a/pkgs/pan/pan.fix +++ b/pkgs/pan/pan.fix @@ -12,7 +12,7 @@ Package( , ("stdenv", IncludeFix("stdenv/stdenv.fix")) , ("pkgconfig", IncludeFix("pkgconfig/pkgconfig.fix")) , ("gtk", IncludeFix("gtk+/gtk+.fix")) - + , ("gtkspell", IncludeFix("gtkspell/gtkspell.fix")) , ("gnet", IncludeFix("gnet/gnet.fix")) , ("libxml", IncludeFix("libxml2/libxml2.fix")) ] diff --git a/pkgs/pango/pango-build.sh b/pkgs/pango/pango-build.sh index 82e38a8223fa..855bf27396bb 100755 --- a/pkgs/pango/pango-build.sh +++ b/pkgs/pango/pango-build.sh @@ -1,14 +1,17 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 -export PATH=$pkgconfig/bin:/bin:/usr/bin +export PATH=$pkgconfig/bin:$PATH envpkgs="$glib $Xft" -. $setenv +. $setenv || exit 1 tar xvfj $src || exit 1 cd pango-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 +./configure --prefix=$out --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib || exit 1 make || exit 1 make install || exit 1 + echo $envpkgs > $out/envpkgs || exit 1 diff --git a/pkgs/pspell/pspell-build.sh b/pkgs/pspell/pspell-build.sh index 8183ea525758..6d5675110acf 100755 --- a/pkgs/pspell/pspell-build.sh +++ b/pkgs/pspell/pspell-build.sh @@ -1,9 +1,12 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd pspell-* || exit 1 -CXX=g++ LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 make || exit 1 make install || exit 1 +strip -S $out/lib/*.a || exit 1 diff --git a/pkgs/sdf2/sdf2-build.sh b/pkgs/sdf2/sdf2-build.sh index ba95536179d0..9639bdfef2c1 100755 --- a/pkgs/sdf2/sdf2-build.sh +++ b/pkgs/sdf2/sdf2-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd sdf2-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --with-aterm=$aterm || exit 1 +./configure --prefix=$out --with-aterm=$aterm || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/stdenv/gcc-wrapper.sh b/pkgs/stdenv/gcc-wrapper.sh index 95c876056680..63530408bfdd 100644 --- a/pkgs/stdenv/gcc-wrapper.sh +++ b/pkgs/stdenv/gcc-wrapper.sh @@ -10,11 +10,26 @@ for i in $@; do if test "$i" == "-c"; then justcompile=1 fi + if test "$i" == "-S"; then + justcompile=1 + fi + if test "$i" == "-E"; then + justcompile=1 + fi done -extra=("-isystem" "$libc/include") +IFS=" " +extra=$NIX_CFLAGS if test "$justcompile" != "1"; then - extra=(${extra[@]} "-L" "$libc/lib" "-Wl,-dynamic-linker,$libc/lib/ld-linux.so.2,-rpath,$libc/lib") + extra=(${extra[@]} $NIX_LDFLAGS) fi +if test "$NIX_DEBUG" == "1"; then + echo "extra gcc flags:" + for i in ${extra[@]}; do + echo " $i" + done +fi + +IFS= exec $realgcc $@ ${extra[@]} diff --git a/pkgs/stdenv/stdenv-build.sh b/pkgs/stdenv/stdenv-build.sh index 8d3a7ae7b280..5b5ba436d81e 100755 --- a/pkgs/stdenv/stdenv-build.sh +++ b/pkgs/stdenv/stdenv-build.sh @@ -6,19 +6,23 @@ mkdir $out || exit 1 mkdir $out/bin || exit 1 echo "export PATH=$out/bin:/bin:/usr/bin" >> $out/setup || exit 1 +echo "export NIX_CFLAGS=\"-isystem $glibc/include \$NIX_CFLAGS\"" >> $out/setup || exit 1 +echo "export NIX_LDFLAGS=\"-L $glibc/lib -Wl,-dynamic-linker,$glibc/lib/ld-linux.so.2,-rpath,$glibc/lib \$NIX_LDFLAGS\"" >> $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 +ln -s gcc $out/bin/cc + gplusplus=/usr/bin/g++ sed \ -e s^@GCC\@^$gplusplus^g \ - -e s^@LIBC\@^$glibc^g \ < $gccwrapper > $out/bin/g++ || exit 1 chmod +x $out/bin/g++ || exit 1 + +ln -s g++ $out/bin/c++ diff --git a/pkgs/strategoxt/strategoxt-build.sh b/pkgs/strategoxt/strategoxt-build.sh index 21fd1c2a29cf..585d2d011f86 100755 --- a/pkgs/strategoxt/strategoxt-build.sh +++ b/pkgs/strategoxt/strategoxt-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd strategoxt-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out --with-aterm=$aterm --with-sdf=$sdf2 || exit 1 +./configure --prefix=$out --with-aterm=$aterm --with-sdf=$sdf2 || exit 1 make || exit 1 make install || exit 1 diff --git a/pkgs/subversion/subversion-build.sh b/pkgs/subversion/subversion-build.sh index 8da5e692b169..fa2de05e5a21 100755 --- a/pkgs/subversion/subversion-build.sh +++ b/pkgs/subversion/subversion-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 envpkgs="$ssl $db4 $httpd $swig $libxml" -. $setenv +. $setenv || exit 1 if test $localServer; then extraflags="--with-berkeley-db=$db4 $extraflags" @@ -26,7 +28,7 @@ echo "extra flags: $extraflags" tar xvfz $src || exit 1 cd subversion-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out $extraflags \ +./configure --prefix=$out $extraflags \ --without-gdbm --disable-static || exit 1 make $extramakeflags || exit 1 make install $extramakeflags || exit 1 diff --git a/pkgs/swig/swig-build.sh b/pkgs/swig/swig-build.sh index 151d8760c194..8f954c8eae85 100755 --- a/pkgs/swig/swig-build.sh +++ b/pkgs/swig/swig-build.sh @@ -1,9 +1,11 @@ #! /bin/sh +export NIX_LDFLAGS=-Wl,-s + . $stdenv/setup || exit 1 tar xvfz $src || exit 1 cd SWIG-* || exit 1 -LDFLAGS=-Wl,-S ./configure --prefix=$out || exit 1 +./configure --prefix=$out || exit 1 gmake || exit 1 gmake install || exit 1 diff --git a/pkgs/system/populate-linkdirs.pl b/pkgs/system/populate-linkdirs.pl index c551e9836cb1..23dedfa92481 100755 --- a/pkgs/system/populate-linkdirs.pl +++ b/pkgs/system/populate-linkdirs.pl @@ -50,14 +50,14 @@ sub addPkg { createLinks("$pkgdir", "$selfdir"); - if (-f "$pkgdir/envpkgs") { - my $envpkgs = `cat $pkgdir/envpkgs`; - chomp $envpkgs; - my @envpkgs = split / +/, $envpkgs; - foreach my $envpkg (@envpkgs) { - addPkg($envpkg); - } - } +# if (-f "$pkgdir/envpkgs") { +# my $envpkgs = `cat $pkgdir/envpkgs`; +# chomp $envpkgs; +# my @envpkgs = split / +/, $envpkgs; +# foreach my $envpkg (@envpkgs) { +# addPkg($envpkg); +# } +# } }