Daiki Ueno <[email protected]> writes: > Roumen Petrov <[email protected]> writes:
[...] >> If understand idea is new archive to contain only "recent" versions. >> Lets version 0.20.* not not add "drastic" change. Lest first "drastic" >> version is 0.21. >> Would you like to distribute archive with following content: >> a) at release time of 0.20 : only subdir for 0.20 >> b) at release time of 0.20.1 : only subdir for 0.20.1 >> c) at release time of 0.20.2 : only subdir for 0.20.2. Lest this is >> last from 0.20 series >> d) at release time of 0.21 : subdirs for 0.20.2 and 0.21 >> >> If the package require gettext 0.20 in case of c) and d) macro will >> extract version 0.20.2. Right ? > > Actually, I was thinking of not using archive at all, but copying files > from the system directories (/usr/share/gettext, /usr/share/aclocal, > ...), in a similar way libtoolize does. I tried to implement this and realized that it is much easier to use an archived content instead of system files. Still, it is in question how/whether to handle "drastic" changes in the infrastructure. For what it's worth, I'm attaching the current patch. Comments and suggestions are appreciated. I'm still not very happy with the name AM_GNU_GETTEXT_PREREQ and having a separate macro in the first place, but I couldn't think of any better way to implement the functionality without breaking compatibility. Regards, -- Daiki Ueno
>From 22f4ba21861eab889e9b8c2f381550dcd4b78c20 Mon Sep 17 00:00:00 2001 From: Daiki Ueno <[email protected]> Date: Mon, 3 Aug 2015 16:30:55 +0900 Subject: [PATCH] autopoint: New macro AM_GNU_GETTEXT_PREREQ * NEWS: Mention AM_GNU_GETTEXT_PREREQ. * gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT_PREREQ): New macro. Bump serial to 67. * gettext-tools/doc/autopoint.texi: Mention AM_GNU_GETTEXT_PREREQ. * gettext-tools/misc/gettextize.in: Check if AM_GNU_GETTEXT_VERSION is used. * gettext-tools/misc/autopoint.in: Respect AM_GNU_GETTEXT_PREREQ. * gettext-tools/tests/autopoint-2: Check AM_GNU_GETTEXT_PREREQ. --- ChangeLog | 4 +++ NEWS | 7 +++++ gettext-runtime/m4/ChangeLog | 5 ++++ gettext-runtime/m4/gettext.m4 | 6 +++- gettext-tools/doc/ChangeLog | 4 +++ gettext-tools/doc/autopoint.texi | 7 +++++ gettext-tools/misc/ChangeLog | 5 ++++ gettext-tools/misc/autopoint.in | 55 ++++++++++++++++++++++++++++-------- gettext-tools/misc/gettextize.in | 7 +++-- gettext-tools/tests/ChangeLog | 4 +++ gettext-tools/tests/autopoint-2 | 60 ++++++++++++++++++++++++++++++++++++++++ 11 files changed, 149 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86b549b..fa4fd03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-07-28 Daiki Ueno <[email protected]> + + * NEWS: Mention AM_GNU_GETTEXT_PREREQ. + 2015-07-12 Daiki Ueno <[email protected]> build: Avoid link error on Mac OS X < 10.6 diff --git a/NEWS b/NEWS index 612367f..2e3225b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Version 0.19.6 - unreleased + +* A new Autoconf macro AM_GNU_GETTEXT_PREREQ can be used to indicate + autopoint and gettextize to copy the latest available gettext + infrastructure to a source package, instead of the exact version + specified with AM_GNU_GETTEXT_VERSION. + Version 0.19.5 - July 2015 * xgettext now has a feature to perform syntax checks on msgid, which diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog index 3ef9da6..62347f3 100644 --- a/gettext-runtime/m4/ChangeLog +++ b/gettext-runtime/m4/ChangeLog @@ -1,3 +1,8 @@ +2015-07-28 Daiki Ueno <[email protected]> + + * gettext.m4 (AM_GNU_GETTEXT_PREREQ): New macro. Bump serial to + 67. + 2015-07-10 Daiki Ueno <[email protected]> * gettext 0.19.5 released. diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index be247bf..c30dc73 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 66 (gettext-0.18.2) +# gettext.m4 serial 67 (gettext-0.19.6) dnl Copyright (C) 1995-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -399,3 +399,7 @@ AC_DEFUN([AM_GNU_GETTEXT_NEED], dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + + +dnl Usage: AM_GNU_GETTEXT_PREREQ([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_PREREQ], []) diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index d236412..bfc4591 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-07-28 Daiki Ueno <[email protected]> + + * autopoint.texi: Mention AM_GNU_GETTEXT_PREREQ. + 2015-07-10 Daiki Ueno <[email protected]> * gettext 0.19.5 released. diff --git a/gettext-tools/doc/autopoint.texi b/gettext-tools/doc/autopoint.texi index a2827ed..e7ae571 100644 --- a/gettext-tools/doc/autopoint.texi +++ b/gettext-tools/doc/autopoint.texi @@ -11,6 +11,13 @@ into a source package. It extracts from a macro call of the form used by the package, and copies the infrastructure files belonging to this version into the package. +To extract the latest available infrastructure which satisfies a version +requirement, then you can use the form +@code{AM_GNU_GETTEXT_PREREQ(@var{version})} instead. For example, if +gettext @value{VERSION} is installed on your system and @code{0.19.1} is +requested, then the infrastructure files of version @value{VERSION} will +be copied into a source package. + @subsubsection Options @table @samp diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 53c25cc..3dc60b2 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,5 +1,10 @@ 2015-07-28 Daiki Ueno <[email protected]> + * gettextize.in: Check if AM_GNU_GETTEXT_VERSION is used. + * autopoint.in: Respect AM_GNU_GETTEXT_PREREQ. + +2015-07-28 Daiki Ueno <[email protected]> + * gettextize.in (archive_version): New variable, set to ARCHIVE_VERSION. Use it as the argument of AM_GNU_GETTEXT_VERSION. diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index d7ce4f7..49d588b 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -23,6 +23,7 @@ progname=$0 package=@PACKAGE@ version=@VERSION@ +archive_version=@ARCHIVE_VERSION@ # Set variables # - gettext_datadir directory where the data files are stored. @@ -313,29 +314,59 @@ else func_trace=func_trace_sed fi -# Check whether the -V option and the version number in configure.in match. -# At least one of the two must be given. If both are given, they must agree. +# func_version_prereq required_version version +# compares the required version and the latest archive version. +func_version_prereq () +{ + req="$1" + ver="$2" + echo "m4_if(m4_version_compare([$ver], [$req]), [-1], [m4_exit([1])])" \ + | "$AUTOM4TE" --language=M4sugar 2>&1 >/dev/null +} + +# If AM_GNU_GETTEXT_PREREQ is used and archive_version is newer than +# that, use archive_version. +xreq=`func_trace_sed AM_GNU_GETTEXT_PREREQ "$configure_in"` # Need to use func_trace_sed instead of $func_trace, since # AM_GNU_GETTEXT_VERSION is not a standard Autoconf trace. xver=`func_trace_sed AM_GNU_GETTEXT_VERSION "$configure_in"` -if test -z "$xver" && test -f intl/VERSION; then - xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'` + +# Prefer AM_GNU_GETTEXT_PREREQ over AM_GNU_GETTEXT_VERSION if both are +# specified. +if test -n "$xreq" && test -n "$xver"; then + echo "autopoint: using AM_GNU_GETTEXT_PREREQ instead of AM_GNU_GETTEXT_VERSION" fi -if test -n "$xver"; then - if test -n "$ver"; then - if test "X$ver" != "X$xver"; then - func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver" - fi + +if test -n "$xreq"; then + if func_version_prereq "$xreq" "$archive_version"; then + ver="$archive_version" else - ver="$xver" + func_fatal_error "gettext version $xreq or newer is required" fi else - if test -z "$ver"; then - func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using" + if test -z "$xver" && test -f intl/VERSION; then + xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'` + fi + + # Check whether the -V option and the version number in configure.in match. + # At least one of the two must be given. If both are given, they must agree. + + if test -n "$xver"; then + if test -n "$ver"; then + if test "X$ver" != "X$xver"; then + func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver" + fi + else + ver="$xver" + fi fi fi +if test -z "$ver"; then + func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using" +fi + # Check whether the version number is supported. case "$ver" in 0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \ diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index bd7eb92..294664b 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -1236,8 +1236,11 @@ sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* * func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile." sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" func_modify_configure_in "(AC_LINK_FILES): Remove invocation." -sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" -func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version." +# AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_PREREQ is used. +if grep '^AM_GNU_GETTEXT_VERSION' "$srcdir/$configure_in" 2>&1 >/dev/null; then + sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version." +fi $do_changelog && func_ChangeLog_finish # Recommend replacement for deprecated Makefile variables. diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index 042886e..af90abf 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,5 +1,9 @@ 2015-07-28 Daiki Ueno <[email protected]> + * autopoint-2: Add checks for AM_GNU_GETTEXT_PREREQ. + +2015-07-28 Daiki Ueno <[email protected]> + * init-env.in (ARCHIVE_VERSION): New substituted variable. * autopoint-2: Use ARCHIVE_VERSION, instead of the hard-coded version string. diff --git a/gettext-tools/tests/autopoint-2 b/gettext-tools/tests/autopoint-2 index c807b3a..ea4bdbe 100755 --- a/gettext-tools/tests/autopoint-2 +++ b/gettext-tools/tests/autopoint-2 @@ -166,3 +166,63 @@ test -f m4/po.m4 || exit 1 test -f po/Makefile.in.in || exit 1 rm -fr m4 po + +# Check for AM_GNU_GETTEXT_PREREQ. +cat <<EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC +AM_GNU_GETTEXT_PREREQ([0.19]) +AM_GNU_GETTEXT([external]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +$gettext_datadir/autopoint >/dev/null 2>autopoint.err +test $? = 0 || { cat autopoint.err; exit 1; } + +test ! -d intl || exit 1 +test -d m4 || exit 1 +test -d po || exit 1 + +test -f m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 + +# Check for the case where both AM_GNU_GETTEXT_PREREQ and +# AM_GNU_GETTEXT_VERSION are used. +cat <<EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC +AM_GNU_GETTEXT +AM_GNU_GETTEXT_PREREQ([0.19]) +# This shall be ignored when AM_GNU_GETTEXT_PREREQ is defined +AM_GNU_GETTEXT_VERSION([0.19]) + +AC_CONFIG_MACRO_DIR([m4]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +$gettext_datadir/autopoint >autopoint.out 2>autopoint.err +test $? = 0 || { cat autopoint.err; exit 1; } + +grep 'using AM_GNU_GETTEXT_PREREQ' autopoint.out 2>&1 >/dev/null || exit 1 + +test -d intl || exit 1 +test -d m4 || exit 1 +test -d po || exit 1 + +cat >autopoint.ver <<EOF +GNU gettext library from gettext-$ARCHIVE_VERSION +EOF +: ${DIFF=diff} +${DIFF} autopoint.ver intl/VERSION || exit 1 +test -f m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 -- 2.4.3
