nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix

157 lines
3.9 KiB
Nix
Raw Normal View History

{ stdenv
, fetchurl
, nixosTests
, fixDarwinDylibNames
, meson
, ninja
, pkg-config
, gettext
, python3
, libxslt
, docbook-xsl-nons
, docbook_xml_dtd_43
2021-03-23 07:53:26 +00:00
, gi-docgen
, glib
, libtiff
, libjpeg
, libpng
, gnome
, gobject-introspection
, buildPackages
, doCheck ? false
, makeWrapper
, lib
}:
stdenv.mkDerivation rec {
2018-03-03 05:20:46 +00:00
pname = "gdk-pixbuf";
version = "2.42.8";
outputs = [ "out" "dev" "man" "devdoc" ]
++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
2018-09-05 00:44:17 +00:00
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "hKzqOsskEbKRNLMgFaWxqqYoRLGcSx74uJccawdZ9MY=";
};
patches = [
2018-09-05 00:44:17 +00:00
# Move installed tests to a separate output
./installed-tests-path.patch
];
# gdk-pixbuf-thumbnailer is not wrapped therefore strictDeps will work
strictDeps = true;
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
python3
makeWrapper
glib
2021-03-23 07:53:26 +00:00
gi-docgen
gobject-introspection
2021-03-23 07:53:26 +00:00
# for man pages
libxslt
docbook-xsl-nons
docbook_xml_dtd_43
] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames
];
buildInputs = [ gobject-introspection ];
propagatedBuildInputs = [
glib
libtiff
libjpeg
libpng
];
mesonFlags = [
"-Dgio_sniffing=false"
"-Dgtk_doc=true"
];
postPatch = ''
chmod +x build-aux/* # patchShebangs only applies to executables
patchShebangs build-aux
substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
# 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"
2021-03-23 07:53:26 +00:00
'';
postInstall =
2021-03-23 07:53:26 +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.
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
'' + ''
# 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
'';
# The fixDarwinDylibNames hook doesn't patch binaries.
preFixup = lib.optionalString stdenv.isDarwin ''
2018-05-29 06:46:39 +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
2018-05-29 06:46:39 +00:00
done
'';
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc"
'';
# The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
inherit doCheck;
setupHook = ./setup-hook.sh;
2020-12-28 01:19:17 +00:00
separateDebugInfo = stdenv.isLinux;
2018-03-03 05:20:46 +00:00
passthru = {
updateScript = gnome.updateScript {
2018-03-03 05:20:46 +00:00
packageName = pname;
versionPolicy = "odd-unstable";
2018-03-03 05:20:46 +00:00
};
2018-03-27 14:23:21 +00:00
2019-11-07 13:38:41 +00:00
tests = {
installedTests = nixosTests.installed-tests.gdk-pixbuf;
};
2018-03-27 14:23:21 +00:00
# gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc
moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
2018-03-03 05:20:46 +00:00
};
meta = with lib; {
description = "A library for image loading and manipulation";
homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
license = licenses.lgpl21Plus;
maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
mainProgram = "gdk-pixbuf-thumbnailer";
platforms = platforms.unix;
};
}