]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: fix po-man installation
authorKarel Zak <kzak@redhat.com>
Thu, 20 Mar 2025 12:15:26 +0000 (13:15 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Mar 2025 12:25:54 +0000 (13:25 +0100)
* 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 <kzak@redhat.com>
po-man/meson.build
tools/poman-install.sh

index 7f7c3006fb8f0e69d7bca92109bc840322e9cf96..7f702f466f7a59360676c8a7f8c8101cfd2e50ed 100644 (file)
@@ -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)
index 0348dce83b48f25eef3033a41f0d78ed659b9af4..a10bd07af239aabbbaade18ec201fe165a480042 100755 (executable)
@@ -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