gdk-pixbuf: re-disable introspection if no emulator

e.g. when cross compiling from Linux to FreeBSD.

Fixes: 1bd8727a4c ("various: enable gobject-introspection when cross-compiling")
This commit is contained in:
Alyssa Ross 2023-02-06 15:45:12 +00:00
parent 8ea1ca271b
commit 430a9ba130
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -14,19 +14,21 @@
, libjpeg , libjpeg
, libpng , libpng
, gnome , gnome
, gobject-introspection
, buildPackages
, doCheck ? false , doCheck ? false
, makeWrapper , makeWrapper
, lib , lib
, testers , testers
, buildPackages
, withIntrospection ? stdenv.hostPlatform.emulatorAvailable buildPackages
, gobject-introspection
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "gdk-pixbuf"; pname = "gdk-pixbuf";
version = "2.42.10"; version = "2.42.10";
outputs = [ "out" "dev" "man" "devdoc" ] outputs = [ "out" "dev" "man" ]
++ lib.optional withIntrospection "devdoc"
++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests"; ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
src = let src = let
@ -56,13 +58,14 @@ stdenv.mkDerivation (finalAttrs: {
python3 python3
makeWrapper makeWrapper
glib glib
gi-docgen
gobject-introspection
# for man pages # for man pages
docutils docutils
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames fixDarwinDylibNames
] ++ lib.optionals withIntrospection [
gi-docgen
gobject-introspection
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -74,7 +77,8 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = [ mesonFlags = [
"-Dgio_sniffing=false" "-Dgio_sniffing=false"
"-Dgtk_doc=true" (lib.mesonBool "gtk_doc" withIntrospection)
(lib.mesonEnable "introspection" withIntrospection)
]; ];
postPatch = '' postPatch = ''
@ -104,7 +108,7 @@ stdenv.mkDerivation (finalAttrs: {
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
mv $f ''${f%.dylib}.so mv $f ''${f%.dylib}.so
done done
'' + '' '' + lib.optionalString withIntrospection ''
# We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/ # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache ${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache
''; '';
@ -116,7 +120,7 @@ stdenv.mkDerivation (finalAttrs: {
done done
''; '';
postFixup = '' postFixup = lib.optionalString withIntrospection ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc" moveToOutput "share/doc" "$devdoc"
''; '';