]> wimlib.net Git - wimlib/commitdiff
configure.ac: generate version number from git commit and tags
authorEric Biggers <ebiggers3@gmail.com>
Sat, 10 Jul 2021 22:47:57 +0000 (17:47 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 10 Jul 2021 23:35:48 +0000 (18:35 -0500)
This should hopefully make it less confusing when building from the git
repository.  Previously, when doing so the version number would always
be that of the last official release.

configure.ac
tools/get-version-number [new file with mode: 0755]
tools/make-releases
tools/make-windows-release
tools/update-version

index 948db93cccea9b32fddeae55b698a3a54c2f410b..a883d7eb98f8cab62438119225e9ba36c6b7f724 100644 (file)
@@ -1,6 +1,7 @@
 ###############################################################################
 
 ###############################################################################
 
-AC_INIT([wimlib], [1.13.5-BETA1], [https://wimlib.net/forums/])
+AC_INIT([wimlib], m4_esyscmd([tools/get-version-number]),
+       [https://wimlib.net/forums/])
 AC_CONFIG_SRCDIR([src/wim.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/wim.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
diff --git a/tools/get-version-number b/tools/get-version-number
new file mode 100755 (executable)
index 0000000..15f256c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Get the version number of the project to use in the release filenames
+# and in the --version output.
+
+vers=$(git describe --abbrev=8 --dirty --always 2>/dev/null | \
+       sed 's/^v//')
+if [ -z "$vers" ]; then
+       # Fallback for people who use autoreconf on tarball releases
+       vers="1.13.4"
+fi
+echo "$vers"
index fad2b88c4d8591605e3cd41f8f37f148a02a0543..251e741311c2ec614af10a525892dcc9d22b83cc 100755 (executable)
@@ -6,6 +6,8 @@ MAKE="make -j$(grep -c processor /proc/cpuinfo)"
 
 export CFLAGS="-O2 -Wall -Werror"
 
 
 export CFLAGS="-O2 -Wall -Werror"
 
+autoreconf -i -f # make sure the version number gets updated
+
 ./configure && $MAKE distcheck
 
 # Recompress with 7-Zip
 ./configure && $MAKE distcheck
 
 # Recompress with 7-Zip
index 3bd8e47240c51c1d83f21da70705de56ca70561b..5f5da584d9e9ad536fce974e5dcc97e0e33ff4c8 100755 (executable)
@@ -27,8 +27,7 @@ i686|x86_64)
        ;;
 esac
 
        ;;
 esac
 
-VERSION=$(grep 'AC_INIT' configure.ac | \
-         grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+[^]]*')
+VERSION=$(tools/get-version-number)
 DESTDIR=wimlib-${VERSION}-windows-${ARCH}-bin
 ZIPFILE=wimlib-${VERSION}-windows-${ARCH}-bin.zip
 MAKE="make -j $(grep -c processor /proc/cpuinfo)"
 DESTDIR=wimlib-${VERSION}-windows-${ARCH}-bin
 ZIPFILE=wimlib-${VERSION}-windows-${ARCH}-bin.zip
 MAKE="make -j $(grep -c processor /proc/cpuinfo)"
index 092c572ed2c5d98854a502fc7bcbf433837c93ac..7898219631008c53ea72180597ec9d147c44de4a 100755 (executable)
@@ -23,7 +23,7 @@ newver="${newmajor}.${newminor}.${newpatch}"
 pat='This is wimlib version [^[:space:]]\+ ([^[:space:]]\+ [^[:space:]]\+)'
 sed -i "s/$pat/This is wimlib version $newver ($newmonth $newyear)/" README
 
 pat='This is wimlib version [^[:space:]]\+ ([^[:space:]]\+ [^[:space:]]\+)'
 sed -i "s/$pat/This is wimlib version $newver ($newmonth $newyear)/" README
 
-sed -i "s/$oldver/$newver/" configure.ac
+sed -i "s/$oldver/$newver/" tools/get-version-number
 
 sed -i -e 's/\(#define WIMLIB_MAJOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newmajor'/' \
        -e 's/\(#define WIMLIB_MINOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newminor'/' \
 
 sed -i -e 's/\(#define WIMLIB_MAJOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newmajor'/' \
        -e 's/\(#define WIMLIB_MINOR_VERSION[[:space:]]\+\)[[:digit:]]\+/\1'$newminor'/' \