summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Giles <giles@mozilla.com>2012-08-16 11:39:56 -0700
committerRalph Giles <giles@mozilla.com>2012-08-16 12:42:32 -0700
commit59c5a82e51b51cc71bd6105a97419f24b8f2d35f (patch)
tree33bd49d902f54ac8412e8a945b0e78a6ad11bc9e
parent9322362b1ba88aa1a0216bd7dea3c2fb1e5cdca9 (diff)
downloadopus-59c5a82e51b51cc71bd6105a97419f24b8f2d35f.tar.gz
Move the release version string to version.mk.
Previously we defined the release version string in configure.ac, and overrode that with 'git describe --tags' if possible. This made it difficult for non-autoconf builds to set their version string correctly. Instead we create, and check into version control, a file called version.mk which defines OPUS_VERSION. The configure script reads that file and uses it as a fallback if the git revision isn't available. The expectation is that version.mk will be manually updated for releases, just as the previous configure.ac version was. However, since this is a simpler format, it is easier for alternate build systems to use, reducing the number of places which must be updated. Also removes the OPUS_MINOR_VERSION, etc. defines from config.h.
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac40
-rw-r--r--version.mk2
3 files changed, 30 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am
index 224905df..431b72a2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,7 +82,8 @@ opus_custom_demo_SOURCES = celt/opus_custom_demo.c
opus_custom_demo_LDADD = libopus.la -lm
endif
-EXTRA_DIST = opus.pc.in \
+EXTRA_DIST = version.mk \
+ opus.pc.in \
opus-uninstalled.pc.in \
opus.sln \
celt/celt.vcxproj \
diff --git a/configure.ac b/configure.ac
index bcb71dae..ce0451b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,12 +7,25 @@ AM_CONFIG_HEADER([config.h])
dnl enable silent rules on automake 1.11 and later
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-OPUS_MAJOR_VERSION=1
-OPUS_MINOR_VERSION=0
-OPUS_MICRO_VERSION=1
-OPUS_EXTRA_VERSION=-rc2
+# Read our default version string from version.mk.
+# Please update this file for releases.
+AC_MSG_CHECKING([version.mk])
+MK_VERSION=$(awk 'BEGIN { FS = "=" }
+ /OPUS_VERSION/ { ver = $2}
+ END {
+ gsub(/"/, "", ver);
+ gsub(/^ /, "", ver);
+ gsub(/ $/, "", ver);
+ print ver;
+ }' $srcdir/version.mk)
+if test -z "$MK_VERSION"; then
+ AC_MSG_RESULT([no])
+else
+ AC_MSG_RESULT([$MK_VERSION])
+ OPUS_VERSION="$MK_VERSION"
+fi
-OPUS_VERSION="$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION"
+# Override with the git version, if available.
AC_MSG_CHECKING([git revision])
GIT_VERSION=$(git describe --tags --match 'v*' 2>/dev/null | sed 's/^v//')
if test -z "$GIT_VERSION"; then
@@ -22,21 +35,20 @@ else
OPUS_VERSION="$GIT_VERSION"
fi
+# Use 'unknown' if all else fails.
+if test -z "$OPUS_VERSION"; then
+ OPUS_VERSION="unknown"
+fi
+
# For automake.
-VERSION=$OPUS_VERSION
PACKAGE=opus
+VERSION=$OPUS_VERSION
-# For our version string.
+# For config.h.
AC_SUBST(OPUS_VERSION)
-# For config.h
-AC_DEFINE_UNQUOTED(OPUS_VERSION, "${OPUS_VERSION}", [Complete version string])
-AC_DEFINE_UNQUOTED(OPUS_MAJOR_VERSION, ${OPUS_MAJOR_VERSION}, [Version major])
-AC_DEFINE_UNQUOTED(OPUS_MINOR_VERSION, ${OPUS_MINOR_VERSION}, [Version minor])
-AC_DEFINE_UNQUOTED(OPUS_MICRO_VERSION, ${OPUS_MICRO_VERSION}, [Version micro])
-AC_DEFINE_UNQUOTED(OPUS_EXTRA_VERSION, "${OPUS_EXTRA_VERSION}", [Version extra])
-
# For libtool.
+dnl Please update these for releases.
OPUS_LT_CURRENT=2
OPUS_LT_REVISION=0
OPUS_LT_AGE=2
diff --git a/version.mk b/version.mk
new file mode 100644
index 00000000..fdd68fe0
--- /dev/null
+++ b/version.mk
@@ -0,0 +1,2 @@
+# static version string; update manually every release.
+OPUS_VERSION = "1.0.1-rc2"