summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/tools/graphics/graphviz/0001-vimdot-lookup-vim-in-PATH.patch30
-rw-r--r--pkgs/tools/graphics/graphviz/2.32.nix68
-rw-r--r--pkgs/tools/graphics/graphviz/base.nix59
-rw-r--r--pkgs/tools/graphics/graphviz/cve-2014-9157.patch24
-rw-r--r--pkgs/tools/graphics/graphviz/default.nix72
5 files changed, 66 insertions, 187 deletions
diff --git a/pkgs/tools/graphics/graphviz/0001-vimdot-lookup-vim-in-PATH.patch b/pkgs/tools/graphics/graphviz/0001-vimdot-lookup-vim-in-PATH.patch
deleted file mode 100644
index d5f71a4de9e..00000000000
--- a/pkgs/tools/graphics/graphviz/0001-vimdot-lookup-vim-in-PATH.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 2008bf62e13ebe41cdad3e16f8b42f46ae393876 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
-Date: Tue, 6 Jan 2015 20:39:41 +0100
-Subject: [PATCH] vimdot: lookup 'vim' in $PATH
-
-Instead of hardcoding /usr/bin/vim. Needed for NixOS (http://nixos.org), and is
-probably useful for others too.
----
- plugin/xlib/vimdot.sh | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/plugin/xlib/vimdot.sh b/plugin/xlib/vimdot.sh
-index 749fe6a..4e6dd4b 100755
---- a/plugin/xlib/vimdot.sh
-+++ b/plugin/xlib/vimdot.sh
-@@ -3,9 +3,9 @@
- 
- error() { echo "$0: $*" >&2; exit 1; }
- 
--editor="/usr/bin/vim"
-+editor="vim"
- 
--if ! test -x "$editor"; then error "the \"$editor\" editor not found or not executable"; fi
-+if ! test -x "$(command -v "$editor")"; then error "the \"$editor\" editor not found or not executable"; fi
- 
- default="noname.gv"
- 
--- 
-2.1.3
-
diff --git a/pkgs/tools/graphics/graphviz/2.32.nix b/pkgs/tools/graphics/graphviz/2.32.nix
index fb8f0472ce3..544949f33b7 100644
--- a/pkgs/tools/graphics/graphviz/2.32.nix
+++ b/pkgs/tools/graphics/graphviz/2.32.nix
@@ -1,67 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, libpng, libjpeg, expat, libXaw
-, yacc, libtool, fontconfig, pango, gd, xorg, gts, gettext, cairo
-, ApplicationServices
-}:
-
-stdenv.mkDerivation rec {
+import ./base.nix {
+  rev = "10c3c34c5198beacfba950764f34960c6884a34f";
   version = "2.32.0";
-  name = "graphviz-${version}";
-
-  src = fetchurl {
-    url = "http://www.graphviz.org/pub/graphviz/ARCHIVE/${name}.tar.gz";
-    sha256 = "0ym7lw3xnkcgbk32vfmm3329xymca60gzn90rq6dv8887qqv4lyq";
-  };
-
-  buildInputs =
-    [ pkgconfig libpng libjpeg expat libXaw yacc libtool fontconfig
-      pango gd gts
-    ] ++ stdenv.lib.optionals (xorg != null) [ xorg.xlibsWrapper xorg.libXrender ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices gettext ];
-
-  CPPFLAGS = stdenv.lib.optionalString (stdenv.system == "x86_64-darwin") "-I${cairo.dev}/include/cairo";
-
-  configureFlags =
-    [ "--with-pngincludedir=${libpng.dev}/include"
-      "--with-pnglibdir=${libpng.out}/lib"
-      "--with-jpegincludedir=${libjpeg.dev}/include"
-      "--with-jpeglibdir=${libjpeg.out}/lib"
-      "--with-expatincludedir=${expat.dev}/include"
-      "--with-expatlibdir=${expat.out}/lib"
-      "--with-ltdl-include=${libtool}/include"
-      "--with-ltdl-lib=${libtool.lib}/lib"
-      "--with-cgraph=no"
-      "--with-sparse=no"
-    ]
-    ++ stdenv.lib.optional (xorg == null) "--without-x";
-
-  hardeningDisable = [ "fortify" ];
-
-  preBuild = ''
-    sed -e 's@am__append_5 *=.*@am_append_5 =@' -i lib/gvc/Makefile
-  '';
-
-  # "command -v" is POSIX, "which" is not
-  postInstall = ''
-    sed -i 's|`which lefty`|"'$out'/bin/lefty"|' $out/bin/dotty
-    sed -i 's|which|command -v|' $out/bin/vimdot
-  '';
-
-  meta = {
-    homepage = http://www.graphviz.org/;
-    description = "Open source graph visualization software";
-
-    longDescription = ''
-      Graphviz is open source graph visualization software. Graph
-      visualization is a way of representing structural information as
-      diagrams of abstract graphs and networks. It has important
-      applications in networking, bioinformatics, software engineering,
-      database and web design, machine learning, and in visual
-      interfaces for other technical domains.
-    '';
-
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
-    maintainers = with stdenv.lib.maintainers; [ bjornfor raskin ];
-    inherit version;
-    branch = "2.32";
-  };
+  sha256 = "18b2wnz6xk8hndy7dlr1vn9vziyryyflh747n9966778gmh8bick";
 }
diff --git a/pkgs/tools/graphics/graphviz/base.nix b/pkgs/tools/graphics/graphviz/base.nix
new file mode 100644
index 00000000000..8a46b302dcd
--- /dev/null
+++ b/pkgs/tools/graphics/graphviz/base.nix
@@ -0,0 +1,59 @@
+{ rev, sha256, version }:
+
+{ stdenv, fetchFromGitLab, autoreconfHook, pkgconfig, cairo, expat, flex
+, fontconfig, gd, gettext, gts, libdevil, libjpeg, libpng, libtool, pango
+, yacc, xorg ? null, ApplicationServices ? null }:
+
+assert stdenv.isDarwin -> ApplicationServices != null;
+
+let
+  inherit (stdenv.lib) optional optionals optionalString;
+in
+
+stdenv.mkDerivation rec {
+  name = "graphviz-${version}";
+
+  src = fetchFromGitLab {
+    owner = "graphviz";
+    repo = "graphviz";
+    inherit sha256 rev;
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [
+    libpng libjpeg expat yacc libtool fontconfig gd gts libdevil flex pango
+  ] ++ optionals (xorg != null) (with xorg; [ libXrender libXaw libXpm ])
+    ++ optionals (stdenv.isDarwin) [ ApplicationServices gettext ];
+
+  hardeningDisable = [ "fortify" ];
+
+  CPPFLAGS = stdenv.lib.optionalString (xorg != null && stdenv.isDarwin)
+    "-I${cairo.dev}/include/cairo";
+
+  configureFlags = optional (xorg == null) "--without-x";
+
+  postPatch = ''
+    for f in $(find . -name Makefile.in); do
+      substituteInPlace $f --replace "-lstdc++" "-lc++"
+    done
+  '';
+
+  preAutoreconf = "./autogen.sh";
+
+  postFixup = optionalString (xorg != null) ''
+    substituteInPlace $out/bin/dotty --replace '`which lefty`' $out/bin/lefty
+    substituteInPlace $out/bin/vimdot \
+      --replace /usr/bin/vi '$(command -v vi)' \
+      --replace /usr/bin/vim '$(command -v vim)' \
+      --replace /usr/bin/vimdot $out/bin/vimdot \
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://graphviz.org;
+    description = "Graph visualization tools";
+    license = licenses.epl10;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bjornfor raskin ];
+  };
+}
diff --git a/pkgs/tools/graphics/graphviz/cve-2014-9157.patch b/pkgs/tools/graphics/graphviz/cve-2014-9157.patch
deleted file mode 100644
index 66ce496ca74..00000000000
--- a/pkgs/tools/graphics/graphviz/cve-2014-9157.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From https://lists.debian.org/debian-qa-packages/2014/12/msg00048.html , which
-seems to come from Ubuntu.
-
-Subject: Fix format string vulnerability (CVE-2014-9157) in yyerror() routine
-Origin: https://github.com/ellson/graphviz/commit/99eda421f7ddc27b14e4ac1d2126e5fe41719081
-Author: Emden R. Gansner
-
----
- lib/cgraph/scan.l |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: b/lib/cgraph/scan.l
-===================================================================
---- a/lib/cgraph/scan.l
-+++ b/lib/cgraph/scan.l
-@@ -225,7 +225,7 @@
- 	agxbput (&xb, buf);
- 	agxbput (&xb, yytext);
- 	agxbput (&xb,"'\n");
--	agerr(AGERR,agxbuse(&xb));
-+	agerr(AGERR, "%s", agxbuse(&xb));
- 	agxbfree(&xb);
- }
- /* must be here to see flex's macro defns */
diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix
index ce864261c8b..48b1b0764c5 100644
--- a/pkgs/tools/graphics/graphviz/default.nix
+++ b/pkgs/tools/graphics/graphviz/default.nix
@@ -1,69 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, libpng, libjpeg, expat
-, yacc, libtool, fontconfig, pango, gd, xorg, gts, libdevil, gettext, cairo
-, flex
-, ApplicationServices
-}:
-
-stdenv.mkDerivation rec {
+import ./base.nix rec {
+  rev = "stable_release_${version}";
   version = "2.40.1";
-  name = "graphviz-${version}";
-
-  src = fetchurl {
-    url = "http://www.graphviz.org/pub/graphviz/ARCHIVE/${name}.tar.gz";
-    sha256 = "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna";
-  };
-
-  hardeningDisable = [ "fortify" ];
-
-  patches = [ ];
-
-  buildInputs =
-    [ pkgconfig libpng libjpeg expat yacc libtool fontconfig gd gts libdevil flex pango
-    ] ++ stdenv.lib.optionals (xorg != null)
-      (with xorg; [ xlibsWrapper libXrender libXaw libXpm ])
-    ++ stdenv.lib.optionals (stdenv.isDarwin) [ ApplicationServices gettext ];
-
-  CPPFLAGS = stdenv.lib.optionalString (xorg != null && stdenv.isDarwin)
-    "-I${cairo.dev}/include/cairo";
-
-  configureFlags = stdenv.lib.optional (xorg == null) "--without-x";
-
-  postPatch = (stdenv.lib.optionalString stdenv.isDarwin ''
-    for foo in cmd/dot/Makefile.in cmd/edgepaint/Makefile.in \
-                    cmd/mingle/Makefile.in plugin/gdiplus/Makefile.in; do
-      substituteInPlace "$foo" --replace "-lstdc++" "-lc++"
-    done
-  '') + ''
-      substituteInPlace "plugin/xlib/vimdot.sh" --replace "/usr/bin/vim" "\$(command -v vim)"
-  '';
-
-  preBuild = ''
-    sed -e 's@am__append_5 *=.*@am_append_5 =@' -i lib/gvc/Makefile
-  '';
-
-  # "command -v" is POSIX, "which" is not
-  postInstall = stdenv.lib.optionalString (xorg != null) ''
-    sed -i 's|`which lefty`|"'$out'/bin/lefty"|' $out/bin/dotty
-    sed -i 's|which|command -v|' $out/bin/vimdot
-  '';
-
-  meta = {
-    homepage = http://www.graphviz.org/;
-    description = "Open source graph visualization software";
-
-    longDescription = ''
-      Graphviz is open source graph visualization software. Graph
-      visualization is a way of representing structural information as
-      diagrams of abstract graphs and networks. It has important
-      applications in networking, bioinformatics, software engineering,
-      database and web design, machine learning, and in visual
-      interfaces for other technical domains.
-    '';
-
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
-    maintainers = with stdenv.lib.maintainers; [ bjornfor raskin ];
-    downloadPage = "http://www.graphviz.org/pub/graphviz/ARCHIVE/";
-    inherit version;
-    updateWalker = true;
-  };
-}
+  sha256 = "1xjqq3g2n6jgwp5xzyvibgrxawlskkpam69fjjz9ksrrjas2qwzj";
+ }