Skip to content

Commit

Permalink
build: add new version mechanism based on VERSION file and a version.…
Browse files Browse the repository at this point in the history
…sh script

If this is a git checkout, and git is available, then git describe is
used. Otherwise, the new checked in VERSION file is taken for the version.

This mechanism uses a version.sh script inspired by
http://git.musl-libc.org/cgit/musl/tree/tools/version.sh

Signed-off-by: Michael Adam <obnox@samba.org>
  • Loading branch information
obnoxxx committed Sep 4, 2018
1 parent a662c11 commit 9f4ed46
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ SUBDIRS = \
etc \
docs \
m4macros \
tests
tests \
scripts

# tools want this on a single line
ACLOCAL_AMFLAGS = -I m4macros
Expand All @@ -20,7 +21,8 @@ dist_doc_DATA = \
EXTRA_DIST = \
autogen.sh \
tinyproxy-indent.sh \
TODO
TODO \
VERSION

test: all
./tests/scripts/run_tests.sh
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.10.0
11 changes: 2 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@

AC_PREREQ(2.54)

m4_define([tinyproxy_major_version], [1])
m4_define([tinyproxy_minor_version], [10])
m4_define([tinyproxy_micro_version], [0])
m4_define([tinyproxy_real_version],
[tinyproxy_major_version.tinyproxy_minor_version.tinyproxy_micro_version])
m4_define([tinyproxy_version], [tinyproxy_real_version])

# For overriding the version string. Comment out if not needed.
# m4_define([tinyproxy_version], [1.10.0])
m4_define([tinyproxy_version], esyscmd(sh scripts/version.sh | tr -d '\n'))

AC_INIT([Tinyproxy], [tinyproxy_version],
[https://tinyproxy.github.io/],
Expand Down Expand Up @@ -227,6 +219,7 @@ docs/man8/tinyproxy.txt
m4macros/Makefile
tests/Makefile
tests/scripts/Makefile
scripts/Makefile
])

AC_OUTPUT
Expand Down
2 changes: 2 additions & 0 deletions scripts/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXTRA_DIST = \
version.sh
15 changes: 15 additions & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
GIT_DIR="${SCRIPT_DIR}/../.git"

if test -d "${GIT_DIR}" ; then
if type git >/dev/null 2>&1 ; then
git describe --match '[0-9]*.[0-9]*.[0-9]*' 2>/dev/null \
| sed -e 's/-/-git-/'
else
sed 's/$/-git/' < VERSION
fi
else
cat VERSION
fi

0 comments on commit 9f4ed46

Please sign in to comment.