do not create packaging hierarchy directory for architecture
The packaging directories were created based on various dimensions of a matrix,
with architecture at the lowest level. On Linux and macOS, Graphviz is only
packaged for a single architecture (x86-64). On Windows, Graphviz is only
packaged for two architectures (x86 and x86-64). However, the architecture is
also present in the suffix of every packaged file. E.g.
So there is no ambiguity if we drop the architecture directory. This seems to be
a case of YAGNI¹ where the system was setup to accommodate multiple
architectures but this has not been needed. We remove it now to (1) reduce
complexity and (2) have less verbose release filenames.²
Closes #2149.
¹ https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
² Example of a current verbose release filename,
stable_windows_10_cmake_Release_Win32_graphviz-install-2.49.3-win32.exe
Upcoming changes will add references to functions that are in libgvc. Note that
no changes are required to the MSBuild build system because it already links
Smyrna against libgvc.
gvconfig_libdir: fix const-correctness of char pointers in macOS code
Commit 284df35236e258a49b86fad6f0d062bf0c2fa840 changed the source pointer `tmp`
used here to be `const`. A side effect of this was introducing a warning
breaking the CMake build on macOS:
lib/gvc/gvconfig.c:329:10: error: initializing 'char *' with an expression of
type 'const char *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
char* s = tmp-1;
^ ~~~~~
This commit was merged via !2231 whose source branch did not have permission to
use the macOS shared runners, so this issue was not caught in pre-merge CI.
A build system should not rely on the existence of 3rd party
library/header files in standard prefixes as one might want to compile
and link against a patched build or a custom install in some
non-standard location. This is also helpful for developers who rely on
package managers like Conda or Spack for their daily development.
If expat is a dep, we need to pass -I/path/containing/expat.h to the
compiler while compiling the source files of the target 'common_obj',
without which, one can face the following issue:
graphviz/lib/common/htmllex.c:28:10: fatal error: expat.h: No such file or directory
28 | #include <expat.h>
| ^~~~~~~~~
compilation terminated.
remove leading debian/changelog entries related to unreleased versions
As far as I can tell, this style of specifying `(@VERSION@-1)` as the Debian
package version is intended to allow the CI work flow to install an unreleased
DEB file. This works but:
1. The current list uses this identifier twice. Presumably commit 57337e45d04ceecc3273f7f0d9e6a2440f8128cb made a mistake in introducing a
new version instead of appending the changelog entry to the existing
(pending) top entry. The result is that any attempt to use this changelog
for actual packaging would be rejected due to two changelog sections for
the same version.
2. The Ubuntu Intrepid (8.10) package search functionality appears to have
been lost to the sands of time, but all recent Graphviz Ubuntu and Debian
packages have been produced by third-party volunteers external to Graphviz.
The two leading entries gave the false impression that recent Graphviz
Debian/Ubuntu packages are actually produced here. To avoid this going
forwards we retarget this to Bionic (the lowest version of Ubuntu we
support) and add an artificial entry indicating this is not meant to be
released.
3. There have been numerous changes in the era of these top two entries as
well as more recently. It is not clear to me why these two changes were
singled out for the changelog. Running the Debian packaging flow resulted
in a changelog indicating these two items are the only changes between
2.18-1ubuntu5 and 2.49.3.
Ben Hansell [Mon, 18 Oct 2021 17:02:46 +0000 (17:02 +0000)]
lib/common: add character width lookup tables for more fonts and variants
This allows Graphviz to estimate the widths of text spans more accurately when built without a textlayout plugin. The textlayout plugins are platform-specific and can be difficult to build for obscure platforms (e.g. Graphviz Online), resulting in node labels not fitting within their nodes nicely.
lib/common: add new source file and header
lib/common: don't install new header
lib/common: redesign hard-coded font metrics
lib/common: remove unused variables
lib/common: format new source file with clang-format
lib/common: add more fonts
lib/common: add warning spam guards
lib/common: improve code style and comments
lib/common: improve code style and comments
lib/common: fix const compiler error
lib/common: reuse existing isalpha_no_locale function
lib/common: fix another const compilation error
lib/common: fix yet another const compilation error
VML plugin: replace 'gvputs(… html_string(…))' with 'xml_escape' functionality
This is further work towards unifying the XML escaping code (#1868). This change
has no functional impact but makes this processing slightly more efficient
(escaped text is emitted directly into the target file/stream instead of first
constructed in an intermediate buffer) and thread safe (a static buffer is no
longer used for escaping). The latter is not so significant as other factors
make it still unsafe to call into this plugin with multiple threads.
This functionality was previously indirectly tested through some other graph
processing that uses escaping. However, this introduces some unit testing of
this function giving us an extra safe guard and an easier way to diagnose
problems with this functionality.
xml_core: support a mode for escaping UTF-8 characters
This is modeled after `html_string` in the VML plugin and intended to replace
that function in a future commit. It differs from `html_string` in the following
ways:
* More limited unicode character detection. `html_string` has a very
generalized notion of a valid character that extends to lengths beyond what
UTF-8 allows. This new implementation in `xml_core` adheres more strictly to
only valid UTF-8 character lengths.
* Simpler character parsing. `html_string` is written in a style to (1) decode
character byte length without branching and (2) use the outer loop to also
loop over the UTF-8 character’s bytes. This new implementation in `xml_core`
uses simpler, more obvious code for decoding the byte length and consumes
more than one character of the input instead of reusing the outer loop. This
code is not on a hot path and it is not necessary or helpful to
micro-optimize the control flow.
* Hex escapes instead of decimal escapes. `html_string` uses `&#[0-9]+;`
escapes while this new implementation uses `&#x[0-9a-f]+;` escapes. For
many characters, this results in a shorter sequence. A compiler that knows
`snprintf` as a built-in (all recent GCC and Clang) should also be able to
generate a hex escape without using any division operations.
Note that nothing yet uses this functionality; all existing calls that go
through this code have the `utf8` flag unset.
This code aborts on encountering an invalid UTF-8 character. This is not ideal,
but matches `html_string`’s error handling. Perhaps this can be improved in
future.
xml_core: update input pointer to reflect how many characters were consumed
This has no immediate effect because the function only ever consumes a single
character. However, a future change will introduce more sophisticated escaping
that sometimes involves consuming more than one character from the input.