commit: c1e09df4bda8fa4752e4cbd54474594eda7bcf88
parent e4a3ceb7cce93dad62bc6a947b5ee5e9060a5f2f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 10 Oct 2023 17:02:58 +0200
configure: Use $ED during config generation & handle missing ed(1)
Diffstat:
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
@@ -148,7 +148,7 @@ if command -v "${ED}" >/dev/null ; is_ok
then
:
else
- echo 'Warning: Fixing copyright in po/*.pot files via ed(1) disabled'
+ echo 'Warning: Updating of *.pot translation files disabled, you may want to install ed(1)'
ED="false"
fi
@@ -342,7 +342,7 @@ 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
@@ -350,8 +350,8 @@ rule msgmerge
rule xgettext_man
command = if test -e \$out; $
-then po4a-updatepo --format man -M utf-8 --master \$in \$GETTEXT_OPTS --po \$out && ed -s \$out <po/pot_license.ed;$
-else po4a-gettextize --format man -M utf-8 --master \$in \$GETTEXT_OPTS --po \$out && ed -s \$out <po/pot_license.ed;$
+then po4a-updatepo --format man -M utf-8 --master \$in \$GETTEXT_OPTS --po \$out && \$ED -s \$out <po/pot_license.ed;$
+else po4a-gettextize --format man -M utf-8 --master \$in \$GETTEXT_OPTS --po \$out && \$ED -s \$out <po/pot_license.ed;$
fi
rule cc_exe
@@ -374,13 +374,27 @@ for obj in ${OBJS}; do
done >>config.ninja
for trans in ${TRANS}; do
- echo "build po/${trans}.po: msgmerge po/messages.pot"
+ if [ "$ED" != "false" ]; then
+ echo "build po/${trans}.po: msgmerge po/messages.pot"
+ else
+ if test ! -e "po/${trans}.po"; then
+ echo "Error: po/${trans}.po not found and ed(1) is missing/disabled" >&2
+ exit 1
+ fi
+ fi
echo "build locale/${trans}/LC_MESSAGES/Badwolf.mo: po2mo po/${trans}.po"
all="${all} locale/${trans}/LC_MESSAGES/Badwolf.mo"
done >>config.ninja
for man in ${TRANS_MAN}; do
- echo "build po/${man}_man.po: xgettext_man badwolf.1"
+ if [ "$ED" != "false" ]; then
+ echo "build po/${man}_man.po: xgettext_man badwolf.1"
+ else
+ if test ! -e "po/${man}_man.po"; then
+ echo "Error: po/${man}_man.po not found and ed(1) is missing/disabled" >&2
+ exit 1
+ fi
+ fi
echo "build badwolf.${man}.1: translate_manpage po/${man}_man.po"
bundled="${bundled} badwolf.${man}.1"
trans_man="${trans_man} badwolf.${man}.1"