From 7f0a596473227a4cda01cb427a06e10332ec86ca Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 26 Jul 2015 23:33:49 +0200 Subject: [PATCH] imagemagick: Reduce dependency bloat The closure size of imagemagick has recently gone up from 530 MB (already bad) to 846 MB, which is a bit excessive. So revert most of the recent changes. --- .../graphics/ImageMagick/default.nix | 84 ++++--------------- pkgs/top-level/all-packages.nix | 3 +- 2 files changed, 18 insertions(+), 69 deletions(-) diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix index 7ae24b38c01c..e18686d989a3 100644 --- a/pkgs/applications/graphics/ImageMagick/default.nix +++ b/pkgs/applications/graphics/ImageMagick/default.nix @@ -1,11 +1,6 @@ -{ stdenv, fetchurl, pkgconfig, libtool -, libcl ? null, perl ? null, jemalloc ? null, bzip2 ? null, zlib ? null -, libX11 ? null, libXext ? null, libXt ? null, dejavu_fonts ? null, fftw ? null -, libfpx ? null, djvulibre ? null, fontconfig ? null, freetype ? null -, ghostscript ? null, graphviz ? null, jbigkit ? null, libjpeg ? null -, lcms2 ? null, openjpeg ? null, liblqr1 ? null, xz ? null, openexr ? null -, pango ? null, libpng ? null, librsvg ? null, libtiff ? null, libwebp ? null -, libxml2 ? null +{ lib, stdenv, fetchurl, pkgconfig, libtool +, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg +, lcms2, openexr, libpng, librsvg, libtiff, libxml2 }: let @@ -17,15 +12,8 @@ let else if stdenv.system == "x86_64-linux" || stdenv.system == "x86_64-darwin" then "x86-64" else throw "ImageMagick is not supported on this platform."; - mkFlag = trueStr: falseStr: cond: val: "--${if cond then trueStr else falseStr}-${val}"; - mkWith = mkFlag "with" "without"; - mkEnable = mkFlag "enable" "disable"; - - hasX11 = libX11 != null && libXext != null && libXt != null; - in -with stdenv.lib; stdenv.mkDerivation rec { name = "imagemagick-${version}"; @@ -36,60 +24,22 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - configureFlags = [ - (mkEnable (libcl != null) "opencl") - (mkWith true "modules") - (mkWith true "gcc-arch=${arch}") - #(mkEnable true "hdri") This breaks some dependencies - (mkWith (perl != null) "perl") - (mkWith (jemalloc != null) "jemalloc") - (mkWith true "frozenpaths") - (mkWith (bzip2 != null) "bzlib") - (mkWith hasX11 "x") - (mkWith (zlib != null) "zlib") - (mkWith false "dps") - (mkWith (fftw != null) "fftw") - (mkWith (libfpx != null) "fpx") - (mkWith (djvulibre != null) "djvu") - (mkWith (fontconfig != null) "fontconfig") - (mkWith (freetype != null) "freetype") - (mkWith (ghostscript != null) "gslib") - (mkWith (graphviz != null) "gvc") - (mkWith (jbigkit != null) "jbig") - (mkWith (libjpeg != null) "jpeg") - (mkWith (lcms2 != null) "lcms2") - (mkWith false "lcms") - (mkWith (openjpeg != null) "openjp2") - (mkWith (liblqr1 != null) "lqr") - (mkWith (xz != null) "lzma") - (mkWith (openexr != null) "openexr") - (mkWith (pango != null) "pango") - (mkWith (libpng != null) "png") - (mkWith (librsvg != null) "rsvg") - (mkWith (libtiff != null) "tiff") - (mkWith (libwebp != null) "webp") - (mkWith (libxml2 != null) "xml") - ] ++ optional (dejavu_fonts != null) "--with-dejavu-font-dir=${dejavu_fonts}/share/fonts/truetype/" - ++ optional (ghostscript != null) "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts/"; + configureFlags = + [ "--with-frozenpaths" ] + ++ [ "--with-gcc-arch=${arch}" ] + ++ lib.optional (librsvg != null) "--with-rsvg" + ++ lib.optionals (ghostscript != null) + [ "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts" + "--with-gslib" + ]; - buildInputs = [ - pkgconfig libtool libcl perl jemalloc bzip2 zlib libX11 libXext libXt fftw - libfpx djvulibre fontconfig freetype ghostscript graphviz jbigkit libjpeg - lcms2 openjpeg liblqr1 xz openexr pango libpng librsvg libtiff libwebp - libxml2 - ]; + buildInputs = + [ pkgconfig libtool zlib fontconfig freetype ghostscript libjpeg + openexr libpng librsvg libtiff libxml2 + ]; - propagatedBuildInputs = [] - ++ (stdenv.lib.optional (lcms2 != null) lcms2) - ++ (stdenv.lib.optional (liblqr1 != null) liblqr1) - ++ (stdenv.lib.optional (fftw != null) fftw) - ++ (stdenv.lib.optional (libtool != null) libtool) - ++ (stdenv.lib.optional (jemalloc != null) jemalloc) - ++ (stdenv.lib.optional (libXext != null) libXext) - ++ (stdenv.lib.optional (libX11 != null) libX11) - ++ (stdenv.lib.optional (libXt != null) libXt) - ++ (stdenv.lib.optional (bzip2 != null) bzip2) - ; + propagatedBuildInputs = + [ bzip2 freetype libjpeg libX11 libXext libXt lcms2 ]; postInstall = ''(cd "$out/include" && ln -s ImageMagick* ImageMagick)''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c8347021bbcd..561f68440e49 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11719,8 +11719,7 @@ let }; imagemagick = callPackage ../applications/graphics/ImageMagick { - ghostscript = if stdenv.isDarwin then null else ghostscript; - perl = null; # Currently Broken + ghostscript = null; }; imagemagickBig = imagemagick;