2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, libtool
|
2020-04-24 23:36:52 +00:00
|
|
|
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg, djvulibre
|
2021-07-14 22:03:04 +00:00
|
|
|
, lcms2, openexr, libpng, liblqr1, librsvg, libtiff, libxml2, openjpeg, libwebp, libheif
|
2020-04-24 23:36:52 +00:00
|
|
|
, ApplicationServices
|
2021-05-20 23:08:51 +00:00
|
|
|
, Foundation
|
|
|
|
, testVersion, imagemagick
|
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-04-12 18:23:04 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "imagemagick";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "7.1.0-2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ImageMagick";
|
|
|
|
repo = "ImageMagick";
|
2021-04-12 18:23:04 +00:00
|
|
|
rev = version;
|
2021-07-14 22:03:04 +00:00
|
|
|
sha256 = "sha256-0nTz9UBspROrNj72amyZmFYK/y9Xg4+qNt4raZiK3AI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big
|
|
|
|
outputMan = "out"; # it's tiny
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
[ "--with-frozenpaths" ]
|
2021-06-01 10:57:12 +00:00
|
|
|
++ (if arch != null then [ "--with-gcc-arch=${arch}" ] else [ "--without-gcc-arch" ])
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional (librsvg != null) "--with-rsvg"
|
2021-07-14 22:03:04 +00:00
|
|
|
++ lib.optional (liblqr1 != null) "--with-lqr"
|
2020-04-24 23:36:52 +00:00
|
|
|
++ 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
|
|
|
|
;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config libtool ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ zlib fontconfig freetype ghostscript
|
2021-07-14 22:03:04 +00:00
|
|
|
liblqr1 libpng libtiff libxml2 libheif djvulibre
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals (!stdenv.hostPlatform.isMinGW)
|
|
|
|
[ openexr librsvg openjpeg ]
|
2021-05-20 23:08:51 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
ApplicationServices
|
|
|
|
Foundation
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs =
|
|
|
|
[ bzip2 freetype libjpeg lcms2 ]
|
|
|
|
++ lib.optionals (!stdenv.hostPlatform.isMinGW)
|
|
|
|
[ libX11 libXext libXt 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 \
|
2021-02-05 17:12:51 +00:00
|
|
|
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'"
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
'' + lib.optionalString (ghostscript != null) ''
|
|
|
|
for la in $out/lib/*.la; do
|
|
|
|
sed 's|-lgs|-L${lib.getLib ghostscript}/lib -lgs|' -i $la
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru.tests.version =
|
|
|
|
testVersion { package = imagemagick; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.imagemagick.org/";
|
|
|
|
description = "A software suite to create, edit, compose, or convert bitmap images";
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ erictapen dotlambda ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-05-03 20:48:10 +00:00
|
|
|
mainProgram = "magick";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|