PolicyKit: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 3 09:29:41 UTC 2021


 .gitlab-ci.yml                                                   |    3 
 Makefile.am                                                      |    2 
 actions/Makefile.am                                              |    7 
 actions/meson.build                                              |    5 
 actions/org.freedesktop.policykit.policy.in                      |    4 
 autogen.sh                                                       |   10 +
 configure.ac                                                     |   12 +
 data/Makefile.am                                                 |    5 
 data/meson.build                                                 |   10 -
 gettext/Makefile.am                                              |    4 
 gettext/its/Makefile.am                                          |    4 
 meson.build                                                      |   14 +
 po/Makevars                                                      |   78 ++++++++++
 po/POTFILES.in                                                   |    1 
 po/meson.build                                                   |    6 
 src/examples/Makefile.am                                         |    7 
 src/examples/meson.build                                         |    5 
 src/examples/org.freedesktop.policykit.examples.pkexec.policy.in |    4 
 18 files changed, 138 insertions(+), 43 deletions(-)

New commits:
commit 96c6fc83538fc28d1b3923b8be1eba2648f30e28
Author: Iñigo Martínez <inigomartinez at gmail.com>
Date:   Wed Oct 28 12:02:04 2020 +0100

    build: Migrate from Intltool to Gettext
    
    Recent versions of Gettext are able to translate several formats
    that are used in GNOME applications.
    
    This migrates from Intltool to Gettext both autotools and meson
    build systems.

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d0abb4..23cf0d6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,8 +6,9 @@ variables:
                 libtool
                 autoconf
                 automake
+                gettext
+                gettext-devel
                 gtk-doc
-                intltool
                 gobject-introspection-devel
                 make
                 libxslt
diff --git a/Makefile.am b/Makefile.am
index 1648bcc..199576a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = actions data src docs po
+SUBDIRS = actions data gettext src docs po
 
 if BUILD_TEST
 SUBDIRS += test
diff --git a/actions/Makefile.am b/actions/Makefile.am
index 1709992..5a499a1 100644
--- a/actions/Makefile.am
+++ b/actions/Makefile.am
@@ -1,9 +1,10 @@
 
 polkit_actiondir = $(datadir)/polkit-1/actions
+polkit_action_in_files = org.freedesktop.policykit.policy.in
+dist_polkit_action_DATA = $(polkit_action_in_files:.policy.in=.policy)
 
-dist_polkit_action_DATA = org.freedesktop.policykit.policy
-
- at INTLTOOL_POLICY_RULE@
+org.freedesktop.policykit.policy: org.freedesktop.policykit.policy.in
+	$(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir)/gettext $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 #check:
 #	$(top_builddir)/tools/polkit-policy-file-validate-1 $(top_srcdir)/policy/$(dist_polkit_action_DATA)
diff --git a/actions/meson.build b/actions/meson.build
index 26d2d2d..2abaaf3 100644
--- a/actions/meson.build
+++ b/actions/meson.build
@@ -1,10 +1,11 @@
 policy = 'org.freedesktop.policykit.policy'
 
-custom_target(
+i18n.merge_file(
   policy,
   input: policy + '.in',
   output: '@BASENAME@',
-  command: intltool_xml_cmd,
+  po_dir: po_dir,
+  data_dirs: its_dir,
   install: true,
   install_dir: pk_pkgactiondir,
 )
diff --git a/actions/org.freedesktop.policykit.policy.in b/actions/org.freedesktop.policykit.policy.in
index 7400b08..dc5c219 100644
--- a/actions/org.freedesktop.policykit.policy.in
+++ b/actions/org.freedesktop.policykit.policy.in
@@ -9,8 +9,8 @@
   <vendor_url>http://www.freedesktop.org/wiki/Software/polkit/</vendor_url>
 
   <action id="org.freedesktop.policykit.exec">
-    <_description>Run a program as another user</_description>
-    <_message>Authentication is required to run a program as another user</_message>
+    <description>Run a program as another user</description>
+    <message>Authentication is required to run a program as another user</message>
     <defaults>
       <allow_any>auth_admin</allow_any>
       <allow_inactive>auth_admin</allow_inactive>
diff --git a/autogen.sh b/autogen.sh
index 3407ae0..857c05b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -69,6 +69,13 @@ test -n "$NO_AUTOMAKE" || (autoreconf --version) < /dev/null > /dev/null 2>&1 ||
   DIE=1
 }
 
+# if no automake, don't bother testing for autopoint
+test -n "$NO_AUTOMAKE" || (autopoint --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: You must have autopoint installed."
+  echo "You can get autopoint from ..."
+  DIE=1
+}
 
 if test "$DIE" -eq 1; then
   exit 1
@@ -103,13 +110,12 @@ esac
 	echo "Running autoheader..."
 	autoheader
       fi
+      autopoint --force
       echo "Running automake --gnu -Wno-portability $am_opt ..."
       automake --add-missing --gnu -Wno-portability $am_opt
       echo "Running autoconf ..."
       autoconf
 
-intltoolize --copy --force --automake                  || exit 1
-
 cd "$olddir"
 
 conf_flags="--enable-maintainer-mode --enable-gtk-doc"
diff --git a/configure.ac b/configure.ac
index 9b03959..ecfee05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -519,11 +519,13 @@ AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" = "xyes")
 # Internationalization
 # ********************
 
-IT_PROG_INTLTOOL([0.40.0])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.19.8])
+AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8])
+
 GETTEXT_PACKAGE=polkit-1
-AC_SUBST([GETTEXT_PACKAGE])
-AM_GLIB_GNU_GETTEXT
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[gettext domain])
 
 AC_ARG_VAR([SUID_CFLAGS],
            [CFLAGS used for binaries which are usually with the suid bit])
@@ -537,6 +539,8 @@ data/Makefile
 data/polkit-1
 data/polkit-gobject-1.pc
 data/polkit-agent-1.pc
+gettext/Makefile
+gettext/its/Makefile
 src/Makefile
 src/polkit/Makefile
 src/polkitbackend/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index e805260..6b045be 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -36,11 +36,6 @@ pkgconfig_DATA = polkit-gobject-1.pc polkit-agent-1.pc
 
 # ----------------------------------------------------------------------------------------------------
 
-itsdir = $(datadir)/gettext/its
-dist_its_DATA = polkit.loc polkit.its
-
-# ----------------------------------------------------------------------------------------------------
-
 systemdservice_in_files = polkit.service.in
 
 if HAVE_SYSTEMD
diff --git a/data/meson.build b/data/meson.build
index cad7ccd..073bd98 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -26,16 +26,6 @@ if enable_pam
   )
 endif
 
-its_data = files(
-  'polkit.its',
-  'polkit.loc',
-)
-
-install_data(
-  its_data,
-  install_dir: pk_datadir / 'gettext/its',
-)
-
 if enable_logind
   configure_file(
     input: 'polkit.service.in',
diff --git a/gettext/Makefile.am b/gettext/Makefile.am
new file mode 100644
index 0000000..3c088f3
--- /dev/null
+++ b/gettext/Makefile.am
@@ -0,0 +1,4 @@
+
+SUBDIRS = its
+
+-include $(top_srcdir)/git.mk
diff --git a/gettext/its/Makefile.am b/gettext/its/Makefile.am
new file mode 100644
index 0000000..68d6d7a
--- /dev/null
+++ b/gettext/its/Makefile.am
@@ -0,0 +1,4 @@
+itsdir = $(datadir)/gettext/its
+dist_its_DATA = polkit.loc polkit.its
+
+-include $(top_srcdir)/git.mk
diff --git a/data/polkit.its b/gettext/its/polkit.its
similarity index 100%
rename from data/polkit.its
rename to gettext/its/polkit.its
diff --git a/data/polkit.loc b/gettext/its/polkit.loc
similarity index 100%
rename from data/polkit.loc
rename to gettext/its/polkit.loc
diff --git a/meson.build b/meson.build
index 81715b5..6a6799e 100644
--- a/meson.build
+++ b/meson.build
@@ -47,12 +47,18 @@ source_root = meson.current_source_dir()
 build_root = meson.current_build_dir()
 
 data_dir = source_root / 'data'
+its_dir = source_root / 'gettext'
 po_dir = source_root / 'po'
 
-intltool_merge = find_program('intltool-merge')
-intltool_cache = 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@']
+its_data = files(
+  'gettext/its/polkit.its',
+  'gettext/its/polkit.loc',
+)
+
+install_data(
+  its_data,
+  install_dir: pk_datadir / 'gettext/its',
+)
 
 top_inc = include_directories('.')
 
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..1cad43c
--- /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 = polkit-1
+
+# 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 = polkit 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 = http://lists.freedesktop.org/mailman/listinfo/polkit-devel
+
+# 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 ed9faa5..0e15629 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
-[encoding: UTF-8]
 actions/org.freedesktop.policykit.policy.in
 src/examples/org.freedesktop.policykit.examples.pkexec.policy.in
 src/programs/pkaction.c
diff --git a/po/meson.build b/po/meson.build
index 4d9ab58..f746417 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1,5 @@
-i18n.gettext(pk_api_name, preset: 'glib')
+i18n.gettext(
+  pk_api_name,
+  data_dirs: data_dir,
+  preset: 'glib',
+)
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 3ee373f..b7d885e 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -49,10 +49,11 @@ pk_example_frobnicate_LDADD =  	                      		\
 	$(NULL)
 
 polkit_actiondir = $(datadir)/polkit-1/actions
+polkit_action_in_files = org.freedesktop.policykit.examples.pkexec.policy.in
+dist_polkit_action_DATA = $(polkit_action_in_files:.policy.in=.policy)
 
-dist_polkit_action_DATA = org.freedesktop.policykit.examples.pkexec.policy
-
- at INTLTOOL_POLICY_RULE@
+org.freedesktop.policykit.examples.pkexec.policy: org.freedesktop.policykit.examples.pkexec.policy.in
+	$(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir)/gettext $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 #check:
 #       $(top_builddir)/tools/polkit-policy-file-validate-1 $(top_srcdir)/policy/$(dist_polkit_action_DATA)
diff --git a/src/examples/meson.build b/src/examples/meson.build
index 5f33afc..c6305ab 100644
--- a/src/examples/meson.build
+++ b/src/examples/meson.build
@@ -1,10 +1,11 @@
 policy = 'org.freedesktop.policykit.examples.pkexec.policy'
 
-custom_target(
+i18n.merge_file(
   policy,
   input: policy + '.in',
   output: '@BASENAME@',
-  command: intltool_xml_cmd,
+  po_dir: po_dir,
+  data_dirs: its_dir,
   install: true,
   install_dir: pk_pkgactiondir,
 )
diff --git a/src/examples/org.freedesktop.policykit.examples.pkexec.policy.in b/src/examples/org.freedesktop.policykit.examples.pkexec.policy.in
index eab7729..ec52416 100644
--- a/src/examples/org.freedesktop.policykit.examples.pkexec.policy.in
+++ b/src/examples/org.freedesktop.policykit.examples.pkexec.policy.in
@@ -7,8 +7,8 @@
   <vendor_url>http://www.freedesktop.org/wiki/Software/polkit/</vendor_url>
 
   <action id="org.freedesktop.policykit.example.pkexec.run-frobnicate">
-    <_description>Run the polkit example program Frobnicate</_description>
-    <_message>Authentication is required to run the polkit example program Frobnicate (user=$(user), user.gecos=$(user.gecos), user.display=$(user.display), program=$(program), command_line=$(command_line))</_message>
+    <description>Run the polkit example program Frobnicate</description>
+    <message>Authentication is required to run the polkit example program Frobnicate (user=$(user), user.gecos=$(user.gecos), user.display=$(user.display), program=$(program), command_line=$(command_line))</message>
     <icon_name>audio-x-generic</icon_name> <!-- just an example -->
     <defaults>
       <allow_any>no</allow_any>


More information about the hal-commit mailing list