nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 118 lines 2.8 kB view raw
1{ 2 lib, 3 bzip2, 4 callPackage, 5 coreutils, 6 fetchurl, 7 fixDarwinDylibNames, 8 freetype, 9 ghostscript, 10 graphviz, 11 libX11, 12 libjpeg, 13 libpng, 14 libtiff, 15 libtool, 16 libwebp, 17 libxml2, 18 libheifSupport ? true, 19 libheif, 20 nukeReferences, 21 pkg-config, 22 quantumdepth ? 8, 23 runCommand, 24 stdenv, 25 xz, 26 zlib, 27}: 28 29stdenv.mkDerivation (finalAttrs: { 30 pname = "graphicsmagick"; 31 version = "1.3.45"; 32 33 src = fetchurl { 34 url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${finalAttrs.version}.tar.xz"; 35 hash = "sha256-3OpRZ0FPfIBVV94tekepsxR7y/YXuR9fD0r+XmVDAms="; 36 }; 37 38 outputs = [ 39 "out" 40 "man" 41 ]; 42 43 buildInputs = [ 44 bzip2 45 freetype 46 ghostscript 47 graphviz 48 libX11 49 libjpeg 50 libpng 51 libtiff 52 libtool 53 libwebp 54 libxml2 55 zlib 56 ] 57 ++ lib.optionals libheifSupport [ libheif ]; 58 59 nativeBuildInputs = [ 60 nukeReferences 61 pkg-config 62 xz 63 ] 64 ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ]; 65 66 configureFlags = [ 67 # specify delegates explicitly otherwise `gm` will invoke the build 68 # coreutils for filetypes it doesn't natively support. 69 "MVDelegate=${lib.getExe' coreutils "mv"}" 70 (lib.enableFeature true "shared") 71 (lib.withFeature true "frozenpaths") 72 (lib.withFeatureAs true "quantum-depth" (toString quantumdepth)) 73 (lib.withFeatureAs true "gslib" "yes") 74 ]; 75 76 # Remove CFLAGS from the binaries to avoid closure bloat. 77 # In the past we have had -dev packages in the closure of the binaries solely 78 # due to the string references. 79 postConfigure = '' 80 nuke-refs -e $out ./magick/magick_config.h 81 ''; 82 83 postInstall = '' 84 sed -i 's/-ltiff.*'\'/\'/ $out/bin/* 85 ''; 86 87 passthru = { 88 imagemagick-compat = callPackage ./imagemagick-compat.nix { 89 graphicsmagick = finalAttrs.finalPackage; 90 }; 91 tests = { 92 issue-157920 = 93 runCommand "issue-157920-regression-test" 94 { 95 buildInputs = [ finalAttrs.finalPackage ]; 96 } 97 '' 98 gm convert ${graphviz}/share/doc/graphviz/neatoguide.pdf jpg:$out 99 ''; 100 }; 101 }; 102 103 meta = { 104 homepage = "http://www.graphicsmagick.org"; 105 description = "Swiss army knife of image processing"; 106 longDescription = '' 107 GraphicsMagick is the swiss army knife of image processing, providing a 108 robust and efficient collection of tools and libraries which support 109 reading, writing, and manipulating an image in over 92 major formats 110 including important formats like DPX, GIF, JPEG, JPEG-2000, JXL, PNG, PDF, 111 PNM, TIFF, and WebP. 112 ''; 113 license = with lib.licenses; [ mit ]; 114 maintainers = with lib.maintainers; [ ]; 115 mainProgram = "gm"; 116 platforms = lib.platforms.all; 117 }; 118})