mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-26 16:09:26 +00:00
Compute PACKAGE_VERSION automatically from the repository
This commit is contained in:
parent
704083c7bd
commit
e0a0b12a42
10
ChangeLog
10
ChangeLog
@ -8,6 +8,16 @@
|
||||
(dist): Make work for DISTFILES in subdirectories. Normalize and
|
||||
sort DISTFILES.
|
||||
|
||||
* Makefile.in (MISC): Add VERSION.
|
||||
(FORCE): New target.
|
||||
(VERSION): Recompute automatically from repository.
|
||||
(configure): Depend on VERSION. Regenerate with --force: autoconf
|
||||
does not recognize the dependency between VERSION and ocnfigure.
|
||||
(config.hin): Regenerate with --force.
|
||||
(maintainer-clean): Also remove VERSION.
|
||||
* configure.ac: Compute PACKAGE_VERSION from repository.
|
||||
* update-version.sh: New file.
|
||||
|
||||
2009-03-19 Andreas Gruenbacher <agruen@suse.de>
|
||||
|
||||
Imported from Paul Eggert's working directory:
|
||||
|
||||
18
Makefile.in
18
Makefile.in
@ -85,10 +85,9 @@ HDRS = argmatch.h backupfile.h common.h dirname.h \
|
||||
inp.h maketime.h partime.h pch.h \
|
||||
quote.h quotearg.h quotesys.h \
|
||||
unlocked-io.h util.h version.h xalloc.h
|
||||
MISC = AUTHORS COPYING ChangeLog INSTALL Makefile.in NEWS README \
|
||||
aclocal.m4 \
|
||||
config.hin configure configure.ac \
|
||||
install-sh mkinstalldirs patch.man stdbool_.h timespec.h
|
||||
MISC = AUTHORS COPYING ChangeLog INSTALL Makefile.in NEWS README VERSION \
|
||||
aclocal.m4 config.hin configure configure.ac install-sh \
|
||||
mkinstalldirs patch.man stdbool_.h timespec.h
|
||||
DISTFILES = $(MISC) $(SRCS) $(HDRS) $(ACINCLUDE_INPUTS) \
|
||||
pc/chdirsaf.c pc/djgpp/config.sed pc/djgpp/configure.bat \
|
||||
pc/djgpp/configure.sed pc/djgpp/README
|
||||
@ -129,12 +128,15 @@ uninstall::
|
||||
|
||||
Makefile: Makefile.in $(CONFIG_STATUS)
|
||||
$(SHELL) $(CONFIG_STATUS)
|
||||
FORCE:
|
||||
VERSION: FORCE
|
||||
@cd $(srcdir) && $(SHELL) update-version.sh VERSION
|
||||
config.status: configure
|
||||
$(SHELL) $(CONFIG_STATUS) --recheck
|
||||
configure: configure.ac $(srcdir)/aclocal.m4
|
||||
cd $(srcdir) && autoconf
|
||||
configure: configure.ac $(srcdir)/aclocal.m4 $(srcdir)/VERSION
|
||||
cd $(srcdir) && autoconf --force
|
||||
config.hin: configure.ac $(srcdir)/aclocal.m4
|
||||
cd $(srcdir) && rm -f config.hin && autoheader
|
||||
cd $(srcdir) && autoheader --force
|
||||
stdbool.h: stdbool_.h
|
||||
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t
|
||||
mv $@-t $@
|
||||
@ -189,7 +191,7 @@ maintainer-clean::
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "rebuilding the deleted files requires special tools."
|
||||
$(MAKE) distclean
|
||||
rm -f TAGS aclocal.m4 config.hin configure
|
||||
rm -f TAGS VERSION aclocal.m4 config.hin configure
|
||||
|
||||
PV = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
|
||||
|
||||
|
||||
@ -19,7 +19,12 @@
|
||||
# 02110-1301, USA.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(patch, 2.5.9, bug-patch@gnu.org)
|
||||
define(AC_PACKAGE_VERSION, m4_normalize(esyscmd(
|
||||
[
|
||||
. update-version.sh VERSION
|
||||
cat VERSION
|
||||
])))
|
||||
AC_INIT(patch, AC_PACKAGE_VERSION, bug-patch@gnu.org)
|
||||
AC_CONFIG_SRCDIR(patch.c)
|
||||
AC_CONFIG_HEADER(config.h:config.hin)
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
32
update-version.sh
Normal file
32
update-version.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#! /bin/sh
|
||||
|
||||
# (Re)compute version from git repostitory
|
||||
# Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# in any medium, are permitted without royalty provided the copyright
|
||||
# notice and this notice are preserved.
|
||||
|
||||
# The version generated is of the form TAG[-SHORTREF[-dirty]], with
|
||||
# TAG being the closest tag to the current version and SHORTREF being
|
||||
# the first 8 hex digits of the the SHA-1 hash of HEAD. If there are
|
||||
# local changes in the repository, -dirty is added.
|
||||
|
||||
version=$1
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>/dev/null \
|
||||
&& test -z "`git rev-parse --show-cdup`" ; then
|
||||
set -- `git describe --tags HEAD 2> /dev/null || \
|
||||
git rev-parse --short HEAD` \
|
||||
`git update-index --refresh --unmerged > /dev/null
|
||||
if git diff-index --name-only HEAD | read dummy; then
|
||||
echo -dirty
|
||||
fi`
|
||||
echo ${1#v}$2 > .$version.tmp
|
||||
if test ! -e $version \
|
||||
|| ! cmp -s .$version.tmp $version ; then
|
||||
mv .$version.tmp $version
|
||||
else
|
||||
rm -f .$version.tmp
|
||||
fi
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user