2020-06-18 07:06:33 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
, fixDarwinDylibNames
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, gettext
|
|
|
|
, python3
|
2022-10-21 18:38:19 +00:00
|
|
|
, docutils
|
2021-05-20 23:08:51 +00:00
|
|
|
, gi-docgen
|
2020-06-18 07:06:33 +00:00
|
|
|
, glib
|
|
|
|
, libtiff
|
|
|
|
, libjpeg
|
|
|
|
, libpng
|
2021-05-20 23:08:51 +00:00
|
|
|
, gnome
|
2020-06-18 07:06:33 +00:00
|
|
|
, doCheck ? false
|
|
|
|
, makeWrapper
|
2020-10-27 00:29:36 +00:00
|
|
|
, lib
|
2023-02-16 17:41:37 +00:00
|
|
|
, testers
|
2023-03-15 16:39:30 +00:00
|
|
|
, buildPackages
|
2023-10-19 13:55:26 +00:00
|
|
|
, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
|
2023-03-15 16:39:30 +00:00
|
|
|
, gobject-introspection
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "gdk-pixbuf";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "2.42.12";
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
outputs = [ "out" "dev" "man" ]
|
|
|
|
++ lib.optional withIntrospection "devdoc"
|
2021-06-28 23:13:55 +00:00
|
|
|
++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
src = let
|
|
|
|
inherit (finalAttrs) pname version;
|
|
|
|
in fetchurl {
|
2021-02-05 17:12:51 +00:00
|
|
|
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-uVBbNEW5p+SM7TR2DDvLc+lm3zrJTJWhSMtmmrdI48c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Move installed tests to a separate output
|
|
|
|
./installed-tests-path.patch
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# gdk-pixbuf-thumbnailer is not wrapped therefore strictDeps will work
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2020-06-18 07:06:33 +00:00
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
gettext
|
|
|
|
python3
|
|
|
|
makeWrapper
|
|
|
|
glib
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
# for man pages
|
2022-10-21 18:38:19 +00:00
|
|
|
docutils
|
2021-12-06 16:07:01 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
fixDarwinDylibNames
|
2023-03-15 16:39:30 +00:00
|
|
|
] ++ lib.optionals withIntrospection [
|
|
|
|
gi-docgen
|
|
|
|
gobject-introspection
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
glib
|
|
|
|
libtiff
|
|
|
|
libjpeg
|
|
|
|
libpng
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dgio_sniffing=false"
|
2023-03-15 16:39:30 +00:00
|
|
|
(lib.mesonBool "gtk_doc" withIntrospection)
|
|
|
|
(lib.mesonEnable "introspection" withIntrospection)
|
2024-06-05 15:53:02 +00:00
|
|
|
(lib.mesonEnable "others" true)
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
chmod +x build-aux/* # patchShebangs only applies to executables
|
|
|
|
patchShebangs build-aux
|
|
|
|
|
|
|
|
substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
# Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
|
|
|
|
# it should be a build-time dep for build
|
|
|
|
# TODO: send upstream
|
|
|
|
substituteInPlace docs/meson.build \
|
|
|
|
--replace "dependency('gi-docgen'," "dependency('gi-docgen', native:true," \
|
|
|
|
--replace "'gi-docgen', req" "'gi-docgen', native:true, req"
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
# Remove 'ani' loader until proper fix for CVE-2022-48622
|
|
|
|
substituteInPlace meson.build --replace-fail "'ani'," ""
|
2021-05-20 23:08:51 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall =
|
2021-05-20 23:08:51 +00:00
|
|
|
''
|
|
|
|
# All except one utility seem to be only useful during building.
|
|
|
|
moveToOutput "bin" "$dev"
|
|
|
|
moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
|
|
|
|
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# meson erroneously installs loaders with .dylib extension on Darwin.
|
|
|
|
# Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
|
2023-02-16 17:41:37 +00:00
|
|
|
for f in $out/${finalAttrs.passthru.moduleDir}/*.dylib; do
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2023-03-15 16:39:30 +00:00
|
|
|
'' + lib.optionalString withIntrospection ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
|
2022-08-12 12:06:08 +00:00
|
|
|
${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# The fixDarwinDylibNames hook doesn't patch binaries.
|
2021-02-05 17:12:51 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
postFixup = lib.optionalString withIntrospection ''
|
2022-03-30 09:31:56 +00:00
|
|
|
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
|
|
|
|
moveToOutput "share/doc" "$devdoc"
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
|
|
|
|
inherit doCheck;
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
separateDebugInfo = stdenv.isLinux;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = {
|
2021-05-20 23:08:51 +00:00
|
|
|
updateScript = gnome.updateScript {
|
2023-02-16 17:41:37 +00:00
|
|
|
packageName = finalAttrs.pname;
|
2021-05-20 23:08:51 +00:00
|
|
|
versionPolicy = "odd-unstable";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
tests = {
|
|
|
|
installedTests = nixosTests.installed-tests.gdk-pixbuf;
|
2023-02-16 17:41:37 +00:00
|
|
|
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
# gdk_pixbuf_binarydir and gdk_pixbuf_moduledir variables from gdk-pixbuf-2.0.pc
|
|
|
|
binaryDir = "lib/gdk-pixbuf-2.0/2.10.0";
|
|
|
|
moduleDir = "${finalAttrs.passthru.binaryDir}/loaders";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Library for image loading and manipulation";
|
2020-06-18 07:06:33 +00:00
|
|
|
homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
|
2020-12-03 08:41:04 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2022-05-18 14:49:53 +00:00
|
|
|
maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
|
|
|
|
mainProgram = "gdk-pixbuf-thumbnailer";
|
2023-02-16 17:41:37 +00:00
|
|
|
pkgConfigModules = [ "gdk-pixbuf-2.0" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2023-02-16 17:41:37 +00:00
|
|
|
})
|