GCC 4.7.2 + updated libraries compiles on Illumos/SmartOS!

- Add solaris native ld support to GCC build wrapper
- Add solaris ld wrapper that fixes -L argument order
This commit is contained in:
Danny Wilson
2013-02-23 13:59:59 +00:00
committed by Danny Wilson
parent bcaea92a12
commit 15e865ac09
10 changed files with 141 additions and 24 deletions

View File

@@ -155,7 +155,7 @@ if test -n "$targetConfig"; then
dontStrip=1
fi
providedPreConfigure="$preConfigure";
preConfigure() {
if test -n "$newlibSrc"; then
tar xvf "$newlibSrc" -C ..
@@ -188,6 +188,9 @@ preConfigure() {
configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
fi
# Eval the preConfigure script from nix expression.
eval $providedPreConfigure;
env;
# Perform the build in a different directory.
mkdir ../build
cd ../build

View File

@@ -277,19 +277,34 @@ stdenv.mkDerivation ({
++ (optional stdenv.isDarwin gnused)
;
configureFlagsArray = stdenv.lib.optionals
(ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
[ "--with-host-libstdcxx=-lstdc++ -lgcc_s" ];
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl";
preConfigure = ''
configureFlagsArray=(
${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
"'--with-host-libstdcxx=-lstdc++ -lgcc_s'"}
${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS)
"\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\"
\"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""}
);
${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit)
''
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
''}
'';
# 'iant' at #go-nuts@freenode, gccgo maintainer, said that
# they have a bug in 4.7.1 if adding "--disable-static"
dontDisableStatic = langGo;
dontDisableStatic = langGo || staticCompiler;
configureFlags = "
${if stdenv.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred
" --with-gnu-as --with-gnu-ld "
" --with-gnu-as --without-gnu-ld "
else ""}
--enable-lto
${if enableMultilib then "" else "--disable-multilib"}