From 8d7fde7d5c21c5c462f2a3aa657cacadaf0966a8 Mon Sep 17 00:00:00 2001 From: Martin Blanchard Date: Wed, 31 Mar 2021 09:52:03 +0100 Subject: [PATCH] build: stop relying on intltool for i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent gettext version can extract and merge back strings from and to various file formats, no need for intltool anymore. https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/133 https://github.com/NetworkManager/NetworkManager/pull/303 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/96 Clarification about the use of AM_GNU_GETTEXT_REQUIRE_VERSION: In configure.ac, specify the minimum gettext version we require, rather than the exact one. This fixes a situation where the autoconf macros used for gettext will be the latest available on the system (for example, 0.20); but the copied-in Makefile.in.in will be for the exact version specified in configure.ac (in this case, 0.19). In that situation, the gettext build rules will error out at `make` time with the message: *** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version 0.19 but the autoconf macros are from gettext version 0.20 Avoid that by specifying a minimum version dependency rather than an exact one. This should not cause problems as we haven’t committed any generated or external gettext files into git, so each developer will end up regenerating the build system for their system’s version of gettext, as expected. See the subsection of https://www.gnu.org/software/gettext/manual/html_node/Version-Control-Issues.html for more information. Note that autoreconf currently doesn’t recognise AM_GNU_GETTEXT_REQUIRE_VERSION, so we must continue also using AM_GNU_GETTEXT_VERSION. autopoint will ignore the latter if the former is present. See https://lists.gnu.org/archive/html/autoconf-patches/2015-10/msg00000.html. --- .gitignore | 6 +- Makefile.am | 12 ++- autogen.sh | 6 +- configure.ac | 6 +- contrib/fedora/REQUIRED_PACKAGES | 1 - contrib/fedora/rpm/NetworkManager.spec | 4 +- data/meson.build | 4 +- ...rg.freedesktop.NetworkManager.policy.in.in | 68 ++++++++-------- meson.build | 5 -- po/Makevars | 78 +++++++++++++++++++ po/POTFILES.in | 1 - 11 files changed, 129 insertions(+), 62 deletions(-) create mode 100644 po/Makevars diff --git a/.gitignore b/.gitignore index 34d5af178f..4b92085496 100644 --- a/.gitignore +++ b/.gitignore @@ -55,7 +55,6 @@ test-*.trs /config.* /config-extra.h /configure -/intltool-* /confdefs.h /conftest.[ch] @@ -192,7 +191,6 @@ test-*.trs /m4/intl.m4 /m4/intldir.m4 /m4/intlmacosx.m4 -/m4/intltool.m4 /m4/intmax.m4 /m4/inttypes-pri.m4 /m4/inttypes_h.m4 @@ -226,7 +224,6 @@ test-*.trs /man/common.ent /po/*.gmo -/po/.intltool-merge-cache /po/NetworkManager.pot /po/Makevars.template /po/Rules-quot @@ -483,3 +480,6 @@ test-*.trs /src/tests/test-systemd /src/tests/test-utils /src/tests/test-wired-defname +/intltool-* +/m4/intltool.m4 +/po/.intltool-merge-cache diff --git a/Makefile.am b/Makefile.am index 45f4e216e5..355984abae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -170,8 +170,6 @@ endif dist: $(dist_configure_check) $(dist_dependencies) -DISTCLEANFILES += intltool-extract intltool-merge intltool-update - ############################################################################### install-data-hook-dirs: @@ -213,9 +211,12 @@ polkit_policydir = $(datadir)/polkit-1/actions dist_polkit_policy_in_in_files = \ data/org.freedesktop.NetworkManager.policy.in.in -polkit_policy_DATA = $(dist_polkit_policy_in_in_files:.policy.in.in=.policy) +dist_polkit_policy_in_files = $(dist_polkit_policy_in_in_files:.policy.in.in=.policy.in) -@INTLTOOL_POLICY_RULE@ +polkit_policy_DATA = $(dist_polkit_policy_in_files:.policy.in=.policy) + +$(polkit_policy_DATA): $(dist_polkit_policy_in_files) + $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ DISTCLEANFILES += $(polkit_policy_DATA) @@ -5603,9 +5604,6 @@ EXTRA_DIST += \ COPYING.LGPL \ COPYING.GFDL \ \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ linker-script-binary.ver \ linker-script-devices.ver \ linker-script-settings.ver \ diff --git a/autogen.sh b/autogen.sh index 8809806178..48a3b16252 100755 --- a/autogen.sh +++ b/autogen.sh @@ -22,9 +22,9 @@ PKG_NAME=NetworkManager cd $srcdir -gtkdocize -autopoint --force -AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose +aclocal --install || exit 1 +gtkdocize --copy || exit 1 +autoreconf --verbose --force --install || exit 1 cd $olddir if test -z "$NOCONFIGURE"; then diff --git a/configure.ac b/configure.ac index fcfbb03ed1..e2f47cd2ae 100644 --- a/configure.ac +++ b/configure.ac @@ -138,10 +138,10 @@ AC_CHECK_DECLS([getrandom], dnl dnl translation support dnl -IT_PROG_INTLTOOL([0.40.0]) - AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION([0.17]) +# Remove AM_GNU_GETTEXT_VERSION once autoreconf supports REQUIRE_VERSION +AM_GNU_GETTEXT_VERSION([0.19.8]) +AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8]) GETTEXT_PACKAGE=NetworkManager AC_SUBST(GETTEXT_PACKAGE) diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 112b01bd2a..637d47e979 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -58,7 +58,6 @@ install \ gnutls-devel \ gobject-introspection-devel \ gtk-doc \ - intltool \ iptables \ jansson-devel \ libcurl-devel \ diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 01ff26cc24..f31259722c 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -256,8 +256,7 @@ BuildRequires: meson BuildRequires: automake BuildRequires: autoconf %endif -BuildRequires: intltool -BuildRequires: gettext-devel +BuildRequires: gettext-devel >= 0.19.8 BuildRequires: dbus-devel >= %{dbus_version} BuildRequires: glib2-devel >= 2.40.0 @@ -748,7 +747,6 @@ Preferably use nmcli instead. gtkdocize %endif autoreconf --install --force -intltoolize --automake --copy --force %configure \ --with-runstatedir=%{_rundir} \ --disable-silent-rules \ diff --git a/data/meson.build b/data/meson.build index 35e3de5254..19310bb60a 100644 --- a/data/meson.build +++ b/data/meson.build @@ -59,11 +59,11 @@ if enable_polkit configuration: data_conf, ) - custom_target( + i18n.merge_file( policy, input: policy_in, output: '@BASENAME@', - command: intltool_xml_cmd, + po_dir: po_dir, install: true, install_dir: polkit_gobject_policydir, ) diff --git a/data/org.freedesktop.NetworkManager.policy.in.in b/data/org.freedesktop.NetworkManager.policy.in.in index 8d46dac735..13a0a5b504 100644 --- a/data/org.freedesktop.NetworkManager.policy.in.in +++ b/data/org.freedesktop.NetworkManager.policy.in.in @@ -10,8 +10,8 @@ nm-icon - <_description>Enable or disable system networking - <_message>System policy prevents enabling or disabling system networking + Enable or disable system networking + System policy prevents enabling or disabling system networking no yes @@ -19,8 +19,8 @@ - <_description>Reload NetworkManager configuration - <_message>System policy prevents reloading NetworkManager + Reload NetworkManager configuration + System policy prevents reloading NetworkManager auth_admin_keep auth_admin_keep @@ -29,8 +29,8 @@ - <_description>Put NetworkManager to sleep or wake it up (should only be used by system power management) - <_message>System policy prevents putting NetworkManager to sleep or waking it up + Put NetworkManager to sleep or wake it up (should only be used by system power management) + System policy prevents putting NetworkManager to sleep or waking it up no no @@ -38,8 +38,8 @@ - <_description>Enable or disable Wi-Fi devices - <_message>System policy prevents enabling or disabling Wi-Fi devices + Enable or disable Wi-Fi devices + System policy prevents enabling or disabling Wi-Fi devices no yes @@ -47,8 +47,8 @@ - <_description>Enable or disable mobile broadband devices - <_message>System policy prevents enabling or disabling mobile broadband devices + Enable or disable mobile broadband devices + System policy prevents enabling or disabling mobile broadband devices no yes @@ -56,8 +56,8 @@ - <_description>Enable or disable WiMAX mobile broadband devices - <_message>System policy prevents enabling or disabling WiMAX mobile broadband devices + Enable or disable WiMAX mobile broadband devices + System policy prevents enabling or disabling WiMAX mobile broadband devices no yes @@ -65,8 +65,8 @@ - <_description>Allow control of network connections - <_message>System policy prevents control of network connections + Allow control of network connections + System policy prevents control of network connections auth_admin yes @@ -75,8 +75,8 @@ - <_description>Allow control of Wi-Fi scans - <_message>System policy prevents Wi-Fi scans + Allow control of Wi-Fi scans + System policy prevents Wi-Fi scans auth_admin yes @@ -85,8 +85,8 @@ - <_description>Connection sharing via a protected Wi-Fi network - <_message>System policy prevents sharing connections via a protected Wi-Fi network + Connection sharing via a protected Wi-Fi network + System policy prevents sharing connections via a protected Wi-Fi network no yes @@ -94,8 +94,8 @@ - <_description>Connection sharing via an open Wi-Fi network - <_message>System policy prevents sharing connections via an open Wi-Fi network + Connection sharing via an open Wi-Fi network + System policy prevents sharing connections via an open Wi-Fi network no yes @@ -103,8 +103,8 @@ - <_description>Modify personal network connections - <_message>System policy prevents modification of personal network settings + Modify personal network connections + System policy prevents modification of personal network settings auth_self_keep yes @@ -113,8 +113,8 @@ - <_description>Modify network connections for all users - <_message>System policy prevents modification of network settings for all users + Modify network connections for all users + System policy prevents modification of network settings for all users auth_admin_keep @NM_MODIFY_SYSTEM_POLICY@ @@ -123,8 +123,8 @@ - <_description>Modify persistent system hostname - <_message>System policy prevents modification of the persistent system hostname + Modify persistent system hostname + System policy prevents modification of the persistent system hostname auth_admin_keep auth_admin_keep @@ -133,8 +133,8 @@ - <_description>Modify persistent global DNS configuration - <_message>System policy prevents modification of the persistent global DNS configuration + Modify persistent global DNS configuration + System policy prevents modification of the persistent global DNS configuration auth_admin_keep auth_admin_keep @@ -143,8 +143,8 @@ - <_description>Perform a checkpoint or rollback of interfaces configuration - <_message>System policy prevents the creation of a checkpoint or its rollback + Perform a checkpoint or rollback of interfaces configuration + System policy prevents the creation of a checkpoint or its rollback auth_admin_keep auth_admin_keep @@ -153,8 +153,8 @@ - <_description>Enable or disable device statistics - <_message>System policy prevents enabling or disabling device statistics + Enable or disable device statistics + System policy prevents enabling or disabling device statistics no yes @@ -162,8 +162,8 @@ - <_description>Enable or disable connectivity checking - <_message>System policy prevents enabling or disabling connectivity checking + Enable or disable connectivity checking + System policy prevents enabling or disabling connectivity checking no yes diff --git a/meson.build b/meson.build index 0aa3c03a3c..cd8a35db26 100644 --- a/meson.build +++ b/meson.build @@ -78,11 +78,6 @@ build_root = meson.current_build_dir() po_dir = join_paths(meson.source_root(), 'po') -intltool_merge = find_program('intltool-merge') -intltool_cache = join_paths(po_dir, '.intltool-merge-cache') -intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] -intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] - top_inc = include_directories('.') perl = find_program('perl') diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000000..b858b6db7d --- /dev/null +++ b/po/Makevars @@ -0,0 +1,78 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# 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 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments + +# 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 NetworkManager 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 = https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues + +# 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 = yes + +# 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 = no + +# 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 = no diff --git a/po/POTFILES.in b/po/POTFILES.in index 151f58fca9..c7b1c90d9f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,3 @@ -[encoding: UTF-8] # List of source files containing translatable strings. # Please keep this file sorted alphabetically. data/org.freedesktop.NetworkManager.policy.in.in