2023-12-18 09:45:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
ensure_var_path() {
|
|
|
|
if [ "${!1}" = "" ]; then
|
|
|
|
echo "$0: Required variable $1 is not set, aborting" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "${!1}" ]; then
|
|
|
|
echo "$0: Path '${!1}' in $1 does not exist or is not directory, aborting" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$MESON_BUILD_ROOT" = "" ]; then
|
|
|
|
if [ "$1" = "--build-root" ]; then
|
|
|
|
MESON_BUILD_ROOT="$2"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
ensure_var_path "MESON_DIST_ROOT"
|
|
|
|
ensure_var_path "MESON_BUILD_ROOT"
|
|
|
|
|
|
|
|
ninja -C "$MESON_BUILD_ROOT" all libnm-doc NetworkManager-doc
|
|
|
|
|
meson: exclude intermediate files of docs generation from tarball
We want to distribute the generated documentation when we generate the
tarball because we normally do it when we do a release, but `meson dist`
only includes files that are commited to the repository, so a script
meson-dist-data.sh was added with meson.add_dist_script in commit
1c41066a40d9 ('build: include documentation in meson dist').
This script was copying the whole documentation folders, including some
intermediate files that are not useful for users that wants to read the
docs. Get rid of them and copy only the files that are useful for users:
the generated html pages in docs/api and docs/libnm and the final man
pages.
Also, including these intermediate files caused at least one build
failure, although quite difficult to reproduce:
- Generate tarball with meson
- Untar the generated tarball
- Using the sources from the tarball, configure the project with
autotools, but building to an out-of-tree folder, not building in
the source dir (i.e. using a 'build' subfolder). This is called
a "VPATH build" by autotools and Make. See:
- https://www.gnu.org/software/make/manual/html_node/General-Search.html
- https://www.gnu.org/software/automake/manual/html_node/VPATH-Builds.html
- Build
In that scenario, we get an error trying to generate any file under man/
because the man/ subdirectory has not been created. The reason of this
was that the man/ subdirectory is created by the Makefile when
generating the file man/common.ent. However, this file was present in
the source directory because it has been included in the tarball, so
Make detects it and doesn't run the rules to generate it. The result is
that out-of-tree-dir/man folder is not created.
Not including the intermediate files solves this problem.
Fixes: 1c41066a40d9 ('build: include documentation in meson dist')
2024-03-25 15:03:33 +00:00
|
|
|
cp -Tr "$MESON_BUILD_ROOT/docs/api/html" "$MESON_DIST_ROOT/docs/api/html"
|
|
|
|
cp -Tr "$MESON_BUILD_ROOT/docs/libnm/html" "$MESON_DIST_ROOT/docs/libnm/html"
|
|
|
|
cp "$MESON_BUILD_ROOT/man/"*.[1-8] "$MESON_DIST_ROOT/man"
|