3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/graphics/graphviz/base.nix
Will Dietz b906513cf5
graphviz: 2.40.1 -> 2.42.2
Little uncertain what's going on re:versions,
here's some info:

2.42.0 "Fixes quite a few bugs"[1], which is primary motivation.

[1] https://gitlab.com/graphviz/graphviz/blob/stable_release_2.42.0/ChangeLog

2.42.1 has a note in 2.42.2's ChangeLog[2] which is good but also
interesting as 2.42.2 doesn't have an entry in its own ChangeLog :).
FWIW there are two tags for 2.42.2 but happily they're equivalent.

While a bit verbose, the changes between these versions can be looked at
using git locally or a URL like one of these:

* https://gitlab.com/graphviz/graphviz/compare/stable_release_2.42.0...stable_release_2.42.2
* https://gitlab.com/graphviz/graphviz/compare/stable_release_2.40.1...stable_release_2.42.0

Anyway, looks like a bunch of bugfixes! :)
2019-10-07 17:58:09 -05:00

90 lines
2.8 KiB
Nix

{ rev, sha256, version }:
{ stdenv, fetchFromGitLab, autoreconfHook, pkgconfig, cairo, expat, flex
, fontconfig, gd, gettext, gts, libdevil, libjpeg, libpng, libtool, pango
, yacc, fetchpatch, xorg ? null, ApplicationServices ? null }:
assert stdenv.isDarwin -> ApplicationServices != null;
let
inherit (stdenv.lib) optional optionals optionalString;
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
patchToUse = if stdenv.lib.versionAtLeast version "2.37" then raw_patch else
stdenv.mkDerivation {
inherit (raw_patch) name;
buildCommand = "sed s/dot_root/agroot/g ${raw_patch} > $out";
};
# 2.42 has the patch included
patches = optional (stdenv.lib.versionOlder version "2.42") patchToUse;
in
stdenv.mkDerivation {
pname = "graphviz";
inherit 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
gettext
] ++ optionals (xorg != null) (with xorg; [ libXrender libXaw libXpm ])
++ optionals (stdenv.isDarwin) [ ApplicationServices ];
hardeningDisable = [ "fortify" ];
CPPFLAGS = stdenv.lib.optionalString (xorg != null && stdenv.isDarwin)
"-I${cairo.dev}/include/cairo";
configureFlags = [
"--with-ltdl-lib=${libtool.lib}/lib"
"--with-ltdl-include=${libtool}/include"
] ++ stdenv.lib.optional (xorg == null) [ "--without-x" ];
inherit patches;
postPatch = ''
for f in $(find . -name Makefile.in); do
substituteInPlace $f --replace "-lstdc++" "-lc++"
done
'';
# ''
# substituteInPlace rtest/rtest.sh \
# --replace "/bin/ksh" "${mksh}/bin/mksh"
# '';
doCheck = false; # fails with "Graphviz test suite requires ksh93" which is not in nixpkgs
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 ];
};
}