about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/graphics/graphicsmagick/compat.nix37
-rw-r--r--pkgs/applications/graphics/graphicsmagick/default.nix67
-rw-r--r--pkgs/applications/graphics/graphicsmagick/disable-popen.patch12
-rw-r--r--pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix48
-rw-r--r--pkgs/by-name/gr/graphicsmagick/package.nix105
-rw-r--r--pkgs/top-level/all-packages.nix4
6 files changed, 154 insertions, 119 deletions
diff --git a/pkgs/applications/graphics/graphicsmagick/compat.nix b/pkgs/applications/graphics/graphicsmagick/compat.nix
deleted file mode 100644
index b715093308fab..0000000000000
--- a/pkgs/applications/graphics/graphicsmagick/compat.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-{ lib, stdenv, graphicsmagick }:
-
-stdenv.mkDerivation {
-  pname = "graphicsmagick-imagemagick-compat";
-  inherit (graphicsmagick) version;
-
-  dontUnpack = 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 = lib.licenses.free;
-    platforms = lib.platforms.all;
-  };
-}
diff --git a/pkgs/applications/graphics/graphicsmagick/default.nix b/pkgs/applications/graphics/graphicsmagick/default.nix
deleted file mode 100644
index 893d2cebb6010..0000000000000
--- a/pkgs/applications/graphics/graphicsmagick/default.nix
+++ /dev/null
@@ -1,67 +0,0 @@
-{ lib, stdenv, fetchurl, bzip2, freetype, graphviz, ghostscript
-, libjpeg, libpng, libtiff, libxml2, zlib, libtool, xz, libX11
-, libwebp, quantumdepth ? 8, fixDarwinDylibNames, nukeReferences
-, coreutils
-, runCommand
-, graphicsmagick  # for passthru.tests
-}:
-
-stdenv.mkDerivation rec {
-  pname = "graphicsmagick";
-  version = "1.3.42";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${version}.tar.xz";
-    sha256 = "sha256-SE/M/Ssvr2wrqRUUaezlByvLkbpO1z517T2ORsdZ1Vc=";
-  };
-
-  patches = [
-    ./disable-popen.patch
-  ];
-
-  configureFlags = [
-    # specify delegates explicitly otherwise `gm` will invoke the build
-    # coreutils for filetypes it doesn't natively support.
-    "MVDelegate=${lib.getExe' coreutils "mv"}"
-    "--enable-shared"
-    "--with-frozenpaths"
-    "--with-quantum-depth=${toString quantumdepth}"
-    "--with-gslib=yes"
-  ];
-
-  buildInputs =
-    [ bzip2 freetype ghostscript graphviz libjpeg libpng libtiff libX11 libxml2
-      zlib libtool libwebp
-    ];
-
-  nativeBuildInputs = [ xz nukeReferences ]
-  ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-  # Remove CFLAGS from the binaries to avoid closure bloat.
-  # In the past we have had -dev packages in the closure of the binaries soley due to the string references.
-  postConfigure = ''
-    nuke-refs -e $out ./magick/magick_config.h
-  '';
-
-  postInstall = ''
-    sed -i 's/-ltiff.*'\'/\'/ $out/bin/*
-  '';
-
-  passthru = {
-    tests = {
-      issue-157920 = runCommand "issue-157920-regression-test" {
-        buildInputs = [ graphicsmagick ];
-      } ''
-        gm convert ${graphviz}/share/doc/graphviz/neatoguide.pdf jpg:$out
-      '';
-    };
-  };
-
-  meta = {
-    homepage = "http://www.graphicsmagick.org";
-    description = "Swiss army knife of image processing";
-    license = lib.licenses.mit;
-    platforms = lib.platforms.all;
-    mainProgram = "gm";
-  };
-}
diff --git a/pkgs/applications/graphics/graphicsmagick/disable-popen.patch b/pkgs/applications/graphics/graphicsmagick/disable-popen.patch
deleted file mode 100644
index 2cdb1f7e90f72..0000000000000
--- a/pkgs/applications/graphics/graphicsmagick/disable-popen.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-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.
diff --git a/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix b/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
new file mode 100644
index 0000000000000..9e278da037bc8
--- /dev/null
+++ b/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
@@ -0,0 +1,48 @@
+{ lib
+, graphicsmagick
+, stdenvNoCC
+}:
+
+stdenvNoCC.mkDerivation {
+  pname = "graphicsmagick-imagemagick-compat";
+  inherit (graphicsmagick) version;
+
+  outputs = [ "out" "man" ];
+
+  dontUnpack = true;
+  dontBuild = true;
+
+  # TODO: symlink libraries?
+  installPhase = let
+    utilities = [
+      "animate"
+      "composite"
+      "conjure"
+      "convert"
+      "display"
+      "identify"
+      "import"
+      "mogrify"
+      "montage"
+    ];
+    linkUtilityBin = utility: ''
+      ln -s ${lib.getExe graphicsmagick} "$out/bin/${utility}"
+    '';
+    linkUtilityMan = utility: ''
+      ln -s ${lib.getMan graphicsmagick}/share/man/man1/gm.1.gz "$man/share/man/man1/${utility}.1.gz"
+    '';
+  in ''
+    runHook preInstall
+
+    mkdir -p "$out"/bin
+    ${lib.concatStringsSep "\n" (map linkUtilityBin utilities)}
+    mkdir -p "$man"/share/man/man1
+    ${lib.concatStringsSep "\n" (map linkUtilityMan utilities)}
+
+    runHook postInstall
+  '';
+
+  meta = graphicsmagick.meta // {
+    description = "A repack of GraphicsMagick that provides compatibility with ImageMagick interfaces";
+  };
+}
diff --git a/pkgs/by-name/gr/graphicsmagick/package.nix b/pkgs/by-name/gr/graphicsmagick/package.nix
new file mode 100644
index 0000000000000..fb6a9fbd29af0
--- /dev/null
+++ b/pkgs/by-name/gr/graphicsmagick/package.nix
@@ -0,0 +1,105 @@
+{ lib
+, bzip2
+, callPackage
+, coreutils
+, fetchurl
+, fixDarwinDylibNames
+, freetype
+, ghostscript
+, graphviz
+, libX11
+, libjpeg
+, libpng
+, libtiff
+, libtool
+, libwebp
+, libxml2
+, nukeReferences
+, quantumdepth ? 8
+, runCommand
+, stdenv
+, xz
+, zlib
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "graphicsmagick";
+  version = "1.3.43";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${finalAttrs.version}.tar.xz";
+    hash = "sha256-K4hYBzLNfkCdniLGEWI4vvSuBvzaEUUb8z0ln5y/OZ8=";
+  };
+
+  outputs = [ "out" "man" ];
+
+  buildInputs = [
+    bzip2
+    freetype
+    ghostscript
+    graphviz
+    libX11
+    libjpeg
+    libpng
+    libtiff
+    libtool
+    libwebp
+    libxml2
+    zlib
+  ];
+
+  nativeBuildInputs = [
+    nukeReferences
+    xz
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
+
+  configureFlags = [
+    # specify delegates explicitly otherwise `gm` will invoke the build
+    # coreutils for filetypes it doesn't natively support.
+    "MVDelegate=${lib.getExe' coreutils "mv"}"
+    (lib.enableFeature true "shared")
+    (lib.withFeature true "frozenpaths")
+    (lib.withFeatureAs true "quantum-depth" (toString quantumdepth))
+    (lib.withFeatureAs true "gslib" "yes")
+  ];
+
+  # Remove CFLAGS from the binaries to avoid closure bloat.
+  # In the past we have had -dev packages in the closure of the binaries soley
+  # due to the string references.
+  postConfigure = ''
+    nuke-refs -e $out ./magick/magick_config.h
+  '';
+
+  postInstall = ''
+    sed -i 's/-ltiff.*'\'/\'/ $out/bin/*
+  '';
+
+  passthru = {
+    imagemagick-compat = callPackage ./imagemagick-compat.nix {
+      graphicsmagick = finalAttrs.finalPackage;
+    };
+    tests = {
+      issue-157920 = runCommand "issue-157920-regression-test" {
+        buildInputs = [ finalAttrs.finalPackage ];
+      } ''
+        gm convert ${graphviz}/share/doc/graphviz/neatoguide.pdf jpg:$out
+      '';
+    };
+  };
+
+  meta = {
+    homepage = "http://www.graphicsmagick.org";
+    description = "Swiss army knife of image processing";
+    longDescription = ''
+      GraphicsMagick is the swiss army knife of image processing, providing a
+      robust and efficient collection of tools and libraries which support
+      reading, writing, and manipulating an image in over 92 major formats
+      including important formats like DPX, GIF, JPEG, JPEG-2000, JXL, PNG, PDF,
+      PNM, TIFF, and WebP.
+    '';
+    license = with lib.licenses; [ mit ];
+    maintainers = with lib.maintainers; [ AndersonTorres ];
+    mainProgram = "gm";
+    platforms = lib.platforms.all;
+  };
+})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0f7c71c3f40f6..30aced23bf3b2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -31666,10 +31666,8 @@ with pkgs;
         pythonPackages = python3Packages;
   };
 
-  graphicsmagick = callPackage ../applications/graphics/graphicsmagick { };
   graphicsmagick_q16 = graphicsmagick.override { quantumdepth = 16; };
-
-  graphicsmagick-imagemagick-compat = callPackage ../applications/graphics/graphicsmagick/compat.nix { };
+  graphicsmagick-imagemagick-compat = graphicsmagick.imagemagick-compat;
 
   grisbi = callPackage ../applications/office/grisbi { gtk = gtk3; };