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