Merge pull request #41559 from orivej/gdk-pixbuf

gdk-pixbuf: fix loader.cache on darwin
This commit is contained in:
Orivej Desh 2018-06-06 10:46:46 +00:00 committed by GitHub
commit 57d35bb35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
"-Djasper=true" "-Djasper=true"
"-Dx11=true" "-Dx11=true"
"-Dgir=${if gobjectIntrospection != null then "true" else "false"}" "-Dgir=${if gobjectIntrospection != null then "true" else "false"}"
] ++ stdenv.lib.optional stdenv.isDarwin "-Dbuiltin_loaders=all"; ];
postPatch = '' postPatch = ''
chmod +x build-aux/* # patchShebangs only applies to executables chmod +x build-aux/* # patchShebangs only applies to executables
@ -73,8 +73,16 @@ stdenv.mkDerivation rec {
''; '';
postInstall = postInstall =
# All except one utility seem to be only useful during building. # meson erroneously installs loaders with .dylib extension on Darwin.
# Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
stdenv.lib.optionalString stdenv.isDarwin ''
for f in $out/${passthru.moduleDir}/*.dylib; do
install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
mv $f ''${f%.dylib}.so
done
'' ''
# All except one utility seem to be only useful during building.
+ ''
moveToOutput "bin" "$dev" moveToOutput "bin" "$dev"
moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out" moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
@ -82,12 +90,8 @@ stdenv.mkDerivation rec {
$dev/bin/gdk-pixbuf-query-loaders --update-cache $dev/bin/gdk-pixbuf-query-loaders --update-cache
''; '';
# The fixDarwinDylibNames hook doesn't patch library references or binaries. # The fixDarwinDylibNames hook doesn't patch binaries.
preFixup = stdenv.lib.optionalString stdenv.isDarwin '' preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
for f in $(find $out/lib -name '*.dylib'); do
install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
done
for f in $out/bin/* $dev/bin/*; do for f in $out/bin/* $dev/bin/*; do
install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
done done