depot/third_party/nixpkgs/pkgs/tools/graphics/graphviz/default.nix
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00

110 lines
2 KiB
Nix

{ lib
, stdenv
, fetchFromGitLab
, autoreconfHook
, pkg-config
, cairo
, expat
, flex
, fontconfig
, gd
, gts
, libjpeg
, libpng
, libtool
, pango
, bash
, bison
, xorg
, ApplicationServices
, Foundation
, python3
, withXorg ? true
# for passthru.tests
, exiv2
, fltk
, graphicsmagick
}:
let
inherit (lib) optional optionals optionalString;
in
stdenv.mkDerivation rec {
pname = "graphviz";
version = "12.1.1";
src = fetchFromGitLab {
owner = "graphviz";
repo = "graphviz";
rev = version;
hash = "sha256-r4V0iX+7169QG7nW2RjoUfrDh11zm6zdvtGt4E91kIE=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
python3
bison
flex
];
buildInputs = [
libpng
libjpeg
expat
fontconfig
gd
gts
pango
bash
] ++ optionals withXorg (with xorg; [ libXrender libXaw libXpm ])
++ optionals stdenv.hostPlatform.isDarwin [ ApplicationServices Foundation ];
hardeningDisable = [ "fortify" ];
configureFlags = [
"--with-ltdl-lib=${libtool.lib}/lib"
"--with-ltdl-include=${libtool}/include"
] ++ optional (xorg == null) "--without-x";
enableParallelBuilding = true;
CPPFLAGS = optionalString (withXorg && stdenv.hostPlatform.isDarwin)
"-I${cairo.dev}/include/cairo";
doCheck = false; # fails with "Graphviz test suite requires ksh93" which is not in nixpkgs
preAutoreconf = ''
./autogen.sh
'';
postFixup = optionalString withXorg ''
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 \
'';
passthru.tests = {
inherit (python3.pkgs)
graphviz
pydot
pygraphviz
xdot
;
inherit
exiv2
fltk
graphicsmagick
;
};
meta = with lib; {
homepage = "https://graphviz.org";
description = "Graph visualization tools";
license = licenses.epl10;
platforms = platforms.unix;
maintainers = with maintainers; [ bjornfor raskin ];
};
}