diff mbox

[6/8] configure.ac: make SO (shared object) version unique

Message ID 1421312084-12881-7-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Jan. 15, 2015, 8:54 a.m. UTC
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 configure.ac           |  9 +++++++++
 platform/Makefile.inc  |  2 ++
 scripts/odp_version.sh | 10 +++++++++-
 3 files changed, 20 insertions(+), 1 deletion(-)

Comments

Steve McIntyre Jan. 15, 2015, 12:14 p.m. UTC | #1
OK, so going with the GEN*100 + MAJ option. Fair enough, but...

On Thu, Jan 15, 2015 at 09:54:42AM +0100, Anders Roxell wrote:
>diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>index 6ffa2ad..9e73fc4 100644
>--- a/platform/Makefile.inc
>+++ b/platform/Makefile.inc
>@@ -9,3 +9,5 @@ pkgconfig_DATA = $(top_builddir)/pkgconfig/libodp.pc
> 
> VPATH = $(srcdir) $(builddir)
> lib_LTLIBRARIES = $(LIB)/libodp.la
>+
>+AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
>index 72ae404..4299b56 100755
>--- a/scripts/odp_version.sh
>+++ b/scripts/odp_version.sh
>@@ -6,4 +6,12 @@ GEN=`grep "define ODP_VERSION_API_GENERATION"	${VFILE} | cut -d ' ' -f 3`
> MAJ=`grep "define ODP_VERSION_API_MAJOR"	${VFILE} | cut -d ' ' -f 3`
> MIN=`grep "define ODP_VERSION_API_MINOR"	${VFILE} | cut -d ' ' -f 3`
> 
>-echo -n $GEN.$MAJ.$MIN
>+if [[ -n $1 ]]; then
>+	# Set library version
>+	let CURRENT=${GEN}*100+${MAJ}

I'd be much happier with the more common sh syntax instead of using
the "let" bashism here:

CURRENT=$((${GEN}*100 + ${MAJ}))

>+	REVISION=$MIN
>+	AGE=$1
>+	echo -n "${CURRENT}:${REVISION}:${AGE}"
>+else
>+	echo -n $GEN.$MAJ.$MIN
>+fi

Cheers,
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index d5808ec..abad5b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,13 @@  AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 
 ##########################################################################
+# Set correct platform library version
+##########################################################################
+ODP_LIBSO_AGE=0
+ODP_LIBSO_VERSION=$(./scripts/odp_version.sh ${ODP_LIBSO_AGE})
+AC_SUBST(ODP_LIBSO_VERSION)
+
+##########################################################################
 # Determine which platform to build for
 ##########################################################################
 AC_ARG_WITH([platform],
@@ -232,6 +239,8 @@  AC_MSG_RESULT([
 	$PACKAGE $VERSION
 	========
 
+	Library version:	${ODP_LIBSO_VERSION}
+
 	with_platform:		${with_platform}
 	prefix:			${prefix}
 	sysconfdir:		${sysconfdir}
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 6ffa2ad..9e73fc4 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -9,3 +9,5 @@  pkgconfig_DATA = $(top_builddir)/pkgconfig/libodp.pc
 
 VPATH = $(srcdir) $(builddir)
 lib_LTLIBRARIES = $(LIB)/libodp.la
+
+AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
index 72ae404..4299b56 100755
--- a/scripts/odp_version.sh
+++ b/scripts/odp_version.sh
@@ -6,4 +6,12 @@  GEN=`grep "define ODP_VERSION_API_GENERATION"	${VFILE} | cut -d ' ' -f 3`
 MAJ=`grep "define ODP_VERSION_API_MAJOR"	${VFILE} | cut -d ' ' -f 3`
 MIN=`grep "define ODP_VERSION_API_MINOR"	${VFILE} | cut -d ' ' -f 3`
 
-echo -n $GEN.$MAJ.$MIN
+if [[ -n $1 ]]; then
+	# Set library version
+	let CURRENT=${GEN}*100+${MAJ}
+	REVISION=$MIN
+	AGE=$1
+	echo -n "${CURRENT}:${REVISION}:${AGE}"
+else
+	echo -n $GEN.$MAJ.$MIN
+fi