From 8c2e9018de0ec485950bc9640c2e86b976879f5b Mon Sep 17 00:00:00 2001 From: Matteo Bini Date: Thu, 16 Mar 2023 18:38:23 +0100 Subject: [PATCH] Add LINGUAS and POT targets POTFILES.in and PO files are now handled by Make. --- Makefile | 95 ++++++++++++++++++++++++++++++-------------------- po/Makevars | 82 ------------------------------------------- po/POTFILES.in | 6 ---- 3 files changed, 57 insertions(+), 126 deletions(-) delete mode 100644 po/Makevars delete mode 100644 po/POTFILES.in diff --git a/Makefile b/Makefile index 770b24e..8ff94ad 100644 --- a/Makefile +++ b/Makefile @@ -17,41 +17,7 @@ SPEK_CPPFLAGS = ${OS_FLAGS} -DGETTEXT_PACKAGE=\"'${NAME}'\" -DPACKAGE_NAME=\"'${ SPEK_CXXFLAGS = -Os `wx-config --cxxflags` ${SPEK_CPPFLAGS} ${CXXFLAGS} SPEK_LDFLAGS = ${LIBS} ${LDFLAGS} -GMO = \ - po/bs.gmo \ - po/ca.gmo \ - po/cs.gmo \ - po/da.gmo \ - po/de.gmo \ - po/el.gmo \ - po/eo.gmo \ - po/es.gmo \ - po/fi.gmo \ - po/fr.gmo \ - po/gl.gmo \ - po/he.gmo \ - po/hr.gmo \ - po/hu.gmo \ - po/id.gmo \ - po/it.gmo \ - po/ja.gmo \ - po/ko.gmo \ - po/lv.gmo \ - po/nb.gmo \ - po/nl.gmo \ - po/nn.gmo \ - po/pl.gmo \ - po/pt_BR.gmo \ - po/ru.gmo \ - po/sk.gmo \ - po/sr@latin.gmo \ - po/sv.gmo \ - po/th.gmo \ - po/tr.gmo \ - po/uk.gmo \ - po/vi.gmo \ - po/zh_CN.gmo \ - po/zh_TW.gmo \ +GMO = ${PO:.po=.gmo} OBJ_LIB = \ src/spek-audio.o \ @@ -80,6 +46,50 @@ OBJ = \ src/spek-spectrogram.o \ src/spek-window.o \ +PO = \ + po/bs.po \ + po/ca.po \ + po/cs.po \ + po/da.po \ + po/de.po \ + po/el.po \ + po/eo.po \ + po/es.po \ + po/fi.po \ + po/fr.po \ + po/gl.po \ + po/he.po \ + po/hr.po \ + po/hu.po \ + po/id.po \ + po/it.po \ + po/ja.po \ + po/ko.po \ + po/lv.po \ + po/nb.po \ + po/nl.po \ + po/nn.po \ + po/pl.po \ + po/pt_BR.po \ + po/ru.po \ + po/sk.po \ + po/sr@latin.po \ + po/sv.po \ + po/th.po \ + po/tr.po \ + po/uk.po \ + po/vi.po \ + po/zh_CN.po \ + po/zh_TW.po \ + +POTFILES = \ + data/spek.desktop.in \ + src/spek-pipeline.cc \ + src/spek-preferences-dialog.cc \ + src/spek-spectrogram.cc \ + src/spek-window.cc \ + src/spek.cc \ + all: @echo "To build ${NAME} type make and one the following: osx, unix or win." @echo "E.g. \`make unix\`" @@ -102,14 +112,23 @@ ${LIB}: ${OBJ_LIB} ${BIN}: ${LIB} ${OBJ} ${CXX} -o ${BIN} ${OBJ} ${LIB} ${SPEK_LDFLAGS} -data/${NAME}.desktop: +data/${NAME}.desktop: po/LINGUAS sed '/^#/d' ${@}.in > ${@}.in.tmp msgfmt -d po -o $@ --desktop --template=${@}.in.tmp rm ${@}.in.tmp -data/${NAME}.metainfo.xml: +data/${NAME}.metainfo.xml: po/LINGUAS msgfmt -d po -o $@ --xml --template=${@}.in +po/LINGUAS: ${PO} + printf "%s" '${PO}' | xargs -d ' ' -I {} printf "%s\n" '{}' | sed 's/^po\/\(.*\)\.po$$/\1/' | sort > $@ + +po/${NAME}.pot: ${POTFILES} + xgettext -o $@ --copyright-holder='The Spek authors' --package-name=${NAME} --package-version=${VERSION} --from-code=UTF-8 --add-comments --keyword=_ --keyword=N_ ${POTFILES} + for po in po/*.po; do \ + msgmerge -o "$$po" -q "$$po" $@; \ + done; + osx: @make options ${BIN} OS_FLAGS=-DOS_OSX @@ -134,7 +153,7 @@ check: tests/perf${EXT} tests/test${EXT} clean: rm -f ${BIN} ${NAME}.exe ${LIB} ${OBJ} ${OBJ_LIB} ${GMO} data/${NAME}.desktop data/${NAME}.desktop.in.tmp data/${NAME}.metainfo.xml ${NAME}-${VERSION}.tar.gz tests/perf tests/perf.exe tests/perf${EXT} tests/test tests/test.exe tests/test${EXT} ${OBJ_PERF} ${OBJ_TEST} -dist: clean +dist: clean po/${NAME}.pot mkdir ${NAME}-${VERSION} cp -R $$(ls -A | sed '/^\.git$$/d;/^${NAME}-${VERSION}$$/d') ${NAME}-${VERSION} tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} diff --git a/po/Makevars b/po/Makevars deleted file mode 100644 index dac8782..0000000 --- a/po/Makevars +++ /dev/null @@ -1,82 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. -# -# Copyright (C) 2003-2019 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation gives -# unlimited permission to use, copy, distribute, and modify it. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --from-code=UTF-8 --add-comments --keyword=_ --keyword=N_ - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = The Spek authors - -# This tells whether or not to prepend "GNU " prefix to the package -# name that gets inserted into the header of the $(DOMAIN).pot file. -# Possible values are "yes", "no", or empty. If it is empty, try to -# detect it automatically by scanning the files in $(top_srcdir) for -# "GNU packagename" string. -PACKAGE_GNU = no - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = - -# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' -# context. Possible values are "yes" and "no". Set this to yes if the -# package uses functions taking also a message context, like pgettext(), or -# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. -USE_MSGCTXT = no - -# These options get passed to msgmerge. -# Useful options are in particular: -# --previous to keep previous msgids of translated messages, -# --quiet to reduce the verbosity. -MSGMERGE_OPTIONS = - -# These options get passed to msginit. -# If you want to disable line wrapping when writing PO files, add -# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and -# MSGINIT_OPTIONS. -MSGINIT_OPTIONS = - -# This tells whether or not to regenerate a PO file when $(DOMAIN).pot -# has changed. Possible values are "yes" and "no". Set this to no if -# the POT file is checked in the repository and the version control -# program ignores timestamps. -PO_DEPENDS_ON_POT = yes - -# This tells whether or not to forcibly update $(DOMAIN).pot and -# regenerate PO files on "make dist". Possible values are "yes" and -# "no". Set this to no if the POT file and PO files are maintained -# externally. -DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index d1deb76..0000000 --- a/po/POTFILES.in +++ /dev/null @@ -1,6 +0,0 @@ -data/spek.desktop.in -src/spek-pipeline.cc -src/spek-preferences-dialog.cc -src/spek-spectrogram.cc -src/spek-window.cc -src/spek.cc