summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-31 09:02:20 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2021-12-10 21:47:34 +0100
commitd18b440a72407fc371ec17a2a983976b813e5d97 (patch)
treeefe579a1ef9b0b856da3a7bd27de7a5cd03fb7c5 /libgphoto2_port
parentb2d8e106ae31b59e0ec9ecf9534376f97b9dbe1c (diff)
downloadlibgphoto2-d18b440a72407fc371ec17a2a983976b813e5d97.tar.gz
Require gettext >= 0.18.3; remove GP_GETTEXT_HACK
This requires gettext version 0.18.3 or later, and it removes the GP_GETTEXT_HACK which used to generate a po/Makevars file from the po/Makevers.template. gettext 0.18.3 is the same gettext version requirement as libexif uses. gettext 0.18.3 has been released 2013-07-07, which is a similar timeframe of the autoconf, automake and libtool releases we require. If you ever need to build a post 2021 libgphoto2 from git on a system with pre 0.18.3 gettext, you can can always prepare a tarball using "make dist" on a system with gettext 0.18.3 or later, and build that tarball on the older machine. Not generating the po/Makevars file any more means that we need additional consistency checks for the parts of po/Makevars which cannot be derived from the Autoconf standard set of AC_SUBST()ed Makefile.in variables.
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/Makefile.am10
-rw-r--r--libgphoto2_port/configure.ac13
-rw-r--r--libgphoto2_port/gphoto-m4/Makefile-files2
-rw-r--r--libgphoto2_port/gphoto-m4/gp-gettext-hack.m482
-rw-r--r--libgphoto2_port/gphoto-m4/gp-gettext-setup.m4101
-rw-r--r--libgphoto2_port/po/Makevars53
6 files changed, 171 insertions, 90 deletions
diff --git a/libgphoto2_port/Makefile.am b/libgphoto2_port/Makefile.am
index 35e1302c8..69720ca2c 100644
--- a/libgphoto2_port/Makefile.am
+++ b/libgphoto2_port/Makefile.am
@@ -30,6 +30,16 @@ SUBDIRS = po libgphoto2_port . tests doc
include gphoto-m4/Makefile-files
+@GP_GETTEXT_SETUP_MK@
+
+# Dummy target to force Automake to make the all target depend on it
+all-local:
+ @:
+
+# Dummy target to force Automake to make the distclean target depend on it
+distclean-local:
+ @:
+
########################################################################
# All iolibs are defined as EXTRA_LTLIBRARIES. This requires that
diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac
index ca56478a0..674a3145c 100644
--- a/libgphoto2_port/configure.ac
+++ b/libgphoto2_port/configure.ac
@@ -118,17 +118,16 @@ dnl ---------------------------------------------------------------------------
dnl i18n support
dnl ---------------------------------------------------------------------------
-GP_GETTEXT_HACK([GETTEXT_PACKAGE_LIBGPHOTO2_PORT],
- [${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT_MIN}],
- [Lutz Mueller and others],
- [${MAIL_GPHOTO_TRANSLATION}])
+GP_GETTEXT_SETUP([GETTEXT_PACKAGE_LIBGPHOTO2_PORT],
+ [${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT_MIN}],
+ [po])
AM_PO_SUBDIRS()
-AM_GNU_GETTEXT_VERSION([0.14.1])
+AM_GNU_GETTEXT_VERSION([0.18.3])
AM_GNU_GETTEXT([external])
AM_ICONV()
-GP_GETTEXT_FLAGS()
-AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""
+GP_CONFIG_MSG([Use translations],
+ [${USE_NLS}])
AC_CHECK_FUNC([gettext], [gettext_without_libintl=true])
# same trick as with libdl in libgphoto2:
diff --git a/libgphoto2_port/gphoto-m4/Makefile-files b/libgphoto2_port/gphoto-m4/Makefile-files
index 6bc234866..a623da9c3 100644
--- a/libgphoto2_port/gphoto-m4/Makefile-files
+++ b/libgphoto2_port/gphoto-m4/Makefile-files
@@ -14,7 +14,7 @@ EXTRA_DIST += %reldir%/gp-check-shell-environment.m4
EXTRA_DIST += %reldir%/gp-config-msg.m4
EXTRA_DIST += %reldir%/gp-documentation.m4
EXTRA_DIST += %reldir%/gp-driverdir.m4
-EXTRA_DIST += %reldir%/gp-gettext-hack.m4
+EXTRA_DIST += %reldir%/gp-gettext-setup.m4
EXTRA_DIST += %reldir%/gp-internal-docs.m4
EXTRA_DIST += %reldir%/gp-libjpeg.m4
EXTRA_DIST += %reldir%/gp-libltdl.m4
diff --git a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 b/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4
deleted file mode 100644
index 01ca92742..000000000
--- a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4
+++ /dev/null
@@ -1,82 +0,0 @@
-dnl
-dnl GP_GETTEXT_HACK
-dnl
-dnl gettext hack, originally designed for libexif, libgphoto2, and Co.
-dnl This creates a po/Makevars file with adequate values if the
-dnl po/Makevars.template is present.
-dnl
-dnl Example usage:
-dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}],
-dnl [Copyright Holder],
-dnl [foo-translation@example.org])
-dnl ALL_LINGUAS="de es fr"
-dnl AM_GNU_GETTEXT_VERSION([0.14.1])
-dnl AM_GNU_GETTEXT([external])
-dnl AM_PO_SUBDIRS()
-dnl AM_ICONV()
-dnl GP_GETTEXT_FLAGS
-dnl
-dnl You can leave out the GP_GETTEXT_HACK parameters if you want to,
-dnl GP_GETTEXT_HACK will try fall back to sensible values in that case:
-dnl
-dnl
-AC_DEFUN([GP_GETTEXT_HACK], [dnl
-AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl
-AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl
-m4_if([$2],[],[$1="${PACKAGE_TARNAME}"],[$1="$2"])
-AC_DEFINE_UNQUOTED([$1], ["${$1}"],
- [The gettext domain we're using])
-AC_SUBST([$1])
-sed_cmds="s|^DOMAIN.*|DOMAIN = ${$1}|"
-m4_if([$3],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $3|"])
-m4_ifval([$4],[
-if test -n "$PACKAGE_BUGREPORT"; then
- sed_mb="${PACKAGE_BUGREPORT}"
-else
- m4_pattern_allow([GP_GETTEXT_HACK])dnl
- AC_MSG_ERROR([
-*** Your configure.{ac,in} is wrong.
-*** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax)
-*** or give [GP_GETTEXT_HACK] the third parameter.
-***
-])
-fi
-],[
-sed_mb="$4"
-])
-sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|"
-# Not so sure whether this hack is all *that* evil...
-AC_MSG_CHECKING([for po/Makevars requiring hack])
-if test -f "${srcdir}/po/Makevars.template"; then
- sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars"
- AC_MSG_RESULT([yes, done.])
-else
- AC_MSG_RESULT([no])
-fi
-])dnl
-dnl
-dnl
-dnl
-AC_DEFUN([GP_GETTEXT_FLAGS],
-[
-AC_REQUIRE([AM_GNU_GETTEXT])
-AC_REQUIRE([GP_CONFIG_INIT])
-if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then
- AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl"
-fi
-GP_CONFIG_MSG([Use translations],[${USE_NLS}])
-if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then
- GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}])
-fi
-])dnl
-dnl
-dnl
-
-dnl Please do not remove this:
-dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81
-dnl I use this to find all the different instances of this file which
-dnl are supposed to be synchronized.
-
-dnl Local Variables:
-dnl mode: autoconf
-dnl End:
diff --git a/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4 b/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4
new file mode 100644
index 000000000..a73341437
--- /dev/null
+++ b/libgphoto2_port/gphoto-m4/gp-gettext-setup.m4
@@ -0,0 +1,101 @@
+dnl ####################################################################
+dnl GP_GETTEXT_SETUP(...)
+dnl Gettext setup with e.g. consistency checks for value of DOMAIN.
+dnl ####################################################################
+dnl
+dnl Usage:
+dnl GP_GETTEXT_SETUP([DOMAIN_LIBGPHOTO2],
+dnl [libgphoto2-${LIBGPHOTO2_CURRENT_MIN}],
+dnl [po])
+dnl GP_GETTEXT_SETUP([DOMAIN_LIBGPHOTO2_PORT],
+dnl [libgphoto2_port-${LIBGPHOTO2_PORT_CURRENT_MIN}],
+dnl [libgphoto2_port/po])
+dnl
+dnl with the corresponding top level Makefile.am containing
+dnl
+dnl @GP_GETTEXT_SETUP_MK@
+dnl
+dnl # Dummy target to force Automake to make the "all" target depend on it
+dnl all-local:
+dnl @:
+dnl
+dnl # Dummy target to force Automake to make the "distclean" target depend on it
+dnl distclean-local:
+dnl @:
+dnl
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_GETTEXT_SETUP], [dnl
+AC_REQUIRE([AC_PROG_GREP])dnl
+AC_REQUIRE([GP_GETTEXT_SETUP_INIT])dnl
+dnl
+AC_MSG_CHECKING([translation text domain symbol])
+AC_MSG_RESULT([$1])
+AC_MSG_CHECKING([translation text domain value])
+AC_MSG_RESULT([$2])
+AC_MSG_CHECKING([translation subdirectory])
+AC_MSG_RESULT([$3])
+dnl
+dnl The text domain can be evaluated as a shell variable, no need for
+dnl recursive make variable evaluation, so we can put the text domain
+dnl into the include file and do not need to define it from a make
+dnl rule on the compiler command line.
+AC_DEFINE_UNQUOTED([$1], ["$2"], [text domain for string translations])
+dnl AM_CPPFLAGS="$AM_CPPFLAGS -D$1=\\\""'$2'"\\\""
+dnl AC_SUBST([$1], [$2])
+dnl
+dnl
+dnl The following check will have "make all" print something like
+dnl DOMAIN = libgphoto2-6
+dnl if the consistency check has been successful, and have "make all" abort
+dnl Error: Inconsistent values for GETTEXT_PACKAGE_LIBGPHOTO2 and po/Makevars DOMAIN.
+dnl if the consistency check has failed.
+dnl
+cat >>${GP_GETTEXT_SETUP_MK} <<EOF
+ @if \$(GREP) '^DOMAIN *= *$2\$\$' \`test -f '$3/Makevars' || echo '\$(srcdir)/'\`'$3/Makevars'; then :; else echo 'Error: Inconsistent values for $1 and po/Makevars DOMAIN'; exit 1; fi
+EOF
+dnl
+])dnl
+dnl
+dnl
+dnl ####################################################################
+dnl Setup for the po subdir specific setup
+dnl ####################################################################
+dnl
+AC_DEFUN_ONCE([GP_GETTEXT_SETUP_INIT], [dnl
+AC_BEFORE([$0], [GP_GETTEXT_SETUP])dnl
+dnl
+dnl The LOCALEDIR definition contains too many levels of recursive
+dnl make variable definitions to evaluate via shell, so we have make
+dnl resolve that instead of the shell configure script.
+AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\""'${localedir}'"\\\""
+dnl
+dnl
+AC_SUBST_FILE([GP_GETTEXT_SETUP_MK])
+GP_GETTEXT_SETUP_MK="gp-gettext-setup.mk"
+dnl
+dnl
+cat >${GP_GETTEXT_SETUP_MK} <<EOF
+
+# ${GP_GETTEXT_SETUP_MK} autogenerated by $0
+
+distclean-local: distclean-local-gp-gettext-setup
+.PHONY: distclean-local-gp-gettext-setup
+distclean-local-gp-gettext-setup:
+ -rm -f ${GP_GETTEXT_SETUP_MK}
+
+all-local: all-local-gp-gettext-setup
+.PHONY: all-local-gp-gettext-setup
+all-local-gp-gettext-setup:
+ @:
+EOF
+dnl
+dnl
+])dnl
+dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/libgphoto2_port/po/Makevars b/libgphoto2_port/po/Makevars
new file mode 100644
index 000000000..3dee2158f
--- /dev/null
+++ b/libgphoto2_port/po/Makevars
@@ -0,0 +1,53 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = libgphoto2_port-12
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --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 = Lutz Mueller and others
+
+# 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 = $(PACKAGE_BUGREPORT)
+
+# 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 =