22 , withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
23 , gobject-introspection
26 stdenv.mkDerivation (finalAttrs: {
30 outputs = [ "out" "dev" "man" ]
31 ++ lib.optional withIntrospection "devdoc"
32 ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
35 inherit (finalAttrs) pname version;
37 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
38 hash = "sha256-uVBbNEW5p+SM7TR2DDvLc+lm3zrJTJWhSMtmmrdI48c=";
42 # Move installed tests to a separate output
43 ./installed-tests-path.patch
46 # gdk-pixbuf-thumbnailer is not wrapped therefore strictDeps will work
64 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
66 ] ++ lib.optionals withIntrospection [
71 propagatedBuildInputs = [
79 "-Dgio_sniffing=false"
80 (lib.mesonBool "gtk_doc" withIntrospection)
81 (lib.mesonEnable "introspection" withIntrospection)
82 (lib.mesonEnable "others" true)
86 chmod +x build-aux/* # patchShebangs only applies to executables
87 patchShebangs build-aux
89 substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
91 # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
92 # it should be a build-time dep for build
94 substituteInPlace docs/meson.build \
95 --replace "dependency('gi-docgen'," "dependency('gi-docgen', native:true," \
96 --replace "'gi-docgen', req" "'gi-docgen', native:true, req"
98 # Remove 'ani' loader until proper fix for CVE-2022-48622
99 substituteInPlace meson.build --replace-fail "'ani'," ""
104 # All except one utility seem to be only useful during building.
105 moveToOutput "bin" "$dev"
106 moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
108 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
109 # meson erroneously installs loaders with .dylib extension on Darwin.
110 # Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
111 for f in $out/${finalAttrs.passthru.moduleDir}/*.dylib; do
112 install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
113 mv $f ''${f%.dylib}.so
115 '' + lib.optionalString withIntrospection ''
116 # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
117 ${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache
120 # The fixDarwinDylibNames hook doesn't patch binaries.
121 preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
122 for f in $out/bin/* $dev/bin/*; do
123 install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
127 postFixup = lib.optionalString withIntrospection ''
128 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
129 moveToOutput "share/doc" "$devdoc"
132 # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
135 setupHook = ./setup-hook.sh;
137 separateDebugInfo = stdenv.hostPlatform.isLinux;
140 updateScript = gnome.updateScript {
141 packageName = finalAttrs.pname;
142 versionPolicy = "odd-unstable";
146 installedTests = nixosTests.installed-tests.gdk-pixbuf;
147 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
150 # gdk_pixbuf_binarydir and gdk_pixbuf_moduledir variables from gdk-pixbuf-2.0.pc
151 binaryDir = "lib/gdk-pixbuf-2.0/2.10.0";
152 moduleDir = "${finalAttrs.passthru.binaryDir}/loaders";
156 description = "Library for image loading and manipulation";
157 homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
158 license = licenses.lgpl21Plus;
159 maintainers = teams.gnome.members;
160 mainProgram = "gdk-pixbuf-thumbnailer";
161 pkgConfigModules = [ "gdk-pixbuf-2.0" ];
162 platforms = platforms.unix;