diff options
| author | 2022-01-25 03:43:52 +0100 | |
|---|---|---|
| committer | 2022-01-25 03:43:52 +0100 | |
| commit | 323009bfd003ff1540967b7b67efebab1ee8693d (patch) | |
| tree | 5e01fc1900db29d1d07ceb66e9958d94d3160f19 | |
| parent | 17da5ba554426d732fc850e7211bae7d3a7c016e (diff) | |
| download | libplist-323009bfd003ff1540967b7b67efebab1ee8693d.tar.gz libplist-323009bfd003ff1540967b7b67efebab1ee8693d.tar.bz2 | |
autoconf: Automatically derive version number from latest git tag
| -rw-r--r-- | Makefile.am | 6 | ||||
| -rw-r--r-- | configure.ac | 7 | ||||
| -rwxr-xr-x | git-version-gen | 15 |
3 files changed, 26 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 4d21b65..84b196d 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -11,7 +11,11 @@ SUBDIRS += fuzz | |||
| 11 | endif | 11 | endif |
| 12 | 12 | ||
| 13 | EXTRA_DIST = \ | 13 | EXTRA_DIST = \ |
| 14 | README.md | 14 | README.md \ |
| 15 | git-version-gen | ||
| 16 | |||
| 17 | dist-hook: | ||
| 18 | echo $(VERSION) > $(distdir)/.tarball-version | ||
| 15 | 19 | ||
| 16 | docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/include/plist/*.h | 20 | docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/include/plist/*.h |
| 17 | rm -rf docs/html | 21 | rm -rf docs/html |
diff --git a/configure.ac b/configure.ac index 0d13e04..d1b1f62 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([libplist], [2.2.1], [https://github.com/libimobiledevice/libplist/issues],, [https://libimobiledevice.org]) | 5 | AC_INIT([libplist], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/libplist/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/]) |
| @@ -19,6 +19,11 @@ LIBPLIST_SO_VERSION=6:0:3 | |||
| 19 | 19 | ||
| 20 | AC_SUBST(LIBPLIST_SO_VERSION) | 20 | AC_SUBST(LIBPLIST_SO_VERSION) |
| 21 | 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 | |||
| 22 | # Checks for programs. | 27 | # Checks for programs. |
| 23 | AC_PROG_CC | 28 | AC_PROG_CC |
| 24 | AC_PROG_CXX | 29 | AC_PROG_CXX |
diff --git a/git-version-gen b/git-version-gen new file mode 100755 index 0000000..6feac34 --- /dev/null +++ b/git-version-gen | |||
| @@ -0,0 +1,15 @@ | |||
| 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 | VER=`git describe --tags --always --dirty=-dirty` | ||
| 9 | else | ||
| 10 | if test -f "${SRCDIR}/.tarball-version"; then | ||
| 11 | VER=`cat "${SRCDIR}/.tarball-version"` | ||
| 12 | fi | ||
| 13 | fi | ||
| 14 | fi | ||
| 15 | printf %s "$VER" | ||
