David Seifert [Sun, 17 Apr 2022 10:53:37 +0000 (12:53 +0200)]
Simplify PDF generation
* Make the suffix rule visible unconditionally, make only the PDF
target (`pdf_DATA`) visible if `groff` is available and the user
hasn't explicitly disabled PDF generation.
This exit wrapper works around an issue where processes running under MinGW can
exit with unbuffered data remaining in their stdout and stderr internal buffers
without being flushed. The C stdio and C++ iostreams implementations can have
separate buffers. Thus when using this wrapper in C++ code in combination with
C++ iostreams (e.g. cmd/mingle/minglemain.cpp) we need to additionally flush the
C++ buffers as well.
gvgen: replace inline stack with generation implementation
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This also introduces some missing allocation failure checks.
sccmap: replace inline stack with generation implementation
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This also introduces some missing allocation failure checks.
Without this change, attempting to include geomproc.h in render.h
would cause the following warning:
In file included from /home/magjac/graphviz/lib/common/shapes.c:12:
/home/magjac/graphviz/lib/common/render.h:24: warning: "__USE_GNU" redefined
24 | #define __USE_GNU
|
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/limits.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/11/include/limits.h:203,
from /usr/lib/gcc/x86_64-linux-gnu/11/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/11/include/limits.h:34,
from /home/magjac/graphviz/lib/common/arith.h:21,
from /home/magjac/graphviz/lib/common/geom.h:16,
from /home/magjac/graphviz/lib/common/geomprocs.h:21,
from /home/magjac/graphviz/lib/common/shapes.c:11:
/usr/include/features.h:407: note: this is the location of the previous definition
407 | # define __USE_GNU 1
|
This is casued by arith.h defining _GNU_SOURCE to 1 which seems to
implicitly set __USE_GNU.
gml2gv: replace 'liststk' stack with generic implementation
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This also introduces some missing allocation failure checks.
graphml2gv: replace custom 'slist' string stack with generic stack
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. Apart from reducing code duplication and complexity, this
removes an unnecessary rounding of allocations. The prior code rounded up
`slist` allocations to `sizeof(void*)`, but `malloc` effectively does this
internally anyway.
graphml2gv: replace inline stack implementation with generic API
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This removes the previously hard coded nested subgraph limit of
32. The number of supported subgraphs in now solely limited by available memory.
bcomps: replace inline stack implementation with generic API
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation.
David Seifert [Sat, 16 Apr 2022 16:00:18 +0000 (18:00 +0200)]
Define `$(pkgconfigdir)` using `PKG_INSTALLDIR` in configure.ac
* This allows overriding the default using `--with-pkgconfigdir`
passed to the configure script. FreeBSD for instance doesn't use
the standard `$libdir/pkgconfig` directory. This macro has been
present in pkg.m4 for over 9 years:
https://gitlab.freedesktop.org/pkg-config/pkg-config/-/commit/5fc77a96b7a1114e296f968037342f060d4bc34b
David Seifert [Sat, 16 Apr 2022 16:00:18 +0000 (18:00 +0200)]
`$(txtdir)` -> `$(docdir)`
* All documentation directories should be a function of `$(docdir)`, and
not `$(datadir)`, which is to be used for files that the program
actually needs at runtime.
* Also amend the debian install rules, since documentation is now
natively installed into `$(docdir)` == `usr/share/doc/graphviz`.
David Seifert [Sat, 16 Apr 2022 16:00:18 +0000 (18:00 +0200)]
Let Autoconf set `$(htmldir)`
* The previous variable would not respect `--docdir` passed to configure.
Autoconf sets `$(htmldir)` to `$(docdir)` by default and AC_SUBST()s
this value.
David Seifert [Sat, 16 Apr 2022 16:00:18 +0000 (18:00 +0200)]
Let Autoconf set `$(pdfdir)`
* The previous variable would not respect `--docdir` passed to configure.
Autoconf sets `$(pdfdir)` to `$(docdir)` by default and AC_SUBST()s
this value.
tred: [nfc] replace inline stack implementation with generic API
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation.
David Seifert [Thu, 14 Apr 2022 08:23:49 +0000 (10:23 +0200)]
Prefer `dist_` prefix over `EXTRA_DIST`
* `dist_` expresses the clear intent for files to be distributed along in the tarball:
https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
David Seifert [Thu, 14 Apr 2022 08:23:49 +0000 (10:23 +0200)]
Use Autoconf recommended path quoting
* `-DDATADIR='"$(datadir)"'` is less error-prone than `-DDATADIR=\""$(datadir)"\"`
since the shell will handle the correct escaping of the double quotes:
https://www.gnu.org/software/autoconf/manual/autoconf-2.71/html_node/Defining-Directories.html
ccomps: replace inline stack implementation with generic API
Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation.
To further reinforce this, it is worth observing that they were not usable in
the CMake build system. 5b620771b7e5f07529ff7a41177ae27048c91865, despite
correcting an absence of sprint.h, failed to also correct the absence of
sprint.c. Any attempt to use these functions resulted in link failures in the
CMake build.
CMake: fix: use a relative 'DATA_INSTALL_DIR' on non-Linux
Some installers like NSIS on Windows do not allow absolute paths in installation
destinations. This is already followed in e.g. `BINARY_INSTALL_DIR`, but
`DATA_INSTALL_DIR` was using an absolute path. This issue was not detected
because this is currently only used in Smyrna which is not enabled on Windows in
CI. But an upcoming commit enables general example installation, which exposes
this issue.