summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-02-10 04:35:21 +0100
committerGravatar Nikias Bassen2022-02-10 04:35:21 +0100
commit08aefcd597d26a5d99f64815a2b932c36f056164 (patch)
tree922d4fbc5d50b973fa08cc5ca5a99c148874b3b7
parente41dbc3ddbe30a414e73fa25d9c7c304ffe6989e (diff)
downloadlibimobiledevice-08aefcd597d26a5d99f64815a2b932c36f056164.tar.gz
libimobiledevice-08aefcd597d26a5d99f64815a2b932c36f056164.tar.bz2
autoconf: Automatically derive version number from latest git tag
with a fallback to get the version string from a .tarball-version file
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac10
-rwxr-xr-xgit-version-gen19
3 files changed, 32 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 4ef0813..b11de57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,11 @@ SUBDIRS = 3rd_party common src include $(CYTHON_SUB) tools docs
4 4
5EXTRA_DIST = \ 5EXTRA_DIST = \
6 docs \ 6 docs \
7 README.md 7 README.md \
8 git-version-gen
9
10dist-hook:
11 echo $(VERSION) > $(distdir)/.tarball-version
8 12
9docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h $(top_srcdir)/include/libimobiledevice/*.h 13docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h $(top_srcdir)/include/libimobiledevice/*.h
10 rm -rf docs/html 14 rm -rf docs/html
diff --git a/configure.ac b/configure.ac
index 8fb032d..503051f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
2# Process this file with autoconf to produce a configure script. 2# Process this file with autoconf to produce a configure script.
3 3
4AC_PREREQ([2.68]) 4AC_PREREQ([2.68])
5AC_INIT([libimobiledevice], [1.3.1], [https://github.com/libimobiledevice/libimobiledevice/issues], [], [https://libimobiledevice.org]) 5AC_INIT([libimobiledevice], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/libimobiledevice/issues], [], [https://libimobiledevice.org])
6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) 6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) 7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
8AC_CONFIG_SRCDIR([src/]) 8AC_CONFIG_SRCDIR([src/])
@@ -17,12 +17,18 @@ dnl libtool versioning
17# CURRENT : REVISION : AGE 17# CURRENT : REVISION : AGE
18LIBIMOBILEDEVICE_SO_VERSION=6:0:0 18LIBIMOBILEDEVICE_SO_VERSION=6:0:0
19 19
20AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION)
21
22# Check if we have a version defined
23if test -z $PACKAGE_VERSION; then
24 AC_MSG_ERROR([PACKAGE_VERSION is not defined. Make sure to configure a source tree checked out from git or that .tarball-version is present.])
25fi
26
20dnl Minimum package versions 27dnl Minimum package versions
21LIBUSBMUXD_VERSION=2.0.2 28LIBUSBMUXD_VERSION=2.0.2
22LIBPLIST_VERSION=2.2.0 29LIBPLIST_VERSION=2.2.0
23LIMD_GLUE_VERSION=1.0.0 30LIMD_GLUE_VERSION=1.0.0
24 31
25AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION)
26AC_SUBST(LIBUSBMUXD_VERSION) 32AC_SUBST(LIBUSBMUXD_VERSION)
27AC_SUBST(LIBPLIST_VERSION) 33AC_SUBST(LIBPLIST_VERSION)
28AC_SUBST(LIMD_GLUE_VERSION) 34AC_SUBST(LIMD_GLUE_VERSION)
diff --git a/git-version-gen b/git-version-gen
new file mode 100755
index 0000000..3eb6a42
--- /dev/null
+++ b/git-version-gen
@@ -0,0 +1,19 @@
1#!/bin/sh
2SRCDIR=`dirname $0`
3if test -n "$1"; then
4 VER=$1
5else
6 if test -d "${SRCDIR}/.git" && test -x "`which git`" ; then
7 git update-index -q --refresh
8 if ! VER=`git describe --tags --dirty 2>/dev/null`; then
9 COMMIT=`git rev-parse --short HEAD`
10 DIRTY=`git diff --quiet HEAD || echo "-dirty"`
11 VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY}
12 fi
13 else
14 if test -f "${SRCDIR}/.tarball-version"; then
15 VER=`cat "${SRCDIR}/.tarball-version"`
16 fi
17 fi
18fi
19printf %s "$VER"