Merge #24637: gcc: include dylibs for darwin build

This commit is contained in:
Vladimír Čunát 2017-04-14 10:45:02 +02:00
commit 1a1f2262b4
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
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 # This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths. # insert into default search paths.
prePatch = if stdenv.isDarwin then '' prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace gcc/config/darwin-c.c \ substituteInPlace gcc/config/darwin-c.c \
--replace 'if (stdinc)' 'if (0)' --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 = postPatch =
if (stdenv.isGNU if (stdenv.isGNU

View File

@ -212,6 +212,7 @@ postInstall() {
# Move runtime libraries to $lib. # Move runtime libraries to $lib.
moveToOutput "lib/lib*.so*" "$lib" moveToOutput "lib/lib*.so*" "$lib"
moveToOutput "lib/lib*.la" "$lib" moveToOutput "lib/lib*.la" "$lib"
moveToOutput "lib/lib*.dylib" "$lib"
moveToOutput "share/gcc-*/python" "$lib" moveToOutput "share/gcc-*/python" "$lib"
for i in "$lib"/lib/*.{la,py}; do for i in "$lib"/lib/*.{la,py}; do
@ -221,6 +222,7 @@ postInstall() {
if [ -n "$enableMultilib" ]; then if [ -n "$enableMultilib" ]; then
moveToOutput "lib64/lib*.so*" "$lib" moveToOutput "lib64/lib*.so*" "$lib"
moveToOutput "lib64/lib*.la" "$lib" moveToOutput "lib64/lib*.la" "$lib"
moveToOutput "lib64/lib*.dylib" "$lib"
for i in "$lib"/lib64/*.{la,py}; do for i in "$lib"/lib64/*.{la,py}; do
substituteInPlace "$i" --replace "$out" "$lib" substituteInPlace "$i" --replace "$out" "$lib"
@ -251,6 +253,16 @@ postInstall() {
done done
fi 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 # Get rid of some "fixed" header files
rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux} rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux}