commit: 3c8fbfeeddc40eeec86d8b749c6eb2eed8db7221
parent 597e574c657cadbbd673bfa27a06183b6041e6c5
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 2 Aug 2023 19:59:40 +0200
configure: Check and allow changing msgmerge and xgettext
Diffstat:
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/build.ninja b/build.ninja
@@ -9,10 +9,6 @@ rule po2mo
rule translate_manpage
command = po4a-translate --format man -M utf-8 --master badwolf.1 --po $in --localized $out
-rule msgmerge
- # touch: msgmerge doesn't always updates timestamps
- command = msgmerge --update --backup=off $out $in && touch $out
-
rule scour
command = mkdir -p "$$(dirname $out)" && scour --no-line-breaks --enable-id-stripping --remove-metadata $in $out
diff --git a/configure b/configure
@@ -44,6 +44,8 @@ Variables:
ED=BIN
LDFLAGS=OPTIONS
EXTRA_CFLAGS=OPTIONS
+ XGETTEXT=BIN
+ MSGMERGE=BIN
MANDOC=BIN
SHELLCHECK=BIN
FLAWFINDER=BIN
@@ -90,6 +92,8 @@ INKSCAPE="${INKSCAPE:-inkscape}"
CC="${CC:-cc}"
CFLAGS="${CFLAGS:--g -O2 -pie -fPIE}"
ED="${ED:-ed}"
+XGETTEXT="${XGETTEXT:-xgettext}"
+MSGMERGE="${MSGMERGE:-msgmerge}"
MANDOC="${MANDOC:-mandoc}"
SHELLCHECK="${SHELLCHECK:-shellcheck}"
FLAWFINDER="${FLAWFINDER:-flawfinder}"
@@ -157,6 +161,24 @@ else
MANDOC="true"
fi
+printf 'Checking %s command existance ...' "${XGETTEXT}"
+if command -v "${XGETTEXT}" >/dev/null ; is_ok
+then
+ :
+else
+ echo 'Warning: translation updates disabled'
+ XGETTEXT="true"
+fi
+
+printf 'Checking %s command existance ...' "${MSGMERGE}"
+if command -v "${MSGMERGE}" >/dev/null ; is_ok
+then
+ :
+else
+ echo 'Warning: translation updates disabled'
+ MSGMERGE="true"
+fi
+
printf 'Checking %s command existance ...' "${SHELLCHECK}"
if command -v "${SHELLCHECK}" >/dev/null ; is_ok
then
@@ -295,6 +317,8 @@ CFLAGS = ${CFLAGS}
LDFLAGS = ${LDFLAGS}
ED = ${ED}
MANDOC = ${MANDOC}
+XGETTEXT = ${XGETTEXT}
+MSGMERGE = ${MSGMERGE}
SHELLCHECK = ${SHELLCHECK}
FLAWFINDER = ${FLAWFINDER}
REUSE = ${REUSE}
@@ -305,7 +329,11 @@ DEPS_libs = ${DEPS_libs}
GETTEXT_OPTS = --copyright-holder="Badwolf Authors <https://hacktivis.me/projects/badwolf>" --package-name="Badwolf" --package-version="${VERSION_FULL}" --msgid-bugs-address="contact+badwolf-msgid@hacktivis.me"
rule xgettext
- command = xgettext --keyword=_ --language=C --from-code=UTF-8 -o \$out --add-comments --sort-output --foreign-user --no-location --no-wrap \$GETTEXT_OPTS \$in && ed -s \$out <po/pot_license.ed
+ command = \$XGETTEXT --keyword=_ --language=C --from-code=UTF-8 -o \$out --add-comments --sort-output --foreign-user --no-location --no-wrap \$GETTEXT_OPTS \$in && ed -s \$out <po/pot_license.ed
+
+rule msgmerge
+ # touch: msgmerge doesn't always updates timestamps
+ command = \$MSGMERGE --update --backup=off \$out \$in && touch \$out
rule xgettext_man
command = if test -e \$out; $