When processing characters in attribute values that should be escaped (e.g.
`"`), `gv2gml` would emit these as-is, resulting in invalid GML output. Such
attribute values are now correctly XML-escaped.
lib/common: move XML functions to a separate source file
Symbol resolution during linking is done on a per-file basis. Thus any use of a
function from labels.c was requiring all functions in labels.c to have their
symbols resolved. This is probably one of the partial causes of the
proliferation of duplicate XML escaping code (#1868).
This commit splits the XML escaping code into a separate file, allowing it to be
used without also requiring dependencies of unrelated functions in labels.c to
be satisfied. In the specific case motivating this, this will enable `gv2gml` to
call these XML escaping functions without linking against libcdt and libgvc.
For the above explained linking reasons, in future it may be desirable to
further separate library functions at an even finer grained basis than done in
this commit.
This has no immediate effect. However an upcoming change will introduce a header
include that brings in another 'path' symbol. So this change pre-emptively
squashes the -Wshadow compiler warning that would otherwise be introduced.
gv2gml: rename 'Agnodeinfo_t' type to 'Local_Agnodeinfo_t'
This has no immediate effect, but having a type named `Agnodeinfo_t` prevents
including lib/common/types.h which has its own `Agnodeinfo_t`. We will want to
include this header (transitively) in an upcoming commit.
adjust the release process to not require gen_version.py tweaks
This change has two primary motivations:
1. Streamlining the release steps and reducing the opportunities for human
error; and
2. Improving clarity in the release artifacts.
Following this change, no edits are required to gen_version.py in order to cut
a new release. The Graphviz version – both inter-release and for releases
themselves – is derived exclusively from CHANGELOG.md. The effect of this is
expected to be:
1. Cleaner release commits. No more regular churn of gen_version.py.
2. More obvious CHANGELOG.md in the release artifacts. This file will no
longer have a spurious “[Unreleased]” heading preceding the actual
changelog for the release.
There was the option to remove the first duplicate or the second in this file. I
checked that none of the intervening includes depended on a `_BB` definition. It
seemed clearer to remove the first and indicate that only Smyrna itself is using
`_BB`.
toggle Lefty to disabled by default in the Autotools build system
Based on a discussion that Lefty should be deprecated,¹ this takes the first
step towards removing it. It is hoped that by disabling it by default, this will
expose any downstream consumers who are relying on it being built by default.
If there are no complaints within three months, I think we can then remove build
system support entirely. If another three months pass without noise, I think we
can then remove Lefty sources from Graphviz.
In case the linked discussion is inaccessible when reading this commit message,
the summary from Stephen was:
Lefty was an early interpreter for graphics programming. It’s from about 1990
or 91, and we used it as the basis for a scriptable graphviz viewer, dotty.
It was student code written by Lefteris Koutsofios. I thought there was some
C code for parsing graphs but I could be wrong.
Even libast came into the picture much later, but I suppose that was done to
clean up some of its OS dependencies or to make it more portable or robust in
some way.
Magnus Jacobsson [Tue, 14 Sep 2021 14:27:04 +0000 (16:27 +0200)]
common: unify diverged storage-class attributes in globals.h
The immediate reason for this commit is to fix a bug when using the
autools build system with Cygwin, described below, but it is also a
step towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545.
This file had one set of Windows-specific storage-class attribute
declarations intended for use with the autotools build system and one
set intended for use with Visual Studio, with slightly different
control mechanisms.
It's unclear what effect changes made to these control mechanisms over
the years has had on the many operating systems that are not tested in
CI. The current state is that they partly overlap and are very hard to
understand.
This commit cleans this up by applying such declarations only if the
GVDLL or the WIN32_DLL symbol is set. An export declaration is used if
either the GVC_EXPORT or the _BLD_GVC symbol is defined and an import
declaration otherwise.
Using both GVDLL and WIN32_DLL for the same purpose is a temporary
measure and will be replaced by only one symbol in an upcoming commit
series towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545.
Since https://gitlab.com/graphviz/graphviz/-/merge_requests/2182,
setting GVDLL is the preferred single mechanism to enable those
attributes, rather than using _WIN32 and __CYGWIN__ plus some other
symbol to distinguish between static and dynamic-link/shared
libraries.
Likewise is the use of both GVC_EXPORT and _BLD_gvc for the same
purpose a temporary measure, which will be replaced by only one symbol
in an upcoming commit series towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545.
This fixes a segmentation fault when running 'dot -c' during 'make install' on Cygwin.
Debugging with gdb showed that this happened on line 99 in dot.c:
GvExitOnUsage = 1;
Magnus Jacobsson [Tue, 14 Sep 2021 18:06:19 +0000 (20:06 +0200)]
cmd/edgepaint: MSBuild: define GVDLL in the project file
Without this change, an upcoming commit in this series that unites the
storage class attributes in lib/common/globals.h that have diverged
for different build systems, would cause edgepaint to generate a
segmentation fault (error code 3221225477 = 0xC0000005: access
violation) when started on native Windows.
Also towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545.
Magnus Jacobsson [Mon, 13 Sep 2021 15:11:21 +0000 (17:11 +0200)]
gvc: autotools: work around cygwin linking problem with .def file
This workaround is just a temporary measure until an upcoming commit
series towards https://gitlab.com/graphviz/graphviz/-/issues/2058 will
remove the .def file.
Fixes this error with Cygwin when running 'dot -c' during installation.
C:/Users/magja/graphviz/build/bin/dot.exe: error while loading shared libraries: gvc.dll: cannot open shared object file: No such file or directory
Before this commit, the following results were obtained:
Magnus Jacobsson [Sat, 11 Sep 2021 10:30:06 +0000 (12:30 +0200)]
cmd/dot: autotools: cd to bin dir before running dot -c
Fixes this error with Cygwin:
C:/GitLab-Runner/builds/magjac/graphviz/build/bin/dot.exe: error while loading shared libraries: cygcgraph-6.dll: cannot open shared object file: No such file or directory
Magnus Jacobsson [Sun, 22 Aug 2021 06:40:28 +0000 (08:40 +0200)]
ortho: autotools: set also GVC_EXPORTS
The immediate reason for this change is to correct the
Microsoft-specfic storage-class attributes in autotools builds with
Cygwin.
The object modules from the static ortho lib is statically linked into
the gvc shared lib which means that its symbols should be exported
from gvc instead of imported.
This is the second and final step in fixing these errors in autotools
builds with Cygwin:
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: ../../lib/dotgen/.libs/libdotgen_C.a(dotsplines.o): in function `_dot_splines':
/home/magja/graphviz/lib/dotgen/dotsplines.c:334: undefined reference to `__imp_orthoEdges'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: /home/magja/graphviz/lib/dotgen/dotsplines.c:337: undefined reference to `__imp_orthoEdges'
The _BLD_gvc symbol is used for basically the same purpose as
GVC_EXPORTS. Using both is a temporary measure until an upcoming
commit series towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545
cleans up the control of the Windows specific storage-class attributes
Magnus Jacobsson [Sun, 22 Aug 2021 08:45:11 +0000 (10:45 +0200)]
ortho: use GVDLL instead of _WIN32 to enable storage-class attributes
The immediate reason for this change is to enable Windows-specific
storage-class attributes for autotools builds with Cygwin. The _WIN32
symbol is not defined when using Cygwin.
Since https://gitlab.com/graphviz/graphviz/-/merge_requests/2182,
setting GVDLL is the preferred single mechanism to enable those
attributes, rather than using _WIN32 and __CYGWIN__ plus some other
symbol to distinguish between static and dynamic-link/shared
libraries.
This is the first step of two in fixing these errors in autotools
builds with Cygwin:
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: ../../lib/dotgen/.libs/libdotgen_C.a(dotsplines.o): in function `_dot_splines':
/home/magja/graphviz/lib/dotgen/dotsplines.c:334: undefined reference to `orthoEdges'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: /home/magja/graphviz/lib/dotgen/dotsplines.c:337: undefined reference to `orthoEdges'
The Windows-specific storage-class attributes are however still not
correct for Cygwin autotools builds, since GVC_EXPORT is currently not
set in the autotools builds. The error is now instead:
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: ../../lib/dotgen/.libs/libdotgen_C.a(dotsplines.o): in function `_dot_splines':
/home/magja/graphviz/lib/dotgen/dotsplines.c:334: undefined reference to `__imp_orthoEdges'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: /home/magja/graphviz/lib/dotgen/dotsplines.c:337: undefined reference to `__imp_orthoEdges'
The next commit in this series will fix this.
Also towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545
Without this change, an upcoming commit in this series that will use
GVDLL instead of _WIN32 to enable Microsoft-specific storage-class
attributes would cause this error:
neatogen.lib(neatosplines.obj) : error LNK2019: unresolved external symbol _orthoEdges referenced in function __spline_edges [C:\GitLab-Runner\builds\magjac\graphviz\plugin\neato_layout\gvplugin_neato_layout.vcxproj]
Since https://gitlab.com/graphviz/graphviz/-/merge_requests/2182,
setting GVDLL is the preferred single mechanism to enable
Microsoft-specific storage-class attributes.
Also towards
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545