* gcc-apple: produce a libstdc++.dylib that doesn't depend on

/usr/lib/libstdc++.dylib.

svn path=/nixpkgs/branches/stdenv-updates/; revision=32365
This commit is contained in:
Eelco Dolstra 2012-02-17 19:33:12 +00:00
parent 0e6c77befa
commit da3ecd1256
3 changed files with 47 additions and 23 deletions

View file

@ -84,22 +84,32 @@ postInstall() {
rm -rf $out/libexec/gcc/*/*/install-tools
}
postUnpack() {
mv $libstdcxx/libstdcxx $sourceRoot/
mv $libstdcxx/libstdcxx $sourceRoot/
}
STDCXX_INCDIR="$out/include/c++/4.2.1"
genericBuild
echo '-------------------------------------------------------------------------------------------------------------------------'
echo 'libstdcxx-16'
echo 'libstdcxx'
echo '-------------------------------------------------------------------------------------------------------------------------'
cd ..
pwd
unpackPhase () {
true
}
patchPhase() {
true
}
preConfigure() {
# Perform the build in a different directory.
mkdir ../build_libstdcxx
@ -111,18 +121,9 @@ preConfigure() {
configureFlags="--disable-libstdcxx-pch --disable-libstdcxx-debug --disable-multilib --with-gxx-include-dir=${STDCXX_INCDIR}"
}
unpackPhase () {
echo '-'
}
postInstall() {
echo '-'
echo "cp -v ${STDCXX_INCDIR}/*/bits/* ${STDCXX_INCDIR}/bits/"
cp -v ${STDCXX_INCDIR}/*/bits/* ${STDCXX_INCDIR}/bits/
}
patchPhase() {
echo '-'
echo "cp -v ${STDCXX_INCDIR}/*/bits/* ${STDCXX_INCDIR}/bits/"
cp -v ${STDCXX_INCDIR}/*/bits/* ${STDCXX_INCDIR}/bits/
}
genericBuild

View file

@ -1,10 +1,9 @@
{ stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langObjC ? true, langF77 ? false
, langCC ? true, langObjC ? true, langF77 ? false
, profiledCompiler ? false
, gmp ? null, mpfr ? null, bison ? null, flex ? null
}:
assert langC;
assert stdenv.isDarwin;
assert langF77 -> gmp != null;
@ -12,27 +11,34 @@ let
version = "4.2.1"; # Upstream GCC version, from `gcc/BASE-VER'.
revision = "5666.3"; # Apple's fork revision number.
in
stdenv.mkDerivation ({
stdenv.mkDerivation {
name = "gcc-apple-${version}.${revision}";
builder = ./builder.sh;
src =
stdenv.lib.optional /*langC*/ true (fetchurl {
stdenv.lib.optional true (fetchurl {
url = "http://www.opensource.apple.com/tarballs/gcc/gcc-${revision}.tar.gz";
sha256 = "0nq1szgqx9ryh1qsn5n6yd55gpvf56wr8f7w1jzabb8idlvz8ikc";
}) ++
stdenv.lib.optional langCC (fetchurl {
url = http://www.opensource.apple.com/tarballs/libstdcxx/libstdcxx-39.tar.gz ;
url = http://www.opensource.apple.com/tarballs/libstdcxx/libstdcxx-39.tar.gz;
sha256 = "ccf4cf432c142778c766affbbf66b61001b6c4f1107bc2b2c77ce45598786b6d";
}) ;
});
enableParallelBuilding = true;
libstdcxx = "libstdcxx-39";
sourceRoot = "gcc-${revision}/";
patches =
[./pass-cxxcpp.patch ]
++ (if noSysDirs then [./no-sys-dirs.patch] else []);
inherit noSysDirs langC langCC langF77 langObjC profiledCompiler;
} // (if langF77 then {buildInputs = [gmp mpfr bison flex];} else {}))
[ ./pass-cxxcpp.patch ./fix-libstdc++-link.patch ]
++ stdenv.lib.optional noSysDirs [ ./no-sys-dirs.patch ];
inherit noSysDirs langCC langF77 langObjC;
langC = true;
buildInputs = stdenv.lib.optionals langF77 [ gmp mpfr bison flex ];
}

View file

@ -0,0 +1,17 @@
Prevent our libstdc++.dylib from having a runtime dependency on
/usr/lib/libstdc++.dylib. This is caused by the implicit -lstdc++
passed by g++ when it links libstdc++.dylib. Adding "-nostdlib" to
the g++ invocation prevents this.
diff -ru -x '*~' libstdcxx-39-orig/libstdcxx/libstdc++-v3/src/Makefile.in libstdcxx-39/libstdcxx/libstdc++-v3/src/Makefile.in
--- x/libstdcxx/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200
+++ y/libstdcxx/libstdc++-v3/src/Makefile.in 2012-02-17 18:44:05.210570590 +0100
@@ -388,7 +388,7 @@
libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
- -version-info $(libtool_VERSION) ${version_arg} -lm
+ -version-info $(libtool_VERSION) ${version_arg} -lm -Wc,-nostdlib
# Use special rules for the deprecated source files so that they find