Skip to content

Commit

Permalink
Version += git revision (#1331)
Browse files Browse the repository at this point in the history
* Add the git revision to the version number for 'alpha' builds

* Ensure there is a .git folder

* Use `./version.sh` relative path

* Fix equality operator for a real bourne shell (like on TravisCI)
  • Loading branch information
RobinD42 committed Aug 28, 2020
1 parent 859d219 commit 1393e7b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion configure.ac
@@ -1,5 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(meep, 1.16.0-alpha)

AC_INIT(meep, m4_esyscmd([./version.sh 1.16.0 alpha]))
AC_CONFIG_SRCDIR(src/step.cpp)

# Shared-library version number; indicates api compatibility, and is
Expand Down
24 changes: 24 additions & 0 deletions version.sh
@@ -0,0 +1,24 @@
#!/bin/sh
#
# Build a version number, possibly including the Git revision number. Called
# from configure.ac via AC_INIT.
#

#set -x

VERSION=$1
TAG=$2

# Include the Git revision when the release tag is "alpha"
if [ "$TAG" = "alpha" -a -e .git ]; then
REV=$(git rev-parse --short=6 HEAD)
fi

# Print the version string, depending on how many components are available
if [ "$TAG" != "" -a "$REV" != "" ]; then
printf "%s-%s.%s" $VERSION $TAG $REV
elif [ "$TAG" != "" ]; then
printf "%s-%s" $VERSION $TAG
else
printf "%s" $VERSION
fi

0 comments on commit 1393e7b

Please sign in to comment.