[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: Use gnulib script 'git-version-gen' to determine groff's
From: |
Bertrand Garrigues |
Subject: |
[groff] 01/01: Use gnulib script 'git-version-gen' to determine groff's version |
Date: |
Sat, 13 Jan 2018 20:09:33 -0500 (EST) |
bgarrigues pushed a commit to branch unique-version
in repository groff.
commit 874548d0a4dd38435ce217699c485047a23a9eaf
Author: Bertrand Garrigues <address@hidden>
Date: Sun Jan 14 00:04:13 2018 +0100
Use gnulib script 'git-version-gen' to determine groff's version
---
.gitignore | 3 +++
Makefile.am | 37 ++++++++++++++++++++++++++++++++++---
REVISION | 1 -
VERSION | 1 -
bootstrap.conf | 1 +
configure.ac | 22 ++--------------------
src/libs/libgroff/libgroff.am | 11 ++++-------
src/roff/troff/troff.am | 11 ++++-------
8 files changed, 48 insertions(+), 39 deletions(-)
diff --git a/.gitignore b/.gitignore
index 823129f..d58329c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,3 +98,6 @@ stamp-*
/troff
/xtotroff
/gendef.sh
+/.version
+/cscope.out
+/build
diff --git a/Makefile.am b/Makefile.am
index 4cd4cf0..2090f73 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,9 +57,7 @@ address@hidden@
# otherwise no.
-# VERSION is set by automake, based on what is passed to AC_INIT. We
-# pass GROFF_VERSION_STRING to it, which skips the revision if set to
-# 0.
+# VERSION is set by automake, based on what is passed to AC_INIT.
# PAGE
# Define `page' to be letter if your PostScript printer uses 8.5x11
@@ -617,6 +615,32 @@ if MAKE_DONT_HAVE_RM
RM = rm -f
endif
+# 'VERSION' is generated by gnulib script git-version-gen, using the
+# command 'git describe':
+#
+# - From a git repository: if the current commit corresponds to a
+# tag, then 'VERSION' is simply the tag (e.g. 1.22.3). Otherwise
+# 'VERSION' has the following format:
+# <tag>-<nb_commits>-<commit>
+#
+# With:
+# . tag: the most recent tag reachable from the current commit
+# . nb_commits: number of commits between the most recent tag and
+# the current commit.
+# . current commit, abbreviated.
+# For example: 1.22.3.real.434-5aafd
+# The version is stored in .version.
+#
+# - From a tarball, the version is taken from .tarball-version
+#
+# REVISION is the full revision given by git-version-gen, which can
+# have non-alphanumeric symbols. SHORT_REVISION is REVISION without
+# any non-alphanumeric symbols
+MAJOR_VERSION =`echo $(VERSION) | sed 's/\([0-9]\+\)\.[0-9]\+.*/\1/'`
+MINOR_VERSION =`echo $(VERSION) | sed 's/[0-9]\+\.\([0-9]\+\).*/\1/'`
+REVISION = `echo $(VERSION) | sed 's/[0-9]\+\.[0-9]\+\.\(.*\)/\1/'`
+SHORT_REVISION = `echo $(VERSION) | sed
's/[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/'`
+
# Non-recursive makefile system. See Automake manual '7.3 An
# Alternative Approach to Subdirectories'. We use a single Makefile.am
# that includes other .am files, rather than using SUBDIRS. Note that
@@ -900,6 +924,13 @@ SUFFIXES += .man
-e "s|address@hidden@]|$(VERSION)|g" \
$< >$@
+# Version files - see script 'build-aux/git-gen-version'
+EXTRA_DIST += $(top_srcdir)/.version
+BUILT_SOURCES += $(top_srcdir)/.version
+$(top_srcdir)/.version:
+ echo $(VERSION) > address@hidden && mv address@hidden $@
+dist-hook:
+ echo $(VERSION) > $(distdir)/.tarball-version
########################################################################
### Emacs settings
diff --git a/REVISION b/REVISION
deleted file mode 100644
index 00750ed..0000000
--- a/REVISION
+++ /dev/null
@@ -1 +0,0 @@
-3
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 71f7f51..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.22
diff --git a/bootstrap.conf b/bootstrap.conf
index dc39207..deda4f6 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -36,6 +36,7 @@ checkout_only_file=README.git
# havelib provides config.rpath
# can be get through gettext though
gnulib_modules="
+ git-version-gen
havelib
non-recursive-gnulib-prefix-hack
wcwidth
diff --git a/configure.ac b/configure.ac
index 40c829d..bf46a4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,29 +18,11 @@
#
# Process this file with autoconf to produce a configure script.
-dnl Use `VERSION' and `REVISION' files to get version.
-m4_define([GROFF_VERSION_DATA], m4_include([VERSION]))
-m4_define([GROFF_REVISION_DATA], m4_include([REVISION]))
-
-dnl Strip off newline characters.
-m4_define([GROFF_VERSION],
- m4_substr(GROFF_VERSION_DATA,
- [0], m4_decr(m4_len(GROFF_VERSION_DATA))))
-m4_define([GROFF_REVISION],
- m4_substr(GROFF_REVISION_DATA,
- [0], m4_decr(m4_len(GROFF_REVISION_DATA))))
-
-dnl Don't use revision if it is zero.
-m4_define([GROFF_VERSION_STRING],
- m4_if(m4_eval(GROFF_REVISION[ > 0]),
- [1],
- GROFF_VERSION[.]GROFF_REVISION,
- GROFF_VERSION))
-
AC_INIT([GNU Troff],
- GROFF_VERSION_STRING,
+ m4_esyscmd([build-aux/git-version-gen --prefix "" .tarball-version]),
address@hidden,
[groff])
+
AC_PREREQ([2.62])
# Directories where the helper scripts should be found. This must be consistent
diff --git a/src/libs/libgroff/libgroff.am b/src/libs/libgroff/libgroff.am
index b9cf9b1..b25d64c 100644
--- a/src/libs/libgroff/libgroff.am
+++ b/src/libs/libgroff/libgroff.am
@@ -96,9 +96,6 @@ EXTRA_DIST += \
src/libs/libgroff/make-uniuni \
src/libs/snprintf/snprintf.c
-src_version=`cat $(top_srcdir)/VERSION`
-src_revision=`cat $(top_srcdir)/REVISION`
-
CLEANFILES += \
src/libs/libgroff/version.cpp \
charset.alias \
@@ -111,12 +108,12 @@ src/libs/libgroff/libgroff_a-fontfile.$(OBJEXT): defs.h
src/libs/libgroff/libgroff_a-macropath.$(OBJEXT): defs.h
src/libs/libgroff/libgroff_a-relocate.$(OBJEXT): defs.h
-src/libs/libgroff/version.cpp: $(top_srcdir)/VERSION $(top_srcdir)/REVISION
+src/libs/libgroff/version.cpp: $(top_srcdir)/.version
@echo Making version.cpp
- @echo const char \*version_string = \"$(src_version)\"\; >$@
- @echo const char \*revision_string = \"$(src_revision)\"\; >>$@
+ @echo const char \*version_string =
\"$(MAJOR_VERSION).$(MINOR_VERSION)\"\; >$@
+ @echo const char \*revision_string = \"$(REVISION)\"\; >>$@
@echo extern \"C\" { >>$@
- @echo const char \*Version_string =
\"$(src_version).$(src_revision)\"\; >>$@
+ @echo const char \*Version_string = \"$(VERSION)\"\; >>$@
@echo } >>$@ \
| sed -e 's/\.0\"/\"/' >>$@
diff --git a/src/roff/troff/troff.am b/src/roff/troff/troff.am
index 191798a..8b54df9 100644
--- a/src/roff/troff/troff.am
+++ b/src/roff/troff/troff.am
@@ -52,15 +52,12 @@ nodist_troff_SOURCES = src/roff/troff/majorminor.cpp
src/roff/troff/input.$(OBJEXT): defs.h
CLEANFILES += src/roff/troff/majorminor.cpp
-src/roff/troff/majorminor.cpp: $(top_srcdir)/VERSION $(top_srcdir)/REVISION
+src/roff/troff/majorminor.cpp: $(top_srcdir)/.version
@echo Making $@
@$(RM) $@
- @echo const char \*major_version = \
- \"`sed -e 's/^\([^.]*\)\..*$$/\1/' $(top_srcdir)/VERSION`\"\; >$@
- @echo const char \*minor_version = \
- \"`sed -e 's/^[^.]*\.\([0-9]*\).*$$/\1/' $(top_srcdir)/VERSION`\"\; \
- >>$@
- @echo const char \*revision = \"`cat $(top_srcdir)/REVISION`\"\; >>$@
+ @echo const char \*major_version = \"$(MAJOR_VERSION)\"\; >$@
+ @echo const char \*minor_version = \"$(MINOR_VERSION)\"\; >>$@
+ @echo const char \*revision = \"$(SHORT_REVISION)\"\; >>$@
########################################################################
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: Use gnulib script 'git-version-gen' to determine groff's version,
Bertrand Garrigues <=