1- { lib , stdenv , fetchurl , bzip2 , freetype , graphviz , ghostscript
2- , libjpeg , libpng , libtiff , libxml2 , zlib , libtool , xz , libX11
3- , libwebp , quantumdepth ? 8 , fixDarwinDylibNames , nukeReferences
1+ { lib
2+ , bzip2
43, coreutils
4+ , fetchurl
5+ , fixDarwinDylibNames
6+ , freetype
7+ , ghostscript
8+ , graphviz
9+ , libX11
10+ , libjpeg
11+ , libpng
12+ , libtiff
13+ , libtool
14+ , libwebp
15+ , libxml2
16+ , nukeReferences
17+ , quantumdepth ? 8
518, runCommand
6- , graphicsmagick # for passthru.tests
19+ , stdenv
20+ , xz
21+ , zlib
722} :
823
9- stdenv . mkDerivation rec {
24+ stdenv . mkDerivation ( finalAttrs : {
1025 pname = "graphicsmagick" ;
1126 version = "1.3.42" ;
1227
1328 src = fetchurl {
14- url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${ version } .tar.xz" ;
15- sha256 = "sha256-SE/M/Ssvr2wrqRUUaezlByvLkbpO1z517T2ORsdZ1Vc=" ;
29+ url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${ finalAttrs . version } .tar.xz" ;
30+ hash = "sha256-SE/M/Ssvr2wrqRUUaezlByvLkbpO1z517T2ORsdZ1Vc=" ;
1631 } ;
1732
33+ outputs = [ "out" "man" ] ;
34+
1835 patches = [
19- ./disable-popen.patch
36+ # CVE Request: GraphicsMagick and ImageMagick popen() shell vulnerability
37+ # via filename
38+ # https://web.archive.org/web/20160530051451/http://permalink.gmane.org/gmane.comp.security.oss.general/19669
39+ ./001-disable-popen.patch
40+ ] ;
41+
42+ buildInputs = [
43+ bzip2
44+ freetype
45+ ghostscript
46+ graphviz
47+ libX11
48+ libjpeg
49+ libpng
50+ libtiff
51+ libtool
52+ libwebp
53+ libxml2
54+ zlib
2055 ] ;
2156
57+ nativeBuildInputs = [
58+ nukeReferences
59+ xz
60+ ] ++ lib . optionals stdenv . hostPlatform . isDarwin [ fixDarwinDylibNames ] ;
61+
2262 configureFlags = [
2363 # specify delegates explicitly otherwise `gm` will invoke the build
2464 # coreutils for filetypes it doesn't natively support.
2565 "MVDelegate=${ lib . getExe' coreutils "mv" } "
26- "--enable- shared"
27- "--with- frozenpaths"
28- "--with- quantum-depth= ${ toString quantumdepth } "
29- "--with- gslib= yes"
66+ ( lib . enableFeature true " shared")
67+ ( lib . withFeature true " frozenpaths")
68+ ( lib . withFeatureAs true " quantum-depth" ( toString quantumdepth ) )
69+ ( lib . withFeatureAs true " gslib" " yes")
3070 ] ;
3171
32- buildInputs =
33- [ bzip2 freetype ghostscript graphviz libjpeg libpng libtiff libX11 libxml2
34- zlib libtool libwebp
35- ] ;
36-
37- nativeBuildInputs = [ xz nukeReferences ]
38- ++ lib . optional stdenv . hostPlatform . isDarwin fixDarwinDylibNames ;
39-
4072 # Remove CFLAGS from the binaries to avoid closure bloat.
41- # In the past we have had -dev packages in the closure of the binaries soley due to the string references.
73+ # In the past we have had -dev packages in the closure of the binaries soley
74+ # due to the string references.
4275 postConfigure = ''
4376 nuke-refs -e $out ./magick/magick_config.h
4477 '' ;
@@ -50,7 +83,7 @@ stdenv.mkDerivation rec {
5083 passthru = {
5184 tests = {
5285 issue-157920 = runCommand "issue-157920-regression-test" {
53- buildInputs = [ graphicsmagick ] ;
86+ buildInputs = [ finalAttrs . finalPackage ] ;
5487 } ''
5588 gm convert ${ graphviz } /share/doc/graphviz/neatoguide.pdf jpg:$out
5689 '' ;
@@ -60,8 +93,16 @@ stdenv.mkDerivation rec {
6093 meta = {
6194 homepage = "http://www.graphicsmagick.org" ;
6295 description = "Swiss army knife of image processing" ;
63- license = lib . licenses . mit ;
64- platforms = lib . platforms . all ;
96+ longDescription = ''
97+ GraphicsMagick is the swiss army knife of image processing, providing a
98+ robust and efficient collection of tools and libraries which support
99+ reading, writing, and manipulating an image in over 92 major formats
100+ including important formats like DPX, GIF, JPEG, JPEG-2000, JXL, PNG, PDF,
101+ PNM, TIFF, and WebP.
102+ '' ;
103+ license = with lib . licenses ; [ mit ] ;
104+ maintainers = with lib . maintainers ; [ AndersonTorres ] ;
65105 mainProgram = "gm" ;
106+ platforms = lib . platforms . all ;
66107 } ;
67- }
108+ } )
0 commit comments