gcc: include dylibs for darwin build

This commit is contained in:
Daiderd Jordan 2017-03-27 20:27:19 +02:00
parent 969849acf8
commit 9896cf1028
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
2 changed files with 20 additions and 2 deletions

View File

@ -237,10 +237,16 @@ stdenv.mkDerivation ({
# This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths.
prePatch = if stdenv.isDarwin then ''
prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace gcc/config/darwin-c.c \
--replace 'if (stdinc)' 'if (0)'
'' else null;
substituteInPlace libgcc/config/t-slibgcc-darwin \
--replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
substituteInPlace libgfortran/configure \
--replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
'';
postPatch =
if (stdenv.isGNU

View File

@ -212,6 +212,7 @@ postInstall() {
# Move runtime libraries to $lib.
moveToOutput "lib/lib*.so*" "$lib"
moveToOutput "lib/lib*.la" "$lib"
moveToOutput "lib/lib*.dylib" "$lib"
moveToOutput "share/gcc-*/python" "$lib"
for i in "$lib"/lib/*.{la,py}; do
@ -221,6 +222,7 @@ postInstall() {
if [ -n "$enableMultilib" ]; then
moveToOutput "lib64/lib*.so*" "$lib"
moveToOutput "lib64/lib*.la" "$lib"
moveToOutput "lib64/lib*.dylib" "$lib"
for i in "$lib"/lib64/*.{la,py}; do
substituteInPlace "$i" --replace "$out" "$lib"
@ -251,6 +253,16 @@ postInstall() {
done
fi
if type "install_name_tool"; then
for i in "$lib"/lib/*.*.dylib; do
install_name_tool -id "$i" "$i" || true
for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do
new_path=`echo "$old_path" | sed "s,$out,$lib,"`
install_name_tool -change "$old_path" "$new_path" "$i" || true
done
done
fi
# Get rid of some "fixed" header files
rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux}