NetworkManager/tools/meson-dist-data.sh
Íñigo Huguet 67eb8c5c2b CI: fix meson tarball testing with old meson version
The test "tarball+meson" fails on systems with old meson version with
the message "ERROR: Neither directory contains a build file
meson.build". This message is raised when calling `meson dist` from the
build directory.

According to meson documentation, `meson dist` is supported since 0.52,
and older vesions need to execute `ninja dist`.
https://mesonbuild.com/Creating-releases.html

Also, when using meson.add_dist_script, the env variable MESON_SOURCE_ROOT
is not passed in versions < 0.54. As we don't use it in the script,
don't assert for it.

We claim to support down to meson 0.47.3 (we need to raise it because we
are actually using a bit newer features, but that's another topic). Use
`ninja dist` that will work fine on old and new meson.

Fixes: 61f0531509 ('gitlab-ci: test re-buildability of distribution tarballs')
2024-04-04 08:17:26 +02:00

30 lines
745 B
Bash
Executable file

#!/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
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"