diff options
author | 2022-02-10 04:35:21 +0100 | |
---|---|---|
committer | 2022-02-10 04:35:21 +0100 | |
commit | 08aefcd597d26a5d99f64815a2b932c36f056164 (patch) | |
tree | 922d4fbc5d50b973fa08cc5ca5a99c148874b3b7 | |
parent | e41dbc3ddbe30a414e73fa25d9c7c304ffe6989e (diff) | |
download | libimobiledevice-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.am | 6 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rwxr-xr-x | git-version-gen | 19 |
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 | ||
5 | EXTRA_DIST = \ | 5 | EXTRA_DIST = \ |
6 | docs \ | 6 | docs \ |
7 | README.md | 7 | README.md \ |
8 | git-version-gen | ||
9 | |||
10 | dist-hook: | ||
11 | echo $(VERSION) > $(distdir)/.tarball-version | ||
8 | 12 | ||
9 | docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h $(top_srcdir)/include/libimobiledevice/*.h | 13 | docs/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 | ||
4 | AC_PREREQ([2.68]) | 4 | AC_PREREQ([2.68]) |
5 | AC_INIT([libimobiledevice], [1.3.1], [https://github.com/libimobiledevice/libimobiledevice/issues], [], [https://libimobiledevice.org]) | 5 | AC_INIT([libimobiledevice], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/libimobiledevice/issues], [], [https://libimobiledevice.org]) |
6 | AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) | 6 | AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) |
7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) | 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) |
8 | AC_CONFIG_SRCDIR([src/]) | 8 | AC_CONFIG_SRCDIR([src/]) |
@@ -17,12 +17,18 @@ dnl libtool versioning | |||
17 | # CURRENT : REVISION : AGE | 17 | # CURRENT : REVISION : AGE |
18 | LIBIMOBILEDEVICE_SO_VERSION=6:0:0 | 18 | LIBIMOBILEDEVICE_SO_VERSION=6:0:0 |
19 | 19 | ||
20 | AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION) | ||
21 | |||
22 | # Check if we have a version defined | ||
23 | if 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.]) | ||
25 | fi | ||
26 | |||
20 | dnl Minimum package versions | 27 | dnl Minimum package versions |
21 | LIBUSBMUXD_VERSION=2.0.2 | 28 | LIBUSBMUXD_VERSION=2.0.2 |
22 | LIBPLIST_VERSION=2.2.0 | 29 | LIBPLIST_VERSION=2.2.0 |
23 | LIMD_GLUE_VERSION=1.0.0 | 30 | LIMD_GLUE_VERSION=1.0.0 |
24 | 31 | ||
25 | AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION) | ||
26 | AC_SUBST(LIBUSBMUXD_VERSION) | 32 | AC_SUBST(LIBUSBMUXD_VERSION) |
27 | AC_SUBST(LIBPLIST_VERSION) | 33 | AC_SUBST(LIBPLIST_VERSION) |
28 | AC_SUBST(LIMD_GLUE_VERSION) | 34 | AC_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 | ||
2 | SRCDIR=`dirname $0` | ||
3 | if test -n "$1"; then | ||
4 | VER=$1 | ||
5 | else | ||
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 | ||
18 | fi | ||
19 | printf %s "$VER" | ||