about summary refs log tree commit diff
path: root/pkgs/tools/graphics/vips/default.nix
blob: c8f41167f865673ae64a947dc245b981bb1f60db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{ lib
, stdenv
, pkg-config
, glib
, libxml2
, expat
, ApplicationServices
, Foundation
, python3
, fetchFromGitHub
, meson
, ninja
, gtk-doc
, docbook-xsl-nons
, gobject-introspection
  # Optional dependencies
, libjpeg
, libexif
, librsvg
, poppler
, libtiff
, fftw
, lcms2
, libspng
, libimagequant
, imagemagick
, pango
, matio
, cfitsio
, libwebp
, openexr
, openjpeg
, libjxl
, openslide
, libheif
, cgif
, libarchive
, libhwy
, testers
, nix-update-script
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "vips";
  version = "8.15.3";

  outputs = [ "bin" "out" "man" "dev" ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ "devdoc" ];

  src = fetchFromGitHub {
    owner = "libvips";
    repo = "libvips";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-VQtHHitEpxv63wC41TtRWLLCKHDAK7fbrS+cByeWxT0=";
    # Remove unicode file names which leads to different checksums on HFS+
    # vs. other filesystems because of unicode normalisation.
    postFetch = ''
      rm -r $out/test/test-suite/images/
    '';
  };

  nativeBuildInputs = [
    pkg-config
    meson
    ninja
    docbook-xsl-nons
    gobject-introspection
  ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
    gtk-doc
  ];

  buildInputs = [
    glib
    libxml2
    expat
    (python3.withPackages (p: [ p.pycairo ]))
    # Optional dependencies
    libjpeg
    libexif
    librsvg
    poppler
    libtiff
    fftw
    lcms2
    libspng
    libimagequant
    imagemagick
    pango
    matio
    cfitsio
    libwebp
    openexr
    openjpeg
    libjxl
    openslide
    libheif
    cgif
    libarchive
    libhwy
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ApplicationServices Foundation ];

  # Required by .pc file
  propagatedBuildInputs = [
    glib
  ];

  mesonFlags = [
    "-Dpdfium=disabled"
    "-Dnifti=disabled"
  ]
  ++ lib.optional (!stdenv.hostPlatform.isDarwin) "-Dgtk_doc=true"
  ++ lib.optional (imagemagick == null) "-Dmagick=disabled"
  ;

  passthru = {
    tests = {
      pkg-config = testers.hasPkgConfigModules {
        package = finalAttrs.finalPackage;
      };
      version = testers.testVersion {
        package = finalAttrs.finalPackage;
        command = "vips --version";
      };
    };
    updateScript = nix-update-script {
      extraArgs = [ "--version-regex" "v([0-9.]+)" ];
    };
  };

  meta = with lib; {
    changelog = "https://github.com/libvips/libvips/blob/${finalAttrs.src.rev}/ChangeLog";
    homepage = "https://www.libvips.org/";
    description = "Image processing system for large images";
    license = licenses.lgpl2Plus;
    maintainers = with maintainers; [ kovirobi anthonyroussel ];
    pkgConfigModules = [ "vips" "vips-cpp" ];
    platforms = platforms.unix;
    mainProgram = "vips";
  };
})