24 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
25 && stdenv.hostPlatform.emulatorAvailable buildPackages,
26 gobject-introspection,
29 stdenv.mkDerivation (finalAttrs: {
39 ++ lib.optional withIntrospection "devdoc"
40 ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
44 inherit (finalAttrs) pname version;
47 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
48 hash = "sha256-uVBbNEW5p+SM7TR2DDvLc+lm3zrJTJWhSMtmmrdI48c=";
52 # Move installed tests to a separate output
53 ./installed-tests-path.patch
56 # gdk-pixbuf-thumbnailer is not wrapped therefore strictDeps will work
76 ++ lib.optionals stdenv.hostPlatform.isDarwin [
79 ++ lib.optionals withIntrospection [
84 propagatedBuildInputs = [
92 "-Dgio_sniffing=false"
93 (lib.mesonBool "gtk_doc" withIntrospection)
94 (lib.mesonEnable "introspection" withIntrospection)
95 (lib.mesonEnable "others" true)
99 chmod +x build-aux/* # patchShebangs only applies to executables
100 patchShebangs build-aux
102 substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
104 # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
105 # it should be a build-time dep for build
106 # TODO: send upstream
107 substituteInPlace docs/meson.build \
108 --replace "dependency('gi-docgen'," "dependency('gi-docgen', native:true," \
109 --replace "'gi-docgen', req" "'gi-docgen', native:true, req"
111 # Remove 'ani' loader until proper fix for CVE-2022-48622
112 substituteInPlace meson.build --replace-fail "'ani'," ""
117 # All except one utility seem to be only useful during building.
118 moveToOutput "bin" "$dev"
119 moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
122 + lib.optionalString stdenv.hostPlatform.isDarwin ''
123 # meson erroneously installs loaders with .dylib extension on Darwin.
124 # Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
125 for f in $out/${finalAttrs.passthru.moduleDir}/*.dylib; do
126 install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
127 mv $f ''${f%.dylib}.so
130 + lib.optionalString withIntrospection ''
131 # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
132 ${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache
135 # The fixDarwinDylibNames hook doesn't patch binaries.
136 preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
137 for f in $out/bin/* $dev/bin/*; do
138 install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
142 postFixup = lib.optionalString withIntrospection ''
143 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
144 moveToOutput "share/doc" "$devdoc"
147 # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
150 setupHook = ./setup-hook.sh;
152 separateDebugInfo = stdenv.hostPlatform.isLinux;
155 updateScript = gnome.updateScript {
156 packageName = finalAttrs.pname;
157 versionPolicy = "odd-unstable";
161 installedTests = nixosTests.installed-tests.gdk-pixbuf;
162 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
165 # gdk_pixbuf_binarydir and gdk_pixbuf_moduledir variables from gdk-pixbuf-2.0.pc
166 binaryDir = "lib/gdk-pixbuf-2.0/2.10.0";
167 moduleDir = "${finalAttrs.passthru.binaryDir}/loaders";
171 description = "Library for image loading and manipulation";
172 homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
173 license = licenses.lgpl21Plus;
174 maintainers = teams.gnome.members;
175 mainProgram = "gdk-pixbuf-thumbnailer";
176 pkgConfigModules = [ "gdk-pixbuf-2.0" ];
177 platforms = platforms.unix;