1{ lib, stdenv, fetchurl
2# Image file formats
3, libjpeg, libtiff, giflib, libpng, libwebp, libjxl
4, libspectre
5# imlib2 can load images from ID3 tags.
6, libid3tag, librsvg, libheif
7, freetype , bzip2, pkg-config
8, x11Support ? true
9, webpSupport ? true
10, svgSupport ? false
11, heifSupport ? false
12, jxlSupport ? false
13, psSupport ? false
14
15# for passthru.tests
16, libcaca
17, diffoscopeMinimal
18, feh
19, icewm
20, openbox
21, fluxbox
22, enlightenment
23, xorg
24}:
25
26let
27 inherit (lib) optional optionals;
28in
29stdenv.mkDerivation rec {
30 pname = "imlib2";
31 version = "1.9.1";
32
33 src = fetchurl {
34 url = "mirror://sourceforge/enlightenment/${pname}-${version}.tar.xz";
35 hash = "sha256-SiJAOL//vl1NJQxE4F9O5a4k3P74OVsWd8cVxY92TUM=";
36 };
37
38 buildInputs = [
39 libjpeg libtiff giflib libpng
40 bzip2 freetype libid3tag
41 ] ++ optionals x11Support [ xorg.libXft xorg.libXext ]
42 ++ optional heifSupport libheif
43 ++ optional svgSupport librsvg
44 ++ optional webpSupport libwebp
45 ++ optional jxlSupport libjxl
46 ++ optional psSupport libspectre;
47
48 nativeBuildInputs = [ pkg-config ];
49
50 enableParallelBuilding = true;
51
52 # Do not build amd64 assembly code on Darwin, because it fails to compile
53 # with unknow directive errors
54 configureFlags = optional stdenv.isDarwin "--enable-amd64=no"
55 ++ optional (!svgSupport) "--without-svg"
56 ++ optional (!heifSupport) "--without-heif"
57 ++ optional (!x11Support) "--without-x";
58
59 outputs = [ "bin" "out" "dev" ];
60
61 passthru.tests = {
62 inherit
63 libcaca
64 diffoscopeMinimal
65 feh
66 icewm
67 openbox
68 fluxbox
69 enlightenment;
70 };
71
72 meta = with lib; {
73 description = "Image manipulation library";
74
75 longDescription = ''
76 This is the Imlib 2 library - a library that does image file loading and
77 saving as well as rendering, manipulation, arbitrary polygon support, etc.
78 It does ALL of these operations FAST. Imlib2 also tries to be highly
79 intelligent about doing them, so writing naive programs can be done
80 easily, without sacrificing speed.
81 '';
82
83 homepage = "https://docs.enlightenment.org/api/imlib2/html";
84 changelog = "https://git.enlightenment.org/legacy/imlib2.git/plain/ChangeLog?h=v${version}";
85 license = licenses.imlib2;
86 platforms = platforms.unix;
87 maintainers = with maintainers; [ spwhitt ];
88 };
89}