@@ -1,21 +1,11 @@
1−{ lib
2−, stdenv
3−, fetchurl
4−, pkgconfig
5−, bzip2
6−, fontconfig
7−, freetype
8−, ghostscript ? null
9−, libjpeg
10−, libpng
11−, libtiff
12−, libxml2
13−, zlib
14−, libtool
15−, jasper
16−, libX11
17−, tetex ? null
18−, librsvg ? null
1+{ stdenv, fetchurl, pkgconfig, libtool
2+, libcl ? null, perl ? null, jemalloc ? null, bzip2 ? null, zlib ? null
3+, libX11 ? null, libXext ? null, libXt ? null, dejavu_fonts ? null, fftw ? null
4+, libfpx ? null, djvulibre ? null, fontconfig ? null, freetype ? null
5+, ghostscript ? null, graphviz ? null, jbigkit ? null, libjpeg ? null
6+, lcms2 ? null, openjpeg ? null, liblqr1 ? null, xz ? null, openexr ? null
7+, pango ? null, libpng ? null, librsvg ? null, libtiff ? null, libwebp ? null
8+, libxml2 ? null
199}:
2010
2111let
@@ -27,8 +17,15 @@ let
2717 else if stdenv.system == "x86_64-linux" || stdenv.system == "x86_64-darwin" then "x86-64"
2818 else throw "ImageMagick is not supported on this platform.";
2919
20+ mkFlag = trueStr: falseStr: cond: val: "--${if cond then trueStr else falseStr}-${val}";
21+ mkWith = mkFlag "with" "without";
22+ mkEnable = mkFlag "enable" "disable";
23+
24+ hasX11 = libX11 != null && libXext != null && libXt != null;
25+
3026in
3127
28+with stdenv.lib;
3229stdenv.mkDerivation rec {
3330 name = "imagemagick-${version}";
3431
@@ -39,26 +36,55 @@ stdenv.mkDerivation rec {
3936
4037 enableParallelBuilding = true;
4138
42− preConfigure = if tetex != null then
43− ''
44− export DVIDecodeDelegate=${tetex}/bin/dvips
45− '' else "";
39+ #preConfigure = if tetex != null then
40+ # ''
41+ # export DVIDecodeDelegate=${tetex}/bin/dvips
42+ # '' else "";
4643
47− configureFlags =
48− [ "--with-frozenpaths" ]
49− ++ [ "--with-gcc-arch=${arch}" ]
50− ++ lib.optional (librsvg != null) "--with-rsvg"
51− ++ lib.optionals (stdenv.system != "x86_64-darwin")
52− [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts"
53− "--with-gslib"
54− ];
44+ configureFlags = [
45+ (mkEnable (libcl != null) "opencl")
46+ (mkWith true "modules")
47+ (mkWith true "gcc-arch=${arch}")
48+ (mkEnable true "hdri")
49+ (mkWith (perl != null) "perl")
50+ (mkWith (jemalloc != null) "jemalloc")
51+ (mkWith true "frozenpaths")
52+ (mkWith (bzip2 != null) "bzlib")
53+ (mkWith hasX11 "x")
54+ (mkWith (zlib != null) "zlib")
55+ (mkWith false "dps")
56+ (mkWith (fftw != null) "fftw")
57+ (mkWith (libfpx != null) "fpx")
58+ (mkWith (djvulibre != null) "djvu")
59+ (mkWith (fontconfig != null) "fontconfig")
60+ (mkWith (freetype != null) "freetype")
61+ (mkWith (ghostscript != null) "gslib")
62+ (mkWith (graphviz != null) "gvc")
63+ (mkWith (jbigkit != null) "jbig")
64+ (mkWith (libjpeg != null) "jpeg")
65+ (mkWith (lcms2 != null) "lcms2")
66+ (mkWith false "lcms")
67+ (mkWith (openjpeg != null) "openjp2")
68+ (mkWith (liblqr1 != null) "lqr")
69+ (mkWith (xz != null) "lzma")
70+ (mkWith (openexr != null) "openexr")
71+ (mkWith (pango != null) "pango")
72+ (mkWith (libpng != null) "png")
73+ (mkWith (librsvg != null) "rsvg")
74+ (mkWith (libtiff != null) "tiff")
75+ (mkWith (libwebp != null) "webp")
76+ (mkWith (libxml2 != null) "xml")
77+ ] ++ optional (dejavu_fonts != null) "--with-dejavu-font-dir=${dejavu_fonts}/share/fonts/truetype/"
78+ ++ optional (ghostscript != null) "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts/";
5579
56− propagatedBuildInputs =
57− [ bzip2 fontconfig freetype libjpeg libpng libtiff libxml2 zlib librsvg
58− libtool jasper libX11
59− ] ++ lib.optional (stdenv.system != "x86_64-darwin") ghostscript;
80+ propagatedBuildInputs = [ ];
6081
61− buildInputs = [ tetex pkgconfig ];
82+ buildInputs = [
83+ pkgconfig libtool libcl perl jemalloc bzip2 zlib libX11 libXext libXt fftw
84+ libfpx djvulibre fontconfig freetype ghostscript graphviz jbigkit libjpeg
85+ lcms2 openjpeg liblqr1 xz openexr pango libpng librsvg libtiff libwebp
86+ libxml2
87+ ];
6288
6389 postInstall = ''(cd "$out/include" && ln -s ImageMagick* ImageMagick)'';
6490
@@ -66,6 +92,6 @@ stdenv.mkDerivation rec {
6692 homepage = http://www.imagemagick.org/;
6793 description = "A software suite to create, edit, compose, or convert bitmap images";
6894 platforms = platforms.linux ++ [ "x86_64-darwin" ];
69− maintainers = with maintainers; [ the-kenny ];
95+ maintainers = with maintainers; [ the-kenny wkennington ];
7096 };
7197}