2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, libtool
|
2022-07-18 16:21:45 +00:00
|
|
|
, 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
|
2021-05-20 23:08:51 +00:00
|
|
|
, ApplicationServices, Foundation
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
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"
|
2021-05-28 09:39:13 +00:00
|
|
|
else if stdenv.hostPlatform.system == "aarch64-linux" || stdenv.hostPlatform.system == "aarch64-darwin" then "aarch64"
|
2020-10-07 09:15:18 +00:00
|
|
|
else if stdenv.hostPlatform.system == "powerpc64le-linux" then "ppc64le"
|
2021-06-01 10:57:12 +00:00
|
|
|
else null;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "imagemagick";
|
2021-10-28 06:52:43 +00:00
|
|
|
version = "6.9.12-26";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ImageMagick";
|
|
|
|
repo = "ImageMagick6";
|
2021-02-05 17:12:51 +00:00
|
|
|
rev = version;
|
2021-10-28 06:52:43 +00:00
|
|
|
sha256 = "sha256-oNorY/93jk1v5BS1T3wqctXuzV4o8JlyZtHnsNYmO4U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big
|
|
|
|
outputMan = "out"; # it's tiny
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
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"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config libtool ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
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
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
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;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = false; # fails 6 out of 76 tests
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
(cd "$dev/include" && ln -s ImageMagick* ImageMagick)
|
|
|
|
moveToOutput "bin/*-config" "$dev"
|
|
|
|
moveToOutput "lib/ImageMagick-*/config-Q16" "$dev" # includes configure params
|
|
|
|
for file in "$dev"/bin/*-config; do
|
2021-02-05 17:12:51 +00:00
|
|
|
substituteInPlace "$file" --replace "${pkg-config}/bin/pkg-config -config" \
|
|
|
|
${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config
|
|
|
|
substituteInPlace "$file" --replace ${pkg-config}/bin/pkg-config \
|
|
|
|
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'"
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
2022-07-18 16:21:45 +00:00
|
|
|
'' + lib.optionalString ghostscriptSupport ''
|
2020-04-24 23:36:52 +00:00
|
|
|
for la in $out/lib/*.la; do
|
|
|
|
sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-03-09 03:18:52 +00:00
|
|
|
homepage = "https://legacy.imagemagick.org/";
|
|
|
|
changelog = "https://legacy.imagemagick.org/script/changelog.php";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A software suite to create, edit, compose, or convert bitmap images";
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2022-04-03 18:54:34 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|