diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix index 7308ee9a479f..643de951e009 100644 --- a/pkgs/tools/graphics/graphviz/default.nix +++ b/pkgs/tools/graphics/graphviz/default.nix @@ -4,6 +4,7 @@ fetchFromGitLab, autoreconfHook, pkg-config, + buildPackages, cairo, expat, flex, @@ -15,6 +16,7 @@ libtool, makeWrapper, pango, + runCommand, bash, bison, libxrender, @@ -35,14 +37,14 @@ let optionalAttrs ; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "graphviz"; version = "12.2.1"; src = fetchFromGitLab { owner = "graphviz"; repo = "graphviz"; - rev = version; + rev = finalAttrs.version; hash = "sha256-Uxqg/7+LpSGX4lGH12uRBxukVw0IswFPfpb2EkLsaiI="; }; @@ -77,6 +79,7 @@ stdenv.mkDerivation rec { ++ optional false "--without-x"; enableParallelBuilding = true; + strictDeps = true; env = optionalAttrs (withXorg && stdenv.hostPlatform.isDarwin) { CPPFLAGS = "-I${cairo.dev}/include/cairo"; @@ -88,6 +91,19 @@ stdenv.mkDerivation rec { ./autogen.sh ''; + # Invoke `dot -c` even while cross compiling else lib/graphviz/config6 will not load at runtime. + postPatch = '' + substituteInPlace cmd/dot/Makefile.am --replace-fail \ + 'if test "x$(DESTDIR)" = "x" -a "x$(build)" = "x$(host)"; then if test -x $(bindir)/dot$(EXEEXT); then if test -x /sbin/ldconfig; then /sbin/ldconfig 2>/dev/null; fi; cd $(bindir); ./dot$(EXEEXT) -c; else cd $(bindir); ./dot_static$(EXEEXT) -c; fi; fi' \ + '${lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' + if test -x $(bindir)/dot$(EXEEXT); then \ + cd $(bindir); ${stdenv.hostPlatform.emulator buildPackages} ./dot$(EXEEXT) -c; \ + else \ + cd $(bindir); ${stdenv.hostPlatform.emulator buildPackages} ./dot_static$(EXEEXT) -c; \ + fi + ''}' + ''; + postFixup = optionalString withXorg '' substituteInPlace $out/bin/vimdot \ --replace-warn '"/usr/bin/vi"' '"$(command -v vi)"' \ @@ -109,6 +125,14 @@ stdenv.mkDerivation rec { fltk graphicsmagick ; + dot-can-load-plugins = + runCommand "dot-can-load-plugins" + { + nativeBuildInputs = [ finalAttrs.finalPackage ]; + } + '' + dot -P -o $out + ''; }; meta = { @@ -121,4 +145,4 @@ stdenv.mkDerivation rec { raskin ]; }; -} +})