nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5
6 # Native build inputs
7 docbook-xsl-nons,
8 gobject-introspection,
9 gtk-doc,
10 meson,
11 ninja,
12 pkg-config,
13 buildPackages,
14
15 # Build inputs
16 expat,
17 glib,
18 libxml2,
19 python3,
20
21 # Optional dependencies
22 cfitsio,
23 cgif,
24 fftw,
25 imagemagick,
26 lcms2,
27 libarchive,
28 libexif,
29 libheif,
30 libhwy,
31 libimagequant,
32 libjpeg,
33 libjxl,
34 librsvg,
35 libpng,
36 libtiff,
37 libwebp,
38 matio,
39 openexr,
40 openjpeg,
41 openslide,
42 pango,
43 poppler,
44 withIntrospection ?
45 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
46 && stdenv.hostPlatform.emulatorAvailable buildPackages,
47
48 # passthru
49 testers,
50 nix-update-script,
51}:
52
53stdenv.mkDerivation (finalAttrs: {
54 pname = "vips";
55 version = "8.16.1";
56
57 outputs = [
58 "bin"
59 "out"
60 "man"
61 "dev"
62 ]
63 ++ lib.optionals (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isFreeBSD) [ "devdoc" ];
64
65 src = fetchFromGitHub {
66 owner = "libvips";
67 repo = "libvips";
68 tag = "v${finalAttrs.version}";
69 hash = "sha256-F2ymfvqwuCtNtFIOLgXvqRWATSMaeV7EQKYyQalCNfc=";
70 # Remove unicode file names which leads to different checksums on HFS+
71 # vs. other filesystems because of unicode normalisation.
72 postFetch = ''
73 rm -r $out/test/test-suite/images/
74 '';
75 };
76
77 nativeBuildInputs = [
78 docbook-xsl-nons
79 gobject-introspection
80 meson
81 ninja
82 pkg-config
83 ]
84 ++ lib.optionals (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isFreeBSD) [
85 gtk-doc
86 ];
87
88 buildInputs = [
89 glib
90 libxml2
91 expat
92 (python3.withPackages (p: [ p.pycairo ]))
93
94 # Optional dependencies
95 cfitsio
96 cgif
97 fftw
98 imagemagick
99 lcms2
100 libarchive
101 libexif
102 libheif
103 libhwy
104 libimagequant
105 libjpeg
106 libjxl
107 librsvg
108 libpng
109 libtiff
110 libwebp
111 matio
112 openexr
113 openjpeg
114 openslide
115 pango
116 poppler
117 ];
118
119 # Required by .pc file
120 propagatedBuildInputs = [
121 glib
122 ];
123
124 mesonFlags = [
125 (lib.mesonEnable "pdfium" false)
126 (lib.mesonEnable "nifti" false)
127 (lib.mesonEnable "spng" false) # we want to use libpng
128 (lib.mesonEnable "introspection" withIntrospection)
129 ]
130 ++ lib.optional (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isFreeBSD) (
131 lib.mesonBool "gtk_doc" true
132 )
133 ++ lib.optional (imagemagick == null) (lib.mesonEnable "magick" false);
134
135 passthru = {
136 tests = {
137 pkg-config = testers.hasPkgConfigModules {
138 package = finalAttrs.finalPackage;
139 };
140 version = testers.testVersion {
141 package = finalAttrs.finalPackage;
142 command = "vips --version";
143 };
144 };
145 updateScript = nix-update-script {
146 extraArgs = [
147 "--version-regex"
148 "v([0-9.]+)"
149 ];
150 };
151 };
152
153 meta = with lib; {
154 changelog = "https://github.com/libvips/libvips/blob/${finalAttrs.src.rev}/ChangeLog";
155 homepage = "https://www.libvips.org/";
156 description = "Image processing system for large images";
157 license = licenses.lgpl2Plus;
158 maintainers = with maintainers; [
159 kovirobi
160 anthonyroussel
161 ];
162 pkgConfigModules = [
163 "vips"
164 "vips-cpp"
165 ];
166 platforms = platforms.unix;
167 mainProgram = "vips";
168 };
169})