about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/graphics/graphicsmagick
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/graphics/graphicsmagick')
-rw-r--r--nixpkgs/pkgs/applications/graphics/graphicsmagick/compat.nix37
-rw-r--r--nixpkgs/pkgs/applications/graphics/graphicsmagick/default.nix42
-rw-r--r--nixpkgs/pkgs/applications/graphics/graphicsmagick/disable-popen.patch12
3 files changed, 91 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/graphics/graphicsmagick/compat.nix b/nixpkgs/pkgs/applications/graphics/graphicsmagick/compat.nix
new file mode 100644
index 000000000000..bd1ce2ed893a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/graphics/graphicsmagick/compat.nix
@@ -0,0 +1,37 @@
+{ stdenv, graphicsmagick }:
+
+stdenv.mkDerivation rec {
+  name = "graphicsmagick-imagemagick-compat-${version}";
+  inherit (graphicsmagick) version;
+
+  unpackPhase = "true";
+  buildPhase = "true";
+
+  utils = [
+    "composite"
+    "conjure"
+    "convert"
+    "identify"
+    "mogrify"
+    "montage"
+    "animate"
+    "display"
+    "import"
+  ];
+
+  # TODO: symlink libraries?
+  installPhase = ''
+    mkdir -p "$out"/bin
+    mkdir -p "$out"/share/man/man1
+    for util in ''${utils[@]}; do
+      ln -s ${graphicsmagick}/bin/gm "$out/bin/$util"
+      ln -s ${graphicsmagick}/share/man/man1/gm.1.gz "$out/share/man/man1/$util.1.gz"
+    done
+  '';
+
+  meta = {
+    description = "ImageMagick interface for GraphicsMagick";
+    license = stdenv.lib.licenses.free;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/graphics/graphicsmagick/default.nix b/nixpkgs/pkgs/applications/graphics/graphicsmagick/default.nix
new file mode 100644
index 000000000000..c93b4fe958d5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/graphics/graphicsmagick/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, bzip2, freetype, graphviz, ghostscript
+, libjpeg, libpng, libtiff, libxml2, zlib, libtool, xz, libX11
+, libwebp, quantumdepth ? 8, fixDarwinDylibNames }:
+
+stdenv.mkDerivation rec {
+  name = "graphicsmagick-${version}";
+  version = "1.3.31";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${version}.tar.xz";
+    sha256 = "0y22740f25qxsqqqg26xqlfp920dm57b7hrgaqmx7azksrcvnsq9";
+  };
+
+  patches = [
+    ./disable-popen.patch
+  ];
+
+  configureFlags = [
+    "--enable-shared"
+    "--with-quantum-depth=${toString quantumdepth}"
+    "--with-gslib=yes"
+  ];
+
+  buildInputs =
+    [ bzip2 freetype ghostscript graphviz libjpeg libpng libtiff libX11 libxml2
+      zlib libtool libwebp
+    ]
+    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  nativeBuildInputs = [ xz ];
+
+  postInstall = ''
+    sed -i 's/-ltiff.*'\'/\'/ $out/bin/*
+  '';
+
+  meta = {
+    homepage = http://www.graphicsmagick.org;
+    description = "Swiss army knife of image processing";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/graphics/graphicsmagick/disable-popen.patch b/nixpkgs/pkgs/applications/graphics/graphicsmagick/disable-popen.patch
new file mode 100644
index 000000000000..2cdb1f7e90f7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/graphics/graphicsmagick/disable-popen.patch
@@ -0,0 +1,12 @@
+http://permalink.gmane.org/gmane.comp.security.oss.general/19669
+
+--- a/magick/blob.c Sat Nov 07 14:49:16 2015 -0600
++++ b/magick/blob.c Sun May 29 14:12:57 2016 -0500
+@@ -68,6 +68,7 @@
+ */
+ #define DefaultBlobQuantum  65541
+ 
++#undef HAVE_POPEN
+ 
+ /*
+   Enum declarations.