imagemagick6: modernize package options
Throughout Nixpkgs, we now tend to avoid packages being null outside of bootstrapping, in favour of dedicated options that can have more complex defaults set, e.g. per-platform. This simplifies and regularizes the imagemagick package definition.
This commit is contained in:
parent
4a0608f8b2
commit
322ed64cf9
@ -1,6 +1,25 @@
|
||||
{ lib, stdenv, fetchFromGitHub, pkg-config, libtool
|
||||
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg, djvulibre
|
||||
, lcms2, openexr, libpng, liblqr1, librsvg, libtiff, libxml2, openjpeg, libwebp, fftw, libheif, libde265
|
||||
, bzip2Support ? true, bzip2
|
||||
, zlibSupport ? true, zlib
|
||||
, libX11Support ? !stdenv.hostPlatform.isMinGW, libX11
|
||||
, libXtSupport ? !stdenv.hostPlatform.isMinGW, libXt
|
||||
, fontconfigSupport ? true, fontconfig
|
||||
, freetypeSupport ? true, freetype
|
||||
, ghostscriptSupport ? false, ghostscript
|
||||
, libjpegSupport ? true, libjpeg
|
||||
, djvulibreSupport ? true, djvulibre
|
||||
, lcms2Support ? true, lcms2
|
||||
, openexrSupport ? !stdenv.hostPlatform.isMinGW, openexr
|
||||
, libpngSupport ? true, libpng
|
||||
, liblqr1Support ? true, liblqr1
|
||||
, librsvgSupport ? !stdenv.hostPlatform.isMinGW, librsvg
|
||||
, libtiffSupport ? true, libtiff
|
||||
, libxml2Support ? true, libxml2
|
||||
, openjpegSupport ? !stdenv.hostPlatform.isMinGW, openjpeg
|
||||
, libwebpSupport ? !stdenv.hostPlatform.isMinGW, libwebp
|
||||
, libheifSupport ? true, libheif
|
||||
, libde265Support ? true, libde265
|
||||
, fftw
|
||||
, ApplicationServices, Foundation
|
||||
}:
|
||||
|
||||
@ -30,35 +49,47 @@ stdenv.mkDerivation rec {
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
configureFlags =
|
||||
[ "--with-frozenpaths" ]
|
||||
++ (if arch != null then [ "--with-gcc-arch=${arch}" ] else [ "--without-gcc-arch" ])
|
||||
++ lib.optional (librsvg != null) "--with-rsvg"
|
||||
++ lib.optional (liblqr1 != null) "--with-lqr"
|
||||
++ lib.optionals (ghostscript != null)
|
||||
[ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
|
||||
"--with-gslib"
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.isMinGW)
|
||||
[ "--enable-static" "--disable-shared" ] # due to libxml2 being without DLLs ATM
|
||||
;
|
||||
configureFlags = [
|
||||
"--with-frozenpaths"
|
||||
(lib.withFeatureAs (arch != null) "gcc-arch" arch)
|
||||
(lib.withFeature librsvgSupport "rsvg")
|
||||
(lib.withFeature liblqr1Support "lqr")
|
||||
(lib.withFeatureAs ghostscriptSupport "gs-font-dir" "${ghostscript}/share/ghostscript/fonts")
|
||||
(lib.withFeature ghostscriptSupport "gslib")
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMinGW [
|
||||
# due to libxml2 being without DLLs ATM
|
||||
"--enable-static" "--disable-shared"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config libtool ];
|
||||
|
||||
buildInputs =
|
||||
[ zlib fontconfig freetype ghostscript
|
||||
liblqr1 libpng libtiff libxml2 libheif libde265 djvulibre
|
||||
]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isMinGW)
|
||||
[ openexr librsvg openjpeg ]
|
||||
++ lib.optionals stdenv.isDarwin
|
||||
[ ApplicationServices Foundation ];
|
||||
buildInputs = [ ]
|
||||
++ lib.optional zlibSupport zlib
|
||||
++ lib.optional fontconfigSupport fontconfig
|
||||
++ lib.optional ghostscriptSupport ghostscript
|
||||
++ lib.optional liblqr1Support liblqr1
|
||||
++ lib.optional libpngSupport libpng
|
||||
++ lib.optional libtiffSupport libtiff
|
||||
++ lib.optional libxml2Support libxml2
|
||||
++ lib.optional libheifSupport libheif
|
||||
++ lib.optional libde265Support libde265
|
||||
++ lib.optional djvulibreSupport djvulibre
|
||||
++ lib.optional openexrSupport openexr
|
||||
++ lib.optional librsvgSupport librsvg
|
||||
++ lib.optional openjpegSupport openjpeg
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
ApplicationServices
|
||||
Foundation
|
||||
];
|
||||
|
||||
propagatedBuildInputs =
|
||||
[ bzip2 freetype libjpeg lcms2 fftw ]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isMinGW)
|
||||
[ libX11 libXext libXt libwebp ]
|
||||
;
|
||||
propagatedBuildInputs = [ fftw ]
|
||||
++ lib.optional bzip2Support bzip2
|
||||
++ lib.optional freetypeSupport freetype
|
||||
++ lib.optional libjpegSupport libjpeg
|
||||
++ lib.optional lcms2Support lcms2
|
||||
++ lib.optional libX11Support libX11
|
||||
++ lib.optional libXtSupport libXt
|
||||
++ lib.optional libwebpSupport libwebp;
|
||||
|
||||
doCheck = false; # fails 6 out of 76 tests
|
||||
|
||||
@ -72,7 +103,7 @@ stdenv.mkDerivation rec {
|
||||
substituteInPlace "$file" --replace ${pkg-config}/bin/pkg-config \
|
||||
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'"
|
||||
done
|
||||
'' + lib.optionalString (ghostscript != null) ''
|
||||
'' + lib.optionalString ghostscriptSupport ''
|
||||
for la in $out/lib/*.la; do
|
||||
sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la
|
||||
done
|
||||
|
@ -27833,35 +27833,35 @@ with pkgs;
|
||||
fiji = callPackage ../applications/graphics/fiji { };
|
||||
|
||||
imagemagick6_light = imagemagick6.override {
|
||||
bzip2 = null;
|
||||
zlib = null;
|
||||
libX11 = null;
|
||||
libXext = null;
|
||||
libXt = null;
|
||||
fontconfig = null;
|
||||
freetype = null;
|
||||
ghostscript = null;
|
||||
libjpeg = null;
|
||||
djvulibre = null;
|
||||
lcms2 = null;
|
||||
openexr = null;
|
||||
libpng = null;
|
||||
liblqr1 = null;
|
||||
librsvg = null;
|
||||
libtiff = null;
|
||||
libxml2 = null;
|
||||
openjpeg = null;
|
||||
libwebp = null;
|
||||
libheif = null;
|
||||
libde265 = null;
|
||||
bzip2Support = false;
|
||||
zlibSupport = false;
|
||||
libX11Support = false;
|
||||
libXtSupport = false;
|
||||
fontconfigSupport = false;
|
||||
freetypeSupport = false;
|
||||
ghostscriptSupport = false;
|
||||
libjpegSupport = false;
|
||||
djvulibreSupport = false;
|
||||
lcms2Support = false;
|
||||
openexrSupport = false;
|
||||
libpngSupport = false;
|
||||
liblqr1Support = false;
|
||||
librsvgSupport = false;
|
||||
libtiffSupport = false;
|
||||
libxml2Support = false;
|
||||
openjpegSupport = false;
|
||||
libwebpSupport = false;
|
||||
libheifSupport = false;
|
||||
libde265Support = false;
|
||||
};
|
||||
|
||||
imagemagick6 = callPackage ../applications/graphics/ImageMagick/6.x.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) ApplicationServices Foundation;
|
||||
ghostscript = null;
|
||||
};
|
||||
|
||||
imagemagick6Big = imagemagick6.override { inherit ghostscript; };
|
||||
imagemagick6Big = imagemagick6.override {
|
||||
ghostscriptSupport = true;
|
||||
};
|
||||
|
||||
imagemagick_light = lowPrio (imagemagick.override {
|
||||
bzip2Support = false;
|
||||
|
Loading…
Reference in New Issue
Block a user