2022-07-18 16:21:45 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, libtool
|
|
|
|
, 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
|
|
|
|
, libjxlSupport ? true, libjxl
|
|
|
|
, libpngSupport ? true, libpng
|
|
|
|
, liblqr1Support ? true, liblqr1
|
|
|
|
, librawSupport ? true, libraw
|
2022-09-30 11:47:45 +00:00
|
|
|
, librsvgSupport ? !stdenv.hostPlatform.isMinGW, librsvg, pango
|
2022-07-18 16:21:45 +00:00
|
|
|
, libtiffSupport ? true, libtiff
|
|
|
|
, libxml2Support ? true, libxml2
|
|
|
|
, openjpegSupport ? !stdenv.hostPlatform.isMinGW, openjpeg
|
|
|
|
, libwebpSupport ? !stdenv.hostPlatform.isMinGW, libwebp
|
|
|
|
, libheifSupport ? true, libheif
|
|
|
|
, potrace
|
|
|
|
, curl
|
|
|
|
, ApplicationServices
|
|
|
|
, Foundation
|
|
|
|
, testers
|
|
|
|
, imagemagick
|
2023-11-16 04:20:00 +00:00
|
|
|
, nixos-icons
|
2023-10-09 19:29:22 +00:00
|
|
|
, perlPackages
|
2023-02-09 11:40:11 +00:00
|
|
|
, python3
|
2022-07-18 16:21:45 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert libXtSupport -> libX11Support;
|
|
|
|
|
|
|
|
let
|
|
|
|
arch =
|
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then "i686"
|
|
|
|
else if stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin" then "x86-64"
|
|
|
|
else if stdenv.hostPlatform.system == "armv7l-linux" then "armv7l"
|
|
|
|
else if stdenv.hostPlatform.system == "aarch64-linux" || stdenv.hostPlatform.system == "aarch64-darwin" then "aarch64"
|
|
|
|
else if stdenv.hostPlatform.system == "powerpc64le-linux" then "ppc64le"
|
|
|
|
else null;
|
|
|
|
in
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-07-18 16:21:45 +00:00
|
|
|
pname = "imagemagick";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "7.1.1-29";
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ImageMagick";
|
|
|
|
repo = "ImageMagick";
|
2023-02-09 11:40:11 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-W9WbHzmTa0dA9+mOxXu88qmN1mO9ORaH0Nj6r2s1Q+E=";
|
2022-07-18 16:21:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big
|
|
|
|
outputMan = "out"; # it's tiny
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-frozenpaths"
|
|
|
|
(lib.withFeatureAs (arch != null) "gcc-arch" arch)
|
|
|
|
(lib.withFeature librsvgSupport "rsvg")
|
2022-09-30 11:47:45 +00:00
|
|
|
(lib.withFeature librsvgSupport "pango")
|
2022-07-18 16:21:45 +00:00
|
|
|
(lib.withFeature liblqr1Support "lqr")
|
|
|
|
(lib.withFeature libjxlSupport "jxl")
|
|
|
|
(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 = [ potrace ]
|
|
|
|
++ lib.optional zlibSupport zlib
|
|
|
|
++ lib.optional fontconfigSupport fontconfig
|
|
|
|
++ lib.optional ghostscriptSupport ghostscript
|
|
|
|
++ lib.optional liblqr1Support liblqr1
|
|
|
|
++ lib.optional libpngSupport libpng
|
|
|
|
++ lib.optional librawSupport libraw
|
|
|
|
++ lib.optional libtiffSupport libtiff
|
|
|
|
++ lib.optional libxml2Support libxml2
|
|
|
|
++ lib.optional libheifSupport libheif
|
|
|
|
++ lib.optional djvulibreSupport djvulibre
|
|
|
|
++ lib.optional libjxlSupport libjxl
|
|
|
|
++ lib.optional openexrSupport openexr
|
2022-09-30 11:47:45 +00:00
|
|
|
++ lib.optionals librsvgSupport [
|
|
|
|
librsvg
|
|
|
|
pango
|
|
|
|
]
|
2022-07-18 16:21:45 +00:00
|
|
|
++ lib.optional openjpegSupport openjpeg
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
ApplicationServices
|
|
|
|
Foundation
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ curl ]
|
|
|
|
++ 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;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
(cd "$dev/include" && ln -s ImageMagick* ImageMagick)
|
|
|
|
moveToOutput "bin/*-config" "$dev"
|
|
|
|
moveToOutput "lib/ImageMagick-*/config-Q16HDRI" "$dev" # includes configure params
|
|
|
|
for file in "$dev"/bin/*-config; do
|
|
|
|
substituteInPlace "$file" --replace pkg-config \
|
2023-03-24 00:07:29 +00:00
|
|
|
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '$(command -v $PKG_CONFIG)'"
|
2022-07-18 16:21:45 +00:00
|
|
|
done
|
|
|
|
'' + lib.optionalString ghostscriptSupport ''
|
|
|
|
for la in $out/lib/*.la; do
|
|
|
|
sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
passthru.tests = {
|
2023-08-04 22:07:22 +00:00
|
|
|
version = testers.testVersion { package = finalAttrs.finalPackage; };
|
2023-11-16 04:20:00 +00:00
|
|
|
inherit nixos-icons;
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit (perlPackages) ImageMagick;
|
2023-02-09 11:40:11 +00:00
|
|
|
inherit (python3.pkgs) img2pdf;
|
|
|
|
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
};
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "http://www.imagemagick.org/";
|
2023-10-09 19:29:22 +00:00
|
|
|
changelog = "https://github.com/ImageMagick/Website/blob/main/ChangeLog.md";
|
2022-07-18 16:21:45 +00:00
|
|
|
description = "A software suite to create, edit, compose, or convert bitmap images";
|
2023-02-09 11:40:11 +00:00
|
|
|
pkgConfigModules = [ "ImageMagick" "MagickWand" ];
|
2022-07-18 16:21:45 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2023-03-24 00:07:29 +00:00
|
|
|
maintainers = with maintainers; [ erictapen dotlambda rhendric ];
|
2022-07-18 16:21:45 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
mainProgram = "magick";
|
|
|
|
};
|
2023-02-09 11:40:11 +00:00
|
|
|
})
|