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