mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 08:39:08 +03:00
* Provide an ld-wrapper that sets the linker search path correctly (just like
gcc-wrapper). Useful for builds that call ld directly. svn path=/nixpkgs/trunk/; revision=363
This commit is contained in:
parent
1edcca4322
commit
6b66d16116
@ -9,20 +9,17 @@ sed \
|
||||
-e s^@OUT\@^$out^g \
|
||||
< $setup > $out/setup || exit 1
|
||||
|
||||
gcc='$NIX_CC'
|
||||
|
||||
sed \
|
||||
-e s^@GCC\@^$gcc^g \
|
||||
-e 's^@GCC\@^$NIX_CC^g' \
|
||||
< $gccwrapper > $out/bin/gcc || exit 1
|
||||
chmod +x $out/bin/gcc || exit 1
|
||||
|
||||
ln -s gcc $out/bin/cc
|
||||
|
||||
gcc='$NIX_CXX'
|
||||
ln -s gcc $out/bin/cc || exit 1
|
||||
|
||||
sed \
|
||||
-e s^@GCC\@^$gcc^g \
|
||||
-e 's^@GCC\@^$NIX_CXX^g' \
|
||||
< $gccwrapper > $out/bin/g++ || exit 1
|
||||
chmod +x $out/bin/g++ || exit 1
|
||||
ln -s g++ $out/bin/c++ || exit 1
|
||||
|
||||
ln -s g++ $out/bin/c++
|
||||
cp $ldwrapper $out/bin/ld || exit 1
|
||||
chmod +x $out/bin/ld || exit 1
|
||||
|
@ -1,8 +1,9 @@
|
||||
Package(
|
||||
[ ("name", "stdenv-native")
|
||||
[ ("name", "baseenv")
|
||||
, ("build", Relative("baseenv/baseenv-build.sh"))
|
||||
|
||||
, ("setup", Relative("baseenv/setup.sh"))
|
||||
, ("gccwrapper", Relative("baseenv/gcc-wrapper.sh"))
|
||||
, ("ldwrapper", Relative("baseenv/ld-wrapper.sh"))
|
||||
]
|
||||
)
|
||||
|
@ -6,26 +6,33 @@ justcompile=0
|
||||
for i in $@; do
|
||||
if test "$i" == "-c"; then
|
||||
justcompile=1
|
||||
fi
|
||||
if test "$i" == "-S"; then
|
||||
elif test "$i" == "-S"; then
|
||||
justcompile=1
|
||||
fi
|
||||
if test "$i" == "-E"; then
|
||||
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
|
||||
|
||||
IFS=" "
|
||||
extra=($NIX_CFLAGS)
|
||||
extra=($NIX_CFLAGS_COMPILE)
|
||||
if test "$justcompile" != "1"; then
|
||||
extra=(${extra[@]} $NIX_LDFLAGS)
|
||||
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[@]} -Wl,-s)
|
||||
extra=(${extra[@]} -g0 -Wl,-s)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$NIX_DEBUG" == "1"; then
|
||||
echo "extra gcc flags:" >&2
|
||||
echo "extra flags to @GCC@:" >&2
|
||||
for i in ${extra[@]}; do
|
||||
echo " $i" >&2
|
||||
done
|
||||
|
@ -11,7 +11,8 @@ addtoenv()
|
||||
fi
|
||||
|
||||
if test -d $1/lib; then
|
||||
export NIX_LDFLAGS="-L $1/lib -Wl,-rpath,$1/lib $NIX_LDFLAGS"
|
||||
export NIX_CFLAGS_LINK="-L$1/lib $NIX_CFLAGS_LINK"
|
||||
export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS"
|
||||
fi
|
||||
|
||||
if test -d $1/lib/pkgconfig; then
|
||||
@ -33,7 +34,7 @@ for i in $oldenvpkgs; do
|
||||
done
|
||||
|
||||
# Add the output as an rpath.
|
||||
export NIX_LDFLAGS="-Wl,-rpath,$out/lib $NIX_LDFLAGS"
|
||||
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
|
||||
|
||||
# Strip debug information by default.
|
||||
export NIX_STRIP_DEBUG=1
|
||||
|
@ -20,7 +20,10 @@ cd build || exit 1
|
||||
../gcc-*/configure --prefix=$out --enable-languages=c,c++ || exit 1
|
||||
|
||||
# Patch some of the makefiles to force linking against our own glibc.
|
||||
extraflags="$NIX_CFLAGS $NIX_LDFLAGS -Wl,-s -isystem $linux/include"
|
||||
extraflags="-Wl,-s -isystem $linux/include $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
|
||||
for i in $NIX_LDFLAGS; do
|
||||
extraflags="$extraflags -Wl,$i"
|
||||
done
|
||||
|
||||
mf=Makefile
|
||||
sed \
|
||||
|
@ -3,7 +3,9 @@ export SHELL=/bin/sh
|
||||
|
||||
. @BASEENV@/setup
|
||||
|
||||
export NIX_CFLAGS="-isystem @GLIBC@/include $NIX_CFLAGS"
|
||||
export NIX_LDFLAGS="-L@GLIBC@/lib -Wl,-dynamic-linker,@GLIBC@/lib/ld-linux.so.2,-rpath,@GLIBC@/lib $NIX_LDFLAGS"
|
||||
export NIX_CFLAGS_COMPILE="-isystem @GLIBC@/include $NIX_CFLAGS_COMPILE"
|
||||
export NIX_CFLAGS_LINK="-L@GLIBC@/lib $NIX_CFLAGS_LINK"
|
||||
export NIX_LDFLAGS="-dynamic-linker @GLIBC@/lib/ld-linux.so.2 -rpath @GLIBC@/lib $NIX_LDFLAGS"
|
||||
export NIX_CC=/usr/bin/gcc
|
||||
export NIX_CXX=/usr/bin/g++
|
||||
export NIX_LD=/usr/bin/ld
|
||||
|
@ -3,10 +3,12 @@ export SHELL=@SHELL@
|
||||
|
||||
. @BASEENV@/setup
|
||||
|
||||
export NIX_CFLAGS="-isystem @GLIBC@/include -isystem @LINUX@/include $NIX_CFLAGS"
|
||||
export NIX_LDFLAGS="-L@GLIBC@/lib -Wl,-dynamic-linker,@GLIBC@/lib/ld-linux.so.2,-rpath,@GLIBC@/lib $NIX_LDFLAGS -L@GCC@/lib -Wl,-rpath,@GCC@/lib"
|
||||
export NIX_CFLAGS_COMPILE="-isystem @GLIBC@/include -isystem @LINUX@/include $NIX_CFLAGS_COMPILE"
|
||||
export NIX_CFLAGS_LINK="-L@GLIBC@/lib -L@GCC@/lib $NIX_CFLAGS_LINK"
|
||||
export NIX_LDFLAGS="-dynamic-linker @GLIBC@/lib/ld-linux.so.2 -rpath @GLIBC@/lib -rpath @GCC@/lib $NIX_LDFLAGS"
|
||||
export NIX_CC=@CC@
|
||||
export NIX_CXX=@CXX@
|
||||
export NIX_LD=@LD@
|
||||
|
||||
export NIX_LIBC_INCLUDES="@GLIBC@/include"
|
||||
export NIX_LIBC_LIBS="@GLIBC@/lib"
|
||||
|
@ -6,7 +6,7 @@ mkdir $out || exit 1
|
||||
|
||||
p=
|
||||
first=1
|
||||
for i in $tools; do
|
||||
for i in $tools $gcc $binutils $shell; do
|
||||
if test "$first" == 1; then
|
||||
first=
|
||||
else
|
||||
@ -17,6 +17,7 @@ done
|
||||
|
||||
cc=$gcc/bin/gcc
|
||||
cxx=$gcc/bin/g++
|
||||
ld=$binutils/bin/ld
|
||||
shell=$shell/bin/sh
|
||||
|
||||
echo "########## $p"
|
||||
@ -27,6 +28,7 @@ sed \
|
||||
-e s^@GCC\@^$gcc^g \
|
||||
-e s^@CC\@^$cc^g \
|
||||
-e s^@CXX\@^$cxx^g \
|
||||
-e s^@LD\@^$ld^g \
|
||||
-e s^@BASEENV\@^$baseenv^g \
|
||||
-e s^@PATH\@^$p^g \
|
||||
-e s^@SHELL\@^$shell^g \
|
||||
|
@ -6,9 +6,5 @@ mkdir $out || exit 1
|
||||
|
||||
sed \
|
||||
-e s^@GLIBC\@^$glibc^g \
|
||||
-e s^@CC\@^$cc^g \
|
||||
-e s^@CXX\@^$cxx^g \
|
||||
-e s^@BASEENV\@^$baseenv^g \
|
||||
-e s^@PATH\@^$p^g \
|
||||
-e s^@SHELL\@^$shell^g \
|
||||
< $setup > $out/setup || exit 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
Package(
|
||||
[ ("name", "stdenv-linux")
|
||||
[ ("name", "stdenv-nativetools")
|
||||
, ("build", Relative("stdenv-linux/stdenv-nativetools-build.sh"))
|
||||
|
||||
, ("setup", Relative("stdenv-linux/setup-nativetools.sh"))
|
||||
|
@ -18,11 +18,11 @@ Package(
|
||||
, IncludeFix("gzip/gzip.fix")
|
||||
, IncludeFix("bzip2/bzip2.fix")
|
||||
, IncludeFix("gnumake/gnumake.fix")
|
||||
, IncludeFix("binutils/binutils.fix")
|
||||
, IncludeFix("bash/bash.fix")
|
||||
])
|
||||
|
||||
, ("gcc", IncludeFix("gcc/gcc.fix"))
|
||||
, ("binutils", IncludeFix("binutils/binutils.fix"))
|
||||
, ("shell", IncludeFix("bash/bash.fix"))
|
||||
]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user