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

110 lines
3.6 KiB
Nix
Raw Normal View History

2018-09-05 00:44:17 +00:00
{ stdenv, fetchurl, fetchpatch, fixDarwinDylibNames, meson, ninja, pkgconfig, gettext, python3, libxml2, libxslt, docbook_xsl
2018-03-04 21:06:08 +00:00
, docbook_xml_dtd_43, gtk-doc, glib, libtiff, libjpeg, libpng, libX11, gnome3
, jasper, gobjectIntrospection, doCheck ? false, makeWrapper }:
let
2018-03-03 05:20:46 +00:00
pname = "gdk-pixbuf";
2018-09-05 00:44:17 +00:00
version = "2.38.0";
in stdenv.mkDerivation rec {
2018-03-03 05:20:46 +00:00
name = "${pname}-${version}";
2018-09-05 00:44:17 +00:00
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
sha256 = "0ixfmnxjylx06mjaw116apymwi1a8rnkmkbbvqaxxg2pfwy9fl6x";
};
patches = [
# TODO: since 2.36.8 gdk-pixbuf gets configured to use mime-type sniffing,
# which requires access to shared-mime-info files during runtime.
# For now, we are patching the build script to avoid the dependency.
./no-mime-sniffing.patch
2018-09-05 00:44:17 +00:00
# Move installed tests to a separate output
./installed-tests-path.patch
(fetchpatch {
2018-09-05 00:44:17 +00:00
url = https://gitlab.gnome.org/GNOME/gdk-pixbuf/commit/a7d582f75a71320554b881e063a65f4ced679c1c.patch;
sha256 = "0z0w52bh4hcrdllbgrqvh12iqzr7k1pb0wdr9vz2qslg1kjk4j92";
})
];
outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
setupHook = ./setup-hook.sh;
# !!! We might want to factor out the gdk-pixbuf-xlib subpackage.
buildInputs = [ libX11 ];
nativeBuildInputs = [
meson ninja pkgconfig gettext python3 libxml2 libxslt docbook_xsl docbook_xml_dtd_43
gtk-doc gobjectIntrospection makeWrapper
]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
propagatedBuildInputs = [ glib libtiff libjpeg libpng jasper ];
mesonFlags = [
"-Ddocs=true"
"-Djasper=true"
"-Dx11=true"
"-Dgir=${if gobjectIntrospection != null then "true" else "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.
stdenv.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"
# 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 = stdenv.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
'';
2018-09-05 00:44:17 +00: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;
2018-03-03 05:20:46 +00:00
passthru = {
updateScript = gnome3.updateScript {
packageName = pname;
attrPath = "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 stdenv.lib; {
description = "A library for image loading and manipulation";
homepage = http://library.gnome.org/devel/gdk-pixbuf/;
maintainers = [ maintainers.eelco ];
2018-08-20 17:32:10 +00:00
license = licenses.lgpl21;
platforms = platforms.unix;
};
}