1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, dav1d
7, rav1e
8, libde265
9, x265
10, libpng
11, libjpeg
12, libaom
13, gdk-pixbuf
14
15# for passthru.tests
16, gimp
17, imagemagick
18, imlib2Full
19, imv
20, python3Packages
21, vips
22}:
23
24stdenv.mkDerivation rec {
25 pname = "libheif";
26 version = "1.18.0";
27
28 outputs = [ "bin" "out" "dev" "man" ];
29
30 src = fetchFromGitHub {
31 owner = "strukturag";
32 repo = "libheif";
33 rev = "v${version}";
34 sha256 = "sha256-3au6xCJd1kP6qJI6TBeWJ2ittCqE0QvmSYxWYcgPOcw=";
35 };
36
37 nativeBuildInputs = [
38 pkg-config
39 cmake
40 ];
41
42 buildInputs = [
43 dav1d
44 rav1e
45 libde265
46 x265
47 libpng
48 libjpeg
49 libaom
50 gdk-pixbuf
51 ];
52
53 # Fix installation path for gdk-pixbuf module
54 PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${placeholder "out"}/${gdk-pixbuf.moduleDir}";
55
56 # Wrong include path in .cmake. It's a bit difficult to patch because of special characters.
57 postFixup = ''
58 sed '/^ INTERFACE_INCLUDE_DIRECTORIES/s|"[^"]*/include"|"${placeholder "dev"}/include"|' \
59 -i "$dev"/lib/cmake/libheif/libheif-config.cmake
60 '';
61
62 passthru.tests = {
63 inherit gimp imagemagick imlib2Full imv vips;
64 inherit (python3Packages) pillow-heif;
65 };
66
67 meta = {
68 homepage = "http://www.libheif.org/";
69 description = "ISO/IEC 23008-12:2017 HEIF image file format decoder and encoder";
70 license = lib.licenses.lgpl3Plus;
71 platforms = lib.platforms.unix;
72 maintainers = with lib.maintainers; [ gebner ];
73 };
74}