|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2025 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | + |
| 14 | +# This BUILD file is injected into the @graphviz_deb external repository by the |
| 15 | +# download_deb rule. It exposes the cmake-built graphviz binaries and their |
| 16 | +# bundled shared libraries. |
| 17 | +# |
| 18 | +# == Use case == |
| 19 | +# We use graphviz exclusively to render the LOBSTER tracing-policy diagram as |
| 20 | +# SVG inside Sphinx (sphinx.ext.graphviz, -Tsvg, dot layout algorithm). |
| 21 | +# |
| 22 | +# == Plugins activated for our use case == |
| 23 | +# Only two of the bundled plugins are activated at runtime for -Tsvg + dot layout: |
| 24 | +# libgvplugin_core.so.6 — SVG/PS/JSON renderer ("render: svg:core") |
| 25 | +# libgvplugin_dot_layout.so.6 — Hierarchical "dot" layout algorithm |
| 26 | +# |
| 27 | +# All other plugins in usr/lib/graphviz/ (pango, gd, neato_layout, vt, …) are |
| 28 | +# registered at startup from the config6 file and then loaded on demand. |
| 29 | +# For our -Tsvg + dot-layout use case they are never invoked; if their system |
| 30 | +# dependencies are absent, graphviz emits a warning but SVG output is unaffected. |
| 31 | +# |
| 32 | +# == System library dependencies == |
| 33 | +# The cmake deb bundles all graphviz-specific .so files so that `dot_builtins` |
| 34 | +# finds them via RUNPATH=$ORIGIN/../lib without a system graphviz installation. |
| 35 | +# The remaining system libraries are split by whether they are required for our |
| 36 | +# specific use case or only pulled in by unused plugins: |
| 37 | +# |
| 38 | +# Required by libgvplugin_core + libgvplugin_dot_layout (our actual use case): |
| 39 | +# libc.so.6 — C standard library (always present) |
| 40 | +# libm.so.6 — math library (always present) |
| 41 | +# libz.so.1 — zlib compression (always present: zlib1g) |
| 42 | +# libexpat.so.1 — XML/SVG parsing (always present: libexpat1) |
| 43 | +# libltdl.so.7 — plugin dynamic loader (libtool) (always present: libltdl7) |
| 44 | +# |
| 45 | +# Only required by unused plugins (pango/gd/neato_layout) — NOT needed for SVG: |
| 46 | +# libcairo.so.2 + libpixman-1.so.0 + libxcb*.so — raster/PDF rendering |
| 47 | +# (pango+gd plugins; pre-installed on Ubuntu 24.04) |
| 48 | +# libpango*.so + libfontconfig.so.1 + libfreetype.so.6 |
| 49 | +# + libharfbuzz.so.0 + libfribidi.so.0 + libthai.so.0 + libdatrie.so.1 |
| 50 | +# + libgraphite2.so.3 — font layout for PNG/PDF output |
| 51 | +# (pango plugin; pre-installed on Ubuntu 24.04) |
| 52 | +# libgd.so.3 + libjpeg.so.8 + libpng16.so.16 + libtiff.so.6 + libwebp.so.7 |
| 53 | +# + libheif.so.1 + libLerc.so.4 + libjbig.so.0 + libdeflate.so.0 |
| 54 | +# + libbrotli*.so + libzstd.so.1 + liblzma.so.5 + libsharpyuv.so.0 |
| 55 | +# — image-format decoders for PNG/GIF/JPEG output |
| 56 | +# (gd plugin; pre-installed on Ubuntu 24.04) |
| 57 | +# libgts-0.7.so.5 — graph triangulation |
| 58 | +# (neato_layout only; NOT needed for dot layout) |
| 59 | +# libglib-2.0.so.0 + libgio-2.0.so.0 + libgobject-2.0.so.0 |
| 60 | +# + libgmodule-2.0.so.0 + libffi.so.8 + libpcre2-8.so.0 |
| 61 | +# + libblkid.so.1 + libmount.so.1 + libselinux.so.1 |
| 62 | +# + libbsd.so.0 + libmd.so.0 — GLib/GIO stack (pango plugin transitive deps) |
| 63 | +# (pre-installed on Ubuntu 24.04) |
| 64 | +# libX11.so.6 + libXext.so.6 + libXrender.so.1 + libXpm.so.4 |
| 65 | +# + libXau.so.6 + libXdmcp.so.6 — X11 display (xlib/x11 output only) |
| 66 | +# (pre-installed on Ubuntu 24.04) |
| 67 | +# libstdc++.so.6 + libgcc_s.so.1 — C++ runtime (gd plugin) |
| 68 | +# (always present) |
| 69 | + |
| 70 | +package(default_visibility = ["//visibility:public"]) |
| 71 | + |
| 72 | +# The actual graphviz rendering binary (not the dot wrapper/launcher). |
| 73 | +# Uses RUNPATH $ORIGIN/../lib to find bundled shared libraries. |
| 74 | +filegroup( |
| 75 | + name = "dot_binary", |
| 76 | + srcs = ["usr/bin/dot_builtins"], |
| 77 | +) |
| 78 | + |
| 79 | +# Bundled graphviz shared libraries (libgvc, libcgraph, libcdt, libpathplan, libxdot). |
| 80 | +# These are found automatically by dot_builtins via RUNPATH $ORIGIN/../lib. |
| 81 | +filegroup( |
| 82 | + name = "core_libs", |
| 83 | + srcs = glob(["usr/lib/*.so*"]), |
| 84 | +) |
| 85 | + |
| 86 | +# Graphviz plugin shared libraries (libgvplugin_core, libgvplugin_dot_layout, etc.). |
| 87 | +# Loaded at runtime via libltdl; requires LTDL_LIBRARY_PATH=usr/lib/graphviz. |
| 88 | +filegroup( |
| 89 | + name = "plugin_libs", |
| 90 | + srcs = glob(["usr/lib/graphviz/*.so*"]), |
| 91 | +) |
| 92 | + |
| 93 | +# All graphviz files needed to run dot_builtins. |
| 94 | +filegroup( |
| 95 | + name = "all", |
| 96 | + srcs = [ |
| 97 | + ":core_libs", |
| 98 | + ":dot_binary", |
| 99 | + ":plugin_libs", |
| 100 | + ], |
| 101 | +) |
0 commit comments