nixpkgs/pkgs/tools/graphics/vips/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

140 lines
2.7 KiB
Nix

{ 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";
};
})