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

135 lines
3.3 KiB
Nix
Raw Normal View History

{ stdenv
, fetchurl
, nixosTests
, fixDarwinDylibNames
, meson
, ninja
, pkg-config
, gettext
, python3
, libxml2
, libxslt
, docbook-xsl-nons
, docbook_xml_dtd_43
, gtk-doc
, glib
, libtiff
, libjpeg
, libpng
, gnome3
, gobject-introspection
, doCheck ? false
, makeWrapper
, lib
}:
stdenv.mkDerivation rec {
2018-03-03 05:20:46 +00:00
pname = "gdk-pixbuf";
version = "2.42.2";
outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
2018-09-05 01:44:17 +01:00
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "05ggmzwvrxq9w4zcvmrnnd6qplsmb4n95lj4q607c7arzlf6mil3";
};
patches = [
2018-09-05 01:44:17 +01:00
# Move installed tests to a separate output
./installed-tests-path.patch
];
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
python3
libxml2
libxslt
docbook-xsl-nons
docbook_xml_dtd_43
gtk-doc
gobject-introspection
makeWrapper
glib
] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
propagatedBuildInputs = [
glib
libtiff
libjpeg
libpng
];
mesonFlags = [
"-Dgtk_doc=true"
"-Dintrospection=${if gobject-introspection != null then "enabled" else "disabled"}"
"-Dgio_sniffing=false"
];
postPatch = ''
chmod +x build-aux/* # patchShebangs only applies to executables
patchShebangs build-aux
substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
'';
postInstall =
# meson erroneously installs loaders with .dylib extension on Darwin.
# Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
lib.optionalString stdenv.isDarwin ''
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
''
# All except one utility seem to be only useful during building.
+ ''
moveToOutput "bin" "$dev"
moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
'' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
# We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
$dev/bin/gdk-pixbuf-query-loaders --update-cache
'';
# The fixDarwinDylibNames hook doesn't patch binaries.
preFixup = lib.optionalString stdenv.isDarwin ''
2018-05-29 07:46:39 +01: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 07:46:39 +01:00
done
'';
2018-09-05 01:44:17 +01:00
preInstall = ''
PATH=$PATH:$out/bin # for install script
'';
# 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 = gnome3.updateScript {
packageName = pname;
};
2018-03-27 15:23:21 +01:00
2019-11-07 13:38:41 +00:00
tests = {
installedTests = nixosTests.installed-tests.gdk-pixbuf;
};
2018-03-27 15:23:21 +01: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";
maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
license = licenses.lgpl21Plus;
platforms = platforms.unix;
};
}