build: Improve package version handling.

* autogen.sh: Copy also m4/init-package-version.m4, m4/version-stamp.m4.
* configure.ac: Use gl_INIT_PACKAGE and gl_CONFIG_VERSION_STAMP.
* gettext-runtime/configure.ac: Use gl_INIT_PACKAGE.
* gettext-runtime/intl/configure.ac: Likewise.
* gettext-tools/configure.ac: Likewise.
* gettext-tools/examples/configure.ac: Likewise.
* Makefile.am (dist-tarball-version): New target.
($(top_srcdir)/.version): Remove target.
This commit is contained in:
Bruno Haible 2025-01-23 10:13:43 +01:00
parent 4d646fd75e
commit 53e5da8c8d
8 changed files with 48 additions and 24 deletions

2
.gitignore vendored
View File

@ -388,6 +388,8 @@
/gettext-tools/tests/gnulib-lib/
!/gettext-tools/tests/gnulib-lib/Makefile.am
/gettext-tools/tests/init.sh
/m4/init-package-version.m4
/m4/version-stamp.m4
# Files brought in by "automake --add-missing --copy":
/build-aux/compile

View File

@ -1,5 +1,5 @@
## Makefile for the toplevel directory of GNU gettext
## Copyright (C) 1995-2024 Free Software Foundation, Inc.
## Copyright (C) 1995-2025 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@ -98,12 +98,13 @@ EXTRA_DIST += INSTALL.aix
# Versioning based on Git release tags.
dist-hook: dist-tarball-version
.PHONY: dist-tarball-version
dist-tarball-version:
echo '$(VERSION)' > $(distdir)/.tarball-version
EXTRA_DIST += $(top_srcdir)/.version
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook: gen-ChangeLogs
echo $(VERSION) > $(distdir)/.tarball-version
# Support for "make dist" without prior "make".
@ -120,6 +121,8 @@ distdir1:
# Generate ChangeLog.
dist-hook: gen-ChangeLogs
gen_start_date = 2015-10-13
.PHONY: gen-ChangeLogs
gen-ChangeLogs:

View File

@ -465,6 +465,8 @@ if ! $skip_gnulib; then
$GNULIB_TOOL --copy-file build-aux/update-copyright || exit $?
$GNULIB_TOOL --copy-file build-aux/useless-if-before-free || exit $?
$GNULIB_TOOL --copy-file build-aux/vc-list-files || exit $?
$GNULIB_TOOL --copy-file m4/init-package-version.m4 || exit $?
$GNULIB_TOOL --copy-file m4/version-stamp.m4 || exit $?
$GNULIB_TOOL --copy-file top/GNUmakefile . || exit $?
$GNULIB_TOOL --copy-file top/maint.mk . || exit $?

View File

@ -17,11 +17,14 @@ dnl along with this program. If not, see <https://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([gettext],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[bug-gettext@gnu.org])
AC_INIT
PACKAGE_BUGREPORT='bug-gettext@gnu.org'
AC_CONFIG_SRCDIR([gettext-tools/src/msgfmt.c])
AC_CONFIG_AUX_DIR([build-aux])
VERSION_NUMBER=`cd $srcdir \
&& build-aux/git-version-gen .tarball-version \
| sed -e 's/dirty$/modified/'`
gl_INIT_PACKAGE([gettext], [$VERSION_NUMBER])
AM_INIT_AUTOMAKE([1.13 silent-rules parallel-tests tar-ustar])
dnl Override automake's tar command used for creating distributions:
@ -61,4 +64,6 @@ AC_CONFIG_FILES([Makefile],
AC_CONFIG_FILES([gnulib-local/Makefile])
gl_CONFIG_VERSION_STAMP
AC_OUTPUT

View File

@ -1,5 +1,5 @@
dnl Configuration for the gettext-runtime directory of GNU gettext
dnl Copyright (C) 1995-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -17,11 +17,14 @@ dnl along with this program. If not, see <https://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([gettext-runtime],
m4_esyscmd([../build-aux/git-version-gen ../.tarball-version]),
[bug-gettext@gnu.org])
AC_INIT
PACKAGE_BUGREPORT='bug-gettext@gnu.org'
AC_CONFIG_SRCDIR([intl/dcigettext.c])
AC_CONFIG_AUX_DIR([../build-aux])
VERSION_NUMBER=`cd $srcdir/.. \
&& build-aux/git-version-gen .tarball-version \
| sed -e 's/dirty$/modified/'`
gl_INIT_PACKAGE([gettext-runtime], [$VERSION_NUMBER])
AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
AC_CONFIG_HEADERS([config.h])

View File

@ -1,5 +1,5 @@
dnl Configuration for the gettext-runtime directory of GNU gettext
dnl Copyright (C) 1995-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -17,11 +17,14 @@ dnl along with this program. If not, see <https://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([libintl],
m4_esyscmd([../../build-aux/git-version-gen ../../.tarball-version]),
[bug-gettext@gnu.org])
AC_INIT
PACKAGE_BUGREPORT='bug-gettext@gnu.org'
AC_CONFIG_SRCDIR([dcigettext.c])
AC_CONFIG_AUX_DIR([../../build-aux])
VERSION_NUMBER=`cd $srcdir/../.. \
&& build-aux/git-version-gen .tarball-version \
| sed -e 's/dirty$/modified/'`
gl_INIT_PACKAGE([libintl], [$VERSION_NUMBER])
AM_INIT_AUTOMAKE([silent-rules])
AC_CONFIG_HEADERS([config.h])

View File

@ -1,5 +1,5 @@
dnl Configuration for the gettext-tools directory of GNU gettext
dnl Copyright (C) 1995-2024 Free Software Foundation, Inc.
dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -17,11 +17,14 @@ dnl along with this program. If not, see <https://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([gettext-tools],
m4_esyscmd([../build-aux/git-version-gen ../.tarball-version]),
[bug-gettext@gnu.org])
AC_INIT
PACKAGE_BUGREPORT='bug-gettext@gnu.org'
AC_CONFIG_SRCDIR([src/msgfmt.c])
AC_CONFIG_AUX_DIR([../build-aux])
VERSION_NUMBER=`cd $srcdir/.. \
&& build-aux/git-version-gen .tarball-version \
| sed -e 's/dirty$/modified/'`
gl_INIT_PACKAGE([gettext-tools], [$VERSION_NUMBER])
AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
AC_CONFIG_HEADERS([config.h])

View File

@ -1,5 +1,5 @@
dnl Configuration for the gettext-tools/examples directory of GNU gettext
dnl Copyright (C) 2006, 2009, 2014, 2019-2020 Free Software Foundation, Inc.
dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -17,11 +17,14 @@ dnl along with this program. If not, see <https://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([gettext-examples],
m4_esyscmd([../../build-aux/git-version-gen ../../.tarball-version]),
[bug-gettext@gnu.org])
AC_INIT
PACKAGE_BUGREPORT='bug-gettext@gnu.org'
AC_CONFIG_SRCDIR([installpaths.in])
AC_CONFIG_AUX_DIR([../../build-aux])
VERSION_NUMBER=`cd $srcdir/../.. \
&& build-aux/git-version-gen .tarball-version \
| sed -e 's/dirty$/modified/'`
gl_INIT_PACKAGE([gettext], [$VERSION_NUMBER])
AM_INIT_AUTOMAKE([silent-rules])
dnl Installation directories.