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