From 4008119bcc321096bde69d3e81a4d6af76e5c7b9 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 20 Oct 2011 22:17:23 +0700 Subject: [PATCH] maint: use gnulib's git-version-gen instead of mkstamp. * libltdl/config/mkstamp: File removed. * bootstrap.conf (gnulib_modules): Add git-version-gen. * configure.ac (AC_INIT, package_revision): Use git-version-gen to calculate version number. (TIMESTAMP): Removed. * libtoolize.m4sh, libltdl/config/ltmain.m4sh, libltdl/m4/libtool.m4 (TIMESTAMP): Ditto. * Makefile.am (TIMESTAMP): Ditto. (MKSTAMP): Renamed from this... (git_version_gen): ...to this. Set revision here. An alpha is now a release with an odd micro relase number. (rebuild): Don't reset revision here. (build_scripts): Remove mkstamp, add git-version-gen. (EXTRA_DIST, BUILT_SOURCES): Add .version. (libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4, tests/package.m4): Don't depend on configure.ac or ChangeLog to determine when the version number has reved, use .version directly. (.version): Flush most recent configure calculated VERSION to disk. (dist-hook): Flush current VERSION to disk at dist time. (dotserial): Distributed file to cache the serial number for when git is not available to recalculate it when building from a release tarball. (dist-hook): Make sure .serial is created. (libltdl/config/ltversion.m4): Use .serial when it is present (in a dist tarball) or calculate with git otherwise (in a git working directory). (EXTRA_DIST): Add .serial file. Signed-off-by: Gary V. Vaughan --- .gitignore | 1 + ChangeLog | 23 ++++++++++ Makefile.am | 87 +++++++++++++++++++++++--------------- bootstrap.conf | 1 + configure.ac | 26 ++++-------- libltdl/config/.gitignore | 1 + libltdl/config/ltmain.m4sh | 19 ++++----- libltdl/config/mkstamp | 48 --------------------- libltdl/m4/libtool.m4 | 3 +- libtoolize.m4sh | 4 +- 10 files changed, 100 insertions(+), 113 deletions(-) delete mode 100755 libltdl/config/mkstamp diff --git a/.gitignore b/.gitignore index ba06b16d..188d1eb4 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ .libs /.pc /.sc-start* +/.version /COPYING /GNUmakefile /INSTALL diff --git a/ChangeLog b/ChangeLog index 90f57bcc..586b6f33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2011-10-20 Gary V. Vaughan + + maint: use gnulib's git-version-gen instead of mkstamp. + * libltdl/config/mkstamp: File removed. + * bootstrap.conf (gnulib_modules): Add git-version-gen. + * configure.ac (AC_INIT, package_revision): Use git-version-gen to + calculate version number. + (TIMESTAMP): Removed. + * libtoolize.m4sh, libltdl/config/ltmain.m4sh, libltdl/m4/libtool.m4 + (TIMESTAMP): Ditto. + * Makefile.am (TIMESTAMP): Ditto. + (MKSTAMP): Renamed from this... + (git_version_gen): ...to this. Set revision here. An alpha is now a + release with an odd micro relase number. + (rebuild): Don't reset revision here. + (build_scripts): Remove mkstamp, add git-version-gen. + (EXTRA_DIST, BUILT_SOURCES): Add .version. + (libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4, tests/package.m4): + Don't depend on configure.ac or ChangeLog to determine when the + version number has reved, use .version directly. + (.version): Flush most recent configure calculated VERSION to disk. + (dist-hook): Flush current VERSION to disk at dist time. + 2011-10-18 Gary V. Vaughan maint: use gnulib's maint.mk and support scripts release procedure. diff --git a/Makefile.am b/Makefile.am index b8f1a70d..1ebffc9a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,15 +51,8 @@ LT_M4SH = $(M4SH) -B '$(m4sh_dir)' # Using `cd' in backquotes may print the directory name, use this instead: lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -MKSTAMP = '$(SHELL)' '$(aux_dir)/mkstamp' - -timestamp = set dummy `$(MKSTAMP) '$(srcdir)'`; shift; \ - case $(VERSION) in \ - *[acegikmoqsuwy]) TIMESTAMP=" $$1 $$2" ;; \ - *) TIMESTAMP="" ;; \ - esac - -rebuild = rebuild=:; $(timestamp); revision=$$1 +git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version' +rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | sed 's,-.*$$,,g'` # ---------- # @@ -75,9 +68,8 @@ ltmain_m4sh = $(m4sh_dir)/ltmain.m4sh sh_files = $(general_m4sh) $(getopt_m4sh) build_scripts = $(aux_dir)/announce-gen $(aux_dir)/cvsu \ $(aux_dir)/do-release-commit-and-tag \ - $(aux_dir)/gendocs.sh \ + $(aux_dir)/gendocs.sh $(aux_dir)/git-version-gen \ $(aux_dir)/gnu-web-doc-update $(aux_dir)/gnupload \ - $(aux_dir)/mkstamp \ $(aux_dir)/useless-if-before-free $(aux_dir)/vc-list-files EXTRA_DIST += bootstrap bootstrap.conf $(build_scripts) cfg.mk maint.mk \ @@ -120,7 +112,6 @@ bootstrap_edit = $(SED) \ -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \ -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \ -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \ - -e "s,@TIMESTAMP\@,$$TIMESTAMP,g" \ -e 's,@VERSION\@,$(VERSION),g' ## ltmain.sh needs some additional editing to remove unsubstituted @@ -137,18 +128,22 @@ ltmain_sh_edit = $(bootstrap_edit) \ ## We used to do this with a 'stamp-vcl' file, but non-gmake builds ## would rerun configure on every invocation, so now we manually ## check the version numbers from the build rule when necessary. -$(ltversion_m4): $(ltversion_in) $(configure_ac) ChangeLog +$(ltversion_m4): $(ltversion_in) $(dotversion) @$(rebuild); \ if test -f '$@'; then \ eval `'$(SED)' -n '/^macro_revision=/p' '$@'`; \ test x"$$macro_revision" = x"$$revision" && rebuild=false; \ fi; \ for prereq in $?; do \ - case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \ + case $$prereq in *.version);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ rm -f '$@'; \ - serial=`echo "$$revision" |$(SED) 's,^1[.],,g'`; \ + if test -f '$(srcdir)/.serial'; then \ + serial=`cat '$(srcdir)/.serial'`; \ + else \ + serial=`$(git_commit_count)`; \ + fi; \ echo "$(bootstrap_edit) '$(ltversion_in)' > '$@'"; \ $(bootstrap_edit) '$(ltversion_in)' > '$@'; \ chmod a-w '$@'; \ @@ -164,14 +159,14 @@ $(ltversion_m4): $(ltversion_in) $(configure_ac) ChangeLog ## should make this rule depend on Makefile but that will break ## distcheck (at least) by rebuilding ltmain.sh in the source ## tree whenever config.status regenerates the Makefile. -$(ltmain_sh): $(ltmain_m4sh) $(sh_files) $(configure_ac) ChangeLog +$(ltmain_sh): $(ltmain_m4sh) $(sh_files) $(dotversion) @$(rebuild); \ if test -f '$@'; then \ eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \ test x"$$package_revision" = x"$$revision" && rebuild=false; \ fi; \ for prereq in $?; do \ - case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ + case $$prereq in *.version);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ rm -f '$@'; \ @@ -295,14 +290,14 @@ libtoolize: $(libtoolize_in) $(config_status) # We used to do this with a 'stamp-vcl' file, but non-gmake builds # would rerun configure on every invocation, so now we manually # check the version numbers from the build rule when necessary. -libtool: $(ltmain_sh) $(config_status) ChangeLog +libtool: $(ltmain_sh) $(config_status) $(dotversion) @$(rebuild); \ if test -f '$@'; then \ eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \ test "$$package_revision" = "$$revision" && rebuild=false; \ fi; \ for prereq in $?; do \ - case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \ + case $$prereq in *.version);; *) rebuild=:;; esac; \ done; \ if $$rebuild; then \ echo '$(SHELL) ./config.status "$@"'; \ @@ -491,9 +486,42 @@ install-data-local: $(lt_Makefile_in) ## Distribution. ## ## ------------- ## -edit_readme_alpha = $(aux_dir)/edit-readme-alpha +edit_readme_alpha = $(aux_dir)/edit-readme-alpha +dotserial = $(distdir)/.serial +dotversion = $(srcdir)/.version +tarball_version = $(distdir)/.tarball-version + + +## Arrange so that .tarball-version appears only in the distribution +## tarball, and never in a checked-out repository. +EXTRA_DIST += $(dotversion) +BUILT_SOURCES += $(dotversion) +$(dotversion): + echo '$(VERSION)' > '$@T' && mv '$@T' '$@' + +## Edit the README file for alpha releases. EXTRA_DIST += $(edit_readme_alpha) +re_odd_version = '\([0-9][0-9]*.[0-9][0-9]*.[0-9]*[13579]\)' +$(readme): FORCE + test -n `expr $(VERSION) : $(re_odd_version)` && \ + $(SHELL) $(edit_readme_alpha) '$@' + +git_commit_count = git log --pretty=oneline |wc -l |$(SED) 's,[ ],,g' + +dist-hook: $(dotversion) $(readme) +## Arrange so that .tarball-version appears only in the distribution +## tarball, and never in a checked-out repository. + echo '$(VERSION)' > $(tarball_version) +## ...and similarly for .serial. + $(git_commit_count) > $(dotserial) +## Ensure aclocal has not wrongly picked up old macro definitions. + for macro in LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL; do \ + if grep "$$macro" '$(srcdir)/aclocal.m4' '$(lt_aclocal_m4)'; then \ + echo "Bogus $$macro macro contents in an aclocal.m4 file." >&2; \ + exit 1; \ + else :; fi; \ + done uninstall-hook: @$(NORMAL_UNINSTALL) @@ -507,19 +535,6 @@ uninstall-hook: rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \ done -dist-hook: -## Edit the README file for alpha releases. - case $(VERSION) in \ - *[a-z]) $(SHELL) $(edit_readme_alpha) $(distdir)/README ;; \ - esac -## Ensure aclocal has not wrongly picked up old macro definitions. - for macro in LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL; do \ - if grep "$$macro" '$(srcdir)/aclocal.m4' '$(lt_aclocal_m4)'; then \ - echo "Bogus $$macro macro contents in an aclocal.m4 file." >&2; \ - exit 1; \ - else :; fi; \ - done - ## ----------- ## ## Test suite. ## @@ -630,7 +645,7 @@ INSTALLCHECK_ENVIRONMENT = \ $(testsuite): $(package_m4) $(TESTSUITE_AT) Makefile.am $(AUTOTEST) -I '$(srcdir)' -I '$(srcdir)/tests' $(TESTSUITE_AT) -o '$@' -$(package_m4): $(configure_ac) Makefile.am +$(package_m4): $(dotversion) Makefile.am { \ echo '# Signature of the current package.'; \ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ @@ -1018,3 +1033,7 @@ fake-distclean-legacy: $(TESTS): $(defs) DISTCLEANFILES += $(defs) + +## An empty target to depend on when a rule needs to always run +## whenever it is visited. +FORCE: diff --git a/bootstrap.conf b/bootstrap.conf index bd68e32c..dacb211b 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -63,6 +63,7 @@ gnulib_modules=' announce-gen do-release-commit-and-tag gendocs + git-version-gen gnu-web-doc-update gnupload maintainer-makefile diff --git a/configure.ac b/configure.ac index c51ec287..b2aff61a 100644 --- a/configure.ac +++ b/configure.ac @@ -31,9 +31,11 @@ dnl Oldest automake required for bootstrap is below in AM_INIT_AUTOMAKE. ## ------------------------ ## ## Autoconf initialisation. ## ## ------------------------ ## -AC_INIT([GNU Libtool], [2.4.3a], [bug-libtool@gnu.org]) +AC_INIT([GNU Libtool], + m4_esyscmd([libltdl/config/git-version-gen .tarball-version]), + [bug-libtool@gnu.org]) m4_ifndef([AC_PACKAGE_URL], - [AC_SUBST([PACKAGE_URL], [http://www.gnu.org/software/libtool/])]) + [AC_SUBST([PACKAGE_URL], [http://www.gnu.org/s/libtool/])]) # Since we already declare these directories in this file, save those # choices, and push the results into Makefile.am to avoid declaring @@ -53,6 +55,8 @@ AC_CONFIG_AUX_DIR([libltdl/config]) AC_CONFIG_MACRO_DIR([libltdl/m4]) AC_CONFIG_LIBOBJ_DIR([libltdl]) +package_revision=`$SHELL $ac_aux_dir/git-version-gen .tarball-version` +AC_SUBST([package_revision]) ## ------------------------ ## ## Autotest initialisation. ## @@ -68,20 +72,8 @@ AC_SUBST([AUTOTEST], ['$(AUTOM4TE) --language=autotest']) ## ---------------------------------------- ## # This is a sanity check so we can see which version is used in bug reports. -# It is assumed that we only want to see the date extension for cvs libtool -# versions (i.e. "odd" letters) and not actual alpha releases. -TIMESTAMP=`${CONFIG_SHELL} ${ac_aux_dir}/mkstamp ${srcdir}` -package_revision=`( set $TIMESTAMP; echo $1; )` -case $package_revision in - *[[bdfhjlnprtvxz]]) - TIMESTAMP= - ;; -esac -timestamp_string="${TIMESTAMP:+ (Build:$TIMESTAMP)}" -AS_BOX([Configuring AC_PACKAGE_TARNAME$timestamp_string AC_PACKAGE_VERSION]) +AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION]) echo -AC_SUBST([TIMESTAMP]) -AC_SUBST([package_revision]) ## ------------------------ ## @@ -101,7 +93,7 @@ AM_INIT_AUTOMAKE([1.11.1 gnu subdir-objects dist-xz color-tests parallel-tests]) # You can set autobuild_mode at configure time to specify a "unique" # string for this build. : ${autobuild_mode=default} -AB_VERSION="AC_PACKAGE_VERSION ($TIMESTAMP)" +AB_VERSION="AC_PACKAGE_VERSION" AB_INIT([$autobuild_mode]) @@ -109,7 +101,7 @@ dnl We use m4sh to generate libtool's portable shell scripts AC_SUBST([M4SH], ['$(AUTOM4TE) --language=m4sh']) dnl Make sure config.status is regenerated when the version timestamp changes -AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/ChangeLog']) +AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(srcdir)/.version']) ## ------------------------------- ## diff --git a/libltdl/config/.gitignore b/libltdl/config/.gitignore index 3bbb989b..84c6e1df 100644 --- a/libltdl/config/.gitignore +++ b/libltdl/config/.gitignore @@ -3,6 +3,7 @@ /depcomp /do-release-commit-and-tag /gendocs.sh +/git-version-gen /gnu-web-doc-update /gnupload /install-sh diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 26413270..e8c7d51e 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -1,6 +1,6 @@ m4_define([_m4_divert(SCRIPT)], 100) m4_divert_push([SCRIPT]) -# libtool (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ +# libtool (GNU @PACKAGE@) @VERSION@ # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, @@ -71,7 +71,7 @@ m4_divert_push([SCRIPT]) # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ +# $progname: (GNU @PACKAGE@) @VERSION@ # automake: $automake_version # autoconf: $autoconf_version # @@ -82,7 +82,6 @@ m4_divert_push([SCRIPT]) PROGRAM=libtool PACKAGE=@PACKAGE@ VERSION=@VERSION@ -TIMESTAMP="@TIMESTAMP@" package_revision=@package_revision@ # Be Bourne compatible @@ -663,7 +662,7 @@ func_write_libtool_object () $opt_dry_run || { cat >${write_libobj}T < "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { @@ -3054,7 +3053,7 @@ func_emit_wrapper () #! $SHELL # $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. @@ -3146,7 +3145,7 @@ func_parse_lt_options () # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } @@ -3353,7 +3352,7 @@ func_emit_cwrapperexe_src () cat < $output "\ # $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. diff --git a/libltdl/config/mkstamp b/libltdl/config/mkstamp deleted file mode 100755 index edd5be1b..00000000 --- a/libltdl/config/mkstamp +++ /dev/null @@ -1,48 +0,0 @@ -#! /bin/sh - -# mkstamp - extract data from Revision and Date RCS tags in a file -# Copyright (C) 1999, 2003 Free Software Foundation, Inc. -# Written by Alexandre Oliva, 1999 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -# This script takes a directory as an argument and generates a -# revision and date based upon the ChangeLog files in that directory. - -# Generate a revision that looks similar to CVS revision by using 1. -# then the number of lines in the ChangeLogs starting with dates (an -# approximation of the number of commits) + 1000. -# For those pulling from the savannah git repository it should be -# possible to go from this revision number to the git revision fairly -# easily. The number will also always increase. - -awk 'BEGIN { - cocount=0; -} -/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] / { - if (cocount== 0) { - datestr=$1 - } - cocount++; -} -END { - cocount = cocount + 1000; - print "1." cocount " " datestr; -}' $1/ChangeLog $1/ChangeLog.[12][0-9][0-9][0-9] diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 44e0ecff..00c11026 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -719,7 +719,7 @@ _LT_CONFIG_SAVE_COMMANDS([ #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # @@ -775,7 +775,6 @@ _LT_EOF [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS diff --git a/libtoolize.m4sh b/libtoolize.m4sh index 69fd37f3..1626c177 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -1,6 +1,6 @@ m4_pattern_allow([dnl]) AS_INIT[]m4_divert_push([HEADER-COPYRIGHT]) -# libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ +# libtoolize (GNU @PACKAGE@) @VERSION@ # Written by Gary V. Vaughan , 2003 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@ -59,7 +59,7 @@ AS_INIT[]m4_divert_push([HEADER-COPYRIGHT]) # include the following information: # # host-triplet: @host_triplet@ -# $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ +# $progname: (GNU @PACKAGE@) @VERSION@ # automake: $automake_version # autoconf: $autoconf_version #