build: stop relying on intltool for i18n

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.

[lkundrak@v3.sk: Fixed the meson build, adjusted autogen.sh:
droped "|| exit 1", dropped call to aclocal,
dropped --copy from gtkdocize.]
This commit is contained in:
Martin Blanchard 2021-03-31 09:52:03 +01:00 committed by Lubomir Rintel
parent bf9a2babb4
commit 19a6affd3a
11 changed files with 127 additions and 62 deletions

6
.gitignore vendored
View File

@ -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

View File

@ -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 \

View File

@ -23,8 +23,7 @@ PKG_NAME=NetworkManager
cd $srcdir
gtkdocize
autopoint --force
AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
autoreconf --verbose --force --install
cd $olddir
if test -z "$NOCONFIGURE"; then

View File

@ -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)

View File

@ -58,7 +58,6 @@ install \
gnutls-devel \
gobject-introspection-devel \
gtk-doc \
intltool \
iptables \
jansson-devel \
libcurl-devel \

View File

@ -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 \

View File

@ -59,11 +59,10 @@ if enable_polkit
configuration: data_conf,
)
custom_target(
policy,
i18n.merge_file(
input: policy_in,
output: '@BASENAME@',
command: intltool_xml_cmd,
po_dir: po_dir,
install: true,
install_dir: polkit_gobject_policydir,
)

View File

@ -10,8 +10,8 @@
<icon_name>nm-icon</icon_name>
<action id="org.freedesktop.NetworkManager.enable-disable-network">
<_description>Enable or disable system networking</_description>
<_message>System policy prevents enabling or disabling system networking</_message>
<description>Enable or disable system networking</description>
<message>System policy prevents enabling or disabling system networking</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -19,8 +19,8 @@
</action>
<action id="org.freedesktop.NetworkManager.reload">
<_description>Reload NetworkManager configuration</_description>
<_message>System policy prevents reloading NetworkManager</_message>
<description>Reload NetworkManager configuration</description>
<message>System policy prevents reloading NetworkManager</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
@ -29,8 +29,8 @@
</action>
<action id="org.freedesktop.NetworkManager.sleep-wake">
<_description>Put NetworkManager to sleep or wake it up (should only be used by system power management)</_description>
<_message>System policy prevents putting NetworkManager to sleep or waking it up</_message>
<description>Put NetworkManager to sleep or wake it up (should only be used by system power management)</description>
<message>System policy prevents putting NetworkManager to sleep or waking it up</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>no</allow_active>
@ -38,8 +38,8 @@
</action>
<action id="org.freedesktop.NetworkManager.enable-disable-wifi">
<_description>Enable or disable Wi-Fi devices</_description>
<_message>System policy prevents enabling or disabling Wi-Fi devices</_message>
<description>Enable or disable Wi-Fi devices</description>
<message>System policy prevents enabling or disabling Wi-Fi devices</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -47,8 +47,8 @@
</action>
<action id="org.freedesktop.NetworkManager.enable-disable-wwan">
<_description>Enable or disable mobile broadband devices</_description>
<_message>System policy prevents enabling or disabling mobile broadband devices</_message>
<description>Enable or disable mobile broadband devices</description>
<message>System policy prevents enabling or disabling mobile broadband devices</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -56,8 +56,8 @@
</action>
<action id="org.freedesktop.NetworkManager.enable-disable-wimax">
<_description>Enable or disable WiMAX mobile broadband devices</_description>
<_message>System policy prevents enabling or disabling WiMAX mobile broadband devices</_message>
<description>Enable or disable WiMAX mobile broadband devices</description>
<message>System policy prevents enabling or disabling WiMAX mobile broadband devices</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -65,8 +65,8 @@
</action>
<action id="org.freedesktop.NetworkManager.network-control">
<_description>Allow control of network connections</_description>
<_message>System policy prevents control of network connections</_message>
<description>Allow control of network connections</description>
<message>System policy prevents control of network connections</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>yes</allow_inactive>
@ -75,8 +75,8 @@
</action>
<action id="org.freedesktop.NetworkManager.wifi.scan">
<_description>Allow control of Wi-Fi scans</_description>
<_message>System policy prevents Wi-Fi scans</_message>
<description>Allow control of Wi-Fi scans</description>
<message>System policy prevents Wi-Fi scans</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>yes</allow_inactive>
@ -85,8 +85,8 @@
</action>
<action id="org.freedesktop.NetworkManager.wifi.share.protected">
<_description>Connection sharing via a protected Wi-Fi network</_description>
<_message>System policy prevents sharing connections via a protected Wi-Fi network</_message>
<description>Connection sharing via a protected Wi-Fi network</description>
<message>System policy prevents sharing connections via a protected Wi-Fi network</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -94,8 +94,8 @@
</action>
<action id="org.freedesktop.NetworkManager.wifi.share.open">
<_description>Connection sharing via an open Wi-Fi network</_description>
<_message>System policy prevents sharing connections via an open Wi-Fi network</_message>
<description>Connection sharing via an open Wi-Fi network</description>
<message>System policy prevents sharing connections via an open Wi-Fi network</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -103,8 +103,8 @@
</action>
<action id="org.freedesktop.NetworkManager.settings.modify.own">
<_description>Modify personal network connections</_description>
<_message>System policy prevents modification of personal network settings</_message>
<description>Modify personal network connections</description>
<message>System policy prevents modification of personal network settings</message>
<defaults>
<allow_any>auth_self_keep</allow_any>
<allow_inactive>yes</allow_inactive>
@ -113,8 +113,8 @@
</action>
<action id="org.freedesktop.NetworkManager.settings.modify.system">
<_description>Modify network connections for all users</_description>
<_message>System policy prevents modification of network settings for all users</_message>
<description>Modify network connections for all users</description>
<message>System policy prevents modification of network settings for all users</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>@NM_MODIFY_SYSTEM_POLICY@</allow_inactive>
@ -123,8 +123,8 @@
</action>
<action id="org.freedesktop.NetworkManager.settings.modify.hostname">
<_description>Modify persistent system hostname</_description>
<_message>System policy prevents modification of the persistent system hostname</_message>
<description>Modify persistent system hostname</description>
<message>System policy prevents modification of the persistent system hostname</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
@ -133,8 +133,8 @@
</action>
<action id="org.freedesktop.NetworkManager.settings.modify.global-dns">
<_description>Modify persistent global DNS configuration</_description>
<_message>System policy prevents modification of the persistent global DNS configuration</_message>
<description>Modify persistent global DNS configuration</description>
<message>System policy prevents modification of the persistent global DNS configuration</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
@ -143,8 +143,8 @@
</action>
<action id="org.freedesktop.NetworkManager.checkpoint-rollback">
<_description>Perform a checkpoint or rollback of interfaces configuration</_description>
<_message>System policy prevents the creation of a checkpoint or its rollback</_message>
<description>Perform a checkpoint or rollback of interfaces configuration</description>
<message>System policy prevents the creation of a checkpoint or its rollback</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
@ -153,8 +153,8 @@
</action>
<action id="org.freedesktop.NetworkManager.enable-disable-statistics">
<_description>Enable or disable device statistics</_description>
<_message>System policy prevents enabling or disabling device statistics</_message>
<description>Enable or disable device statistics</description>
<message>System policy prevents enabling or disabling device statistics</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
@ -162,8 +162,8 @@
</action>
<action id="org.freedesktop.NetworkManager.enable-disable-connectivity-check">
<_description>Enable or disable connectivity checking</_description>
<_message>System policy prevents enabling or disabling connectivity checking</_message>
<description>Enable or disable connectivity checking</description>
<message>System policy prevents enabling or disabling connectivity checking</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>

View File

@ -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')

78
po/Makevars Normal file
View File

@ -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

View File

@ -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