From: Karel Zak Date: Thu, 20 Mar 2025 12:15:26 +0000 (+0100) Subject: meson: fix po-man installation X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56b97db03a56d90f0480885a35b0383afabc2e18;p=thirdparty%2Futil-linux.git meson: fix po-man installation * in po-man/meson.build use already defined mandir * make sure $DESTDIR is used in the install script Addresses: https://github.com/util-linux/util-linux/pull/3378 Signed-off-by: Karel Zak --- diff --git a/po-man/meson.build b/po-man/meson.build index 7f7c3006f..7f702f466 100644 --- a/po-man/meson.build +++ b/po-man/meson.build @@ -33,6 +33,7 @@ foreach adoc : manadocs endforeach meson.add_install_script(meson.project_source_root() / 'tools/poman-install.sh', - '--mandir', get_option('mandir'), + '--force-destdir', + '--mandir', mandir, '--mansrcdir', meson.current_build_dir() / 'translations/man', manpages) diff --git a/tools/poman-install.sh b/tools/poman-install.sh index 0348dce83..a10bd07af 100755 --- a/tools/poman-install.sh +++ b/tools/poman-install.sh @@ -24,6 +24,7 @@ HEREDOC MANPAGES=() PROGRAM=$(basename "$0") MYCMD="install" +FORCE_DESTDIR=false while [[ $# -gt 0 ]]; do case $1 in @@ -31,6 +32,10 @@ while [[ $# -gt 0 ]]; do usage exit 0 ;; + --force-destdir) + FORCE_DESTDIR=true + shift + ;; --mandir) MANDIR="$2" shift @@ -61,6 +66,12 @@ while [[ $# -gt 0 ]]; do esac done +# Autotools automatically uses $DESTDIR in all paths, but Meson assumes that +# custom scripts will prefix the path. +if [ "$FORCE_DESTDIR" = true ]; then + MANDIR="${DESTDIR}/${MANDIR}" +fi + set -- "${MANPAGES[@]}" if [ ${#MANPAGES[@]} -eq 0 ]; then @@ -77,17 +88,13 @@ for LOCALEDIR in "$MANSRCDIR"/*/; do if [ "$MYCMD" = "install" ]; then PAGE="$LOCALEDIR/man$SECTION/$MANPAGE" if [ -f "$PAGE" ]; then - if [ -z ${MESON_INSTALL_QUIET+x} ]; then - echo "Installing $PAGE to ${MANDIR}/$LOCALE/man$SECTION" - fi + echo "Installing $PAGE to ${MANDIR}/$LOCALE/man$SECTION" mkdir -p "${MANDIR}/$LOCALE/man$SECTION" install -m 644 "$PAGE" "${MANDIR}/$LOCALE/man$SECTION" fi elif [ "$MYCMD" = "uninstall" ]; then - if [ -z ${MESON_INSTALL_QUIET+x} ]; then - echo "Uninstalling ${MANDIR}/$LOCALE/man$SECTION/$MANPAGE" - fi + echo "Uninstalling ${MANDIR}/$LOCALE/man$SECTION/$MANPAGE" rm -f "${MANDIR}/$LOCALE/man$SECTION/$MANPAGE" fi