2017-12-16 00:33:52 +00:00
|
|
|
{ rev, sha256, version }:
|
|
|
|
|
|
|
|
{ stdenv, fetchFromGitLab, autoreconfHook, pkgconfig, cairo, expat, flex
|
|
|
|
, fontconfig, gd, gettext, gts, libdevil, libjpeg, libpng, libtool, pango
|
2018-09-23 17:22:53 +01:00
|
|
|
, yacc, fetchpatch, xorg ? null, ApplicationServices ? null }:
|
2017-12-16 00:33:52 +00:00
|
|
|
|
|
|
|
assert stdenv.isDarwin -> ApplicationServices != null;
|
|
|
|
|
|
|
|
let
|
2019-09-18 07:45:08 +01:00
|
|
|
inherit (stdenv.lib) optional optionals optionalString;
|
2018-09-23 17:22:53 +01:00
|
|
|
raw_patch =
|
|
|
|
# https://gitlab.com/graphviz/graphviz/issues/1367 CVE-2018-10196
|
|
|
|
fetchpatch {
|
|
|
|
name = "CVE-2018-10196.patch";
|
|
|
|
url = https://gitlab.com/graphviz/graphviz/uploads/30f8f0b00e357c112ac35fb20241604a/p.diff;
|
|
|
|
sha256 = "074qx6ch9blrnlilmz7p96fkiz2va84x2fbqdza5k4808rngirc7";
|
|
|
|
excludes = ["tests/*"]; # we don't run them and they don't apply
|
|
|
|
};
|
|
|
|
# the patch needs a small adaption for older versions
|
2019-09-18 07:45:08 +01:00
|
|
|
patchToUse = if stdenv.lib.versionAtLeast version "2.37" then raw_patch else
|
2018-09-23 17:22:53 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit (raw_patch) name;
|
|
|
|
buildCommand = "sed s/dot_root/agroot/g ${raw_patch} > $out";
|
|
|
|
};
|
2019-09-18 07:45:08 +01:00
|
|
|
# 2.42 has the patch included
|
|
|
|
patches = optional (stdenv.lib.versionOlder version "2.42") patchToUse;
|
2017-12-16 00:33:52 +00:00
|
|
|
in
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "graphviz";
|
|
|
|
inherit version;
|
2017-12-16 00:33:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "graphviz";
|
|
|
|
repo = "graphviz";
|
|
|
|
inherit sha256 rev;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libpng libjpeg expat yacc libtool fontconfig gd gts libdevil flex pango
|
2018-03-14 22:58:20 +00:00
|
|
|
gettext
|
2017-12-16 00:33:52 +00:00
|
|
|
] ++ optionals (xorg != null) (with xorg; [ libXrender libXaw libXpm ])
|
2018-03-14 22:58:20 +00:00
|
|
|
++ optionals (stdenv.isDarwin) [ ApplicationServices ];
|
2017-12-16 00:33:52 +00:00
|
|
|
|
|
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
|
|
|
|
CPPFLAGS = stdenv.lib.optionalString (xorg != null && stdenv.isDarwin)
|
|
|
|
"-I${cairo.dev}/include/cairo";
|
|
|
|
|
2018-02-05 20:25:43 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-ltdl-lib=${libtool.lib}/lib"
|
|
|
|
"--with-ltdl-include=${libtool}/include"
|
2019-11-20 09:17:54 +00:00
|
|
|
] ++ stdenv.lib.optional (xorg == null) "--without-x";
|
2017-12-16 00:33:52 +00:00
|
|
|
|
2019-09-18 07:45:08 +01:00
|
|
|
inherit patches;
|
2018-09-23 17:22:53 +01:00
|
|
|
|
2017-12-16 00:33:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
for f in $(find . -name Makefile.in); do
|
|
|
|
substituteInPlace $f --replace "-lstdc++" "-lc++"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2018-04-25 04:20:18 +01:00
|
|
|
# ''
|
|
|
|
# substituteInPlace rtest/rtest.sh \
|
|
|
|
# --replace "/bin/ksh" "${mksh}/bin/mksh"
|
|
|
|
# '';
|
|
|
|
|
|
|
|
doCheck = false; # fails with "Graphviz test suite requires ksh93" which is not in nixpkgs
|
|
|
|
|
2017-12-16 00:33:52 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|