From a1c15b0973f16cd5b780903a857cfee8028d5231 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Wed, 17 May 2017 20:49:03 +1000 Subject: [PATCH] Use a helper msgfmt-desktop script instead of invoking msgfmt(1) directly --- .gitattributes | 19 ++++++++++--------- Makefile.am | 4 +++- build-aux/msgfmt-desktop | 23 +++++++++++++++++++++++ data/Makefile.am | 2 +- 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100755 build-aux/msgfmt-desktop diff --git a/.gitattributes b/.gitattributes index 983d56ab..3762a7e6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,9 +1,10 @@ -Makefile.am ident -/configure.ac ident -/build-aux/bootstrap ident -/doc/trader.* ident -/po/LINGUAS ident -/po/Makevars ident -/po/POTFILES.in ident -/src/*.c ident -/src/*.h ident +Makefile.am ident +/configure.ac ident +/build-aux/bootstrap ident +/build-aux/msgfmt-desktop ident +/doc/trader.* ident +/po/LINGUAS ident +/po/Makevars ident +/po/POTFILES.in ident +/src/*.c ident +/src/*.h ident diff --git a/Makefile.am b/Makefile.am index e8d81f0c..b00291c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,4 +31,6 @@ SUBDIRS = lib src po data doc m4 # Additional files to distribute -EXTRA_DIST = build-aux/bootstrap +EXTRA_DIST = \ + build-aux/bootstrap \ + build-aux/msgfmt-desktop diff --git a/build-aux/msgfmt-desktop b/build-aux/msgfmt-desktop new file mode 100755 index 00000000..215b3c68 --- /dev/null +++ b/build-aux/msgfmt-desktop @@ -0,0 +1,23 @@ +#!/bin/sh + +# Create or update desktop files using msgfmt(1) +# $Id$ + +# Usage: +# msgfmt-desktop -d PODIR INPUT OUTPUT + +set -e + +if [ x"$1" != x"-d" ]; then + echo "$0: Missing parameters" 1>&2 + exit 1 +fi + +PODIR="$2" +INPUT="$3" +OUTPUT="$4" + +if ! msgfmt --desktop -d "$PODIR" --template "$INPUT" -o "$OUTPUT"; then + echo "$0: Using cp(1) program instead" + cp "$INPUT" "$OUTPUT" +fi diff --git a/data/Makefile.am b/data/Makefile.am index 76630b06..390be57d 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -35,4 +35,4 @@ EXTRA_DIST = \ trader.desktop: trader.desktop.in - msgfmt --desktop -d $(top_srcdir)/po --template $< -o $@ + $(top_srcdir)/build-aux/msgfmt-desktop -d $(top_srcdir)/po $< $@