Merge desktop file at build time

Previously, both the .desktop.in template and the final .desktop file
were checked into source control.

While in some ways convenient, the manual step of updating it may be
forgotten after updating a translation or adjusting the template. It
also potentially introduces confusion as to which file to modify.

Instead, generate the .desktop file at build time. Since this is now
done using msgfmt rather than intltool, there is no additional
dependency beyond gettext, which is already used at build time to
compile .po files to .mo files.
This commit is contained in:
Will Thompson 2022-06-10 10:36:48 +01:00
parent 3141249969
commit b4aa697474
4 changed files with 6 additions and 381 deletions

View file

@ -529,6 +529,9 @@ endif
$(MOFILES): trans/%.mo: src/po/%.po
msgfmt -o $@ $<
%.desktop: %.desktop.in $(POTFILES)
msgfmt --desktop -d src/po --template $< -o $@
.PHONY: translations
ifeq "$(shell msgfmt -h)" ""
translations: trans
@ -538,7 +541,7 @@ translations: trans
@echo "Install gettext to run Tux Paint in non-U.S. English modes."
@echo "--------------------------------------------------------------"
else
translations: trans $(MOFILES)
translations: trans $(MOFILES) src/tuxpaint.desktop
endif
trans:
@ -923,13 +926,11 @@ install-nokia770:
fi
@-find $(DESTDIR)$(NOKIA770_PREFIX) -name CVS -type d -exec rm -rf \{\} \;
# Install a launcher icon in the Linux desktop environment's (freedesktop.org) menus...
# FIXME: No way to install SVG icons using `xdg-icon-resource`
# (see https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/790449)
.PHONY: install-xdg
install-xdg:
install-xdg: src/tuxpaint.desktop
@echo
@echo "...Installing launcher icon into desktop environment..."
@if [ "x$(shell which xdg-icon-resource install)" != "x" ]; then \