Skip to content

Commit

Permalink
autoconf: Automatically derive version number from latest git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Apr 30, 2023
1 parent 1be7839 commit 067c439
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src include tools man

EXTRA_DIST = \
README.md
README.md \
git-version-gen

DISTCHECK_CONFIGURE_FLAGS =

dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version

indent:
indent -kr -ut -ts4 -l120 src/*.c src/*.h dev/*.c
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.68)
AC_INIT([libideviceactivation], [1.1.2], [https://github.com/libimobiledevice/libideviceactivation/issues],, [https://libimobiledevice.org])
AC_PREREQ([2.68])
AC_INIT([libideviceactivation], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/libideviceactivation/issues], [], [https://libimobiledevice.org])
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([src/])
Expand Down
20 changes: 20 additions & 0 deletions git-version-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
SRCDIR=`dirname $0`
if test -n "$1"; then
VER=$1
else
if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then
git update-index -q --refresh
if ! VER=`git describe --tags --dirty 2>/dev/null`; then
COMMIT=`git rev-parse --short HEAD`
DIRTY=`git diff --quiet HEAD || echo "-dirty"`
VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY}
fi
else
if test -f "${SRCDIR}/.tarball-version"; then
VER=`cat "${SRCDIR}/.tarball-version"`
fi
fi
fi
VER=`printf %s "$VER" | head -n1`
printf %s "$VER"

0 comments on commit 067c439

Please sign in to comment.