Setup autotools to read .so version info from a separate file

We want to use the same libtool style .so versions in both build systems,
ideally both systems should read the version information from the same
configuration file.

This commit introduces an so.version configuration file and sets up
the autotools to use it.

The version numbers in so.version define the ABI compatibility and should be
updated prior to each release.

implements #323
This commit is contained in:
Sergey 'Jin' Bostandzhyan 2017-01-11 22:41:11 +01:00
parent 5ad3c98905
commit 3f24f04876
8 changed files with 62 additions and 22 deletions

View File

@ -14,6 +14,7 @@ EXTRA_DIST = \
README.md \
libtoxcore.pc.in \
tox.spec \
so.version \
dist-build/android-arm.sh \
dist-build/android-armv7.sh \
dist-build/android-x86.sh \

View File

@ -4,6 +4,18 @@ lib_LTLIBRARIES =
noinst_bindir = $(top_builddir)/build
EXTRA_DIST=
if SET_SO_VERSION
include ../so.version
LT_LDFLAGS=-version-info $(CURRENT):$(REVISION):$(AGE)
else
LT_LDFLAGS=-avoid-version
endif
include ../toxcore/Makefile.inc
include ../toxdns/Makefile.inc
include ../toxencryptsave/Makefile.inc

View File

@ -12,16 +12,6 @@ AC_CONFIG_MACRO_DIR([m4])
EXTRA_LT_LDFLAGS=
LIBTOXCORE_LT_VERSION=0:0:0
dnl
dnl current:revision:age
dnl
dnl current: increment if interfaces have been added, removed or changed
dnl revision: increment if source code has changed, set to zero if current is
dnl incremented
dnl age: increment if interfaces have been added, set to zero if
dnl interfaces have been removed or changed
if test "x${prefix}" = "xNONE"; then
prefix="${ac_default_prefix}"
fi
@ -40,22 +30,19 @@ LIBCONFIG_FOUND="no"
LIBCHECK_FOUND="no"
WANT_NACL="no"
ADD_NACL_OBJECTS_TO_PKGCONFIG="yes"
TOXCORE_LT_LDFLAGS="-version-info $LIBTOXCORE_LT_VERSION"
TOXAV_LT_LDFLAGS="-version-info $LIBTOXCORE_LT_VERSION"
SET_SO_VERSION="yes"
AC_ARG_ENABLE([soname-versions],
[AC_HELP_STRING([--enable-soname-versions], [enable soname versions (must be disabled for android) (default: enabled)]) ],
[
if test "x$enableval" = "xno"; then
TOXCORE_LT_LDFLAGS="-avoid-version"
TOXAV_LT_LDFLAGS="-avoid-version"
SET_SO_VERSION="no"
elif test "x$enableval" = "xyes"; then
SET_SO_VERSION="yes"
fi
]
)
AC_SUBST(TOXCORE_LT_LDFLAGS)
AC_SUBST(TOXAV_LT_LDFLAGS)
AM_CONDITIONAL(SET_SO_VERSION, test "x$SET_SO_VERSION" = "xyes")
AC_ARG_ENABLE([nacl],
[AC_HELP_STRING([--enable-nacl], [use nacl instead of libsodium (default: disabled)]) ],

16
so.version Normal file
View File

@ -0,0 +1,16 @@
# .so library version, following the libtool scheme:
#
# current:revision:age
#
# current: increment if interfaces have been added, removed or changed
# revision: increment if source code has changed, set to zero if current is
# incremented
# age: increment if interfaces have been added, set to zero if
# interfaces have been removed or changed
#
# For a full reference see:
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
CURRENT=5
REVISION=0
AGE=4

View File

@ -29,7 +29,7 @@ libtoxav_la_CFLAGS = -I../toxcore \
$(AV_CFLAGS) \
$(PTHREAD_CFLAGS)
libtoxav_la_LDFLAGS = $(TOXAV_LT_LDFLAGS) \
libtoxav_la_LDFLAGS = $(LT_LDFLAGS) \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
$(EXTRA_LT_LDFLAGS) \
@ -41,4 +41,10 @@ libtoxav_la_LIBADD = libtoxcore.la \
$(PTHREAD_LIBS) \
$(AV_LIBS)
if SET_SO_VERSION
EXTRA_libtoxav_la_DEPENDENCIES = ../so.version
endif
endif

View File

@ -56,7 +56,7 @@ libtoxcore_la_CFLAGS = -I$(top_srcdir) \
$(NACL_CFLAGS) \
$(PTHREAD_CFLAGS)
libtoxcore_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \
libtoxcore_la_LDFLAGS = $(LT_LDFLAGS) \
$(EXTRA_LT_LDFLAGS) \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
@ -68,3 +68,9 @@ libtoxcore_la_LIBADD = $(LIBSODIUM_LIBS) \
$(NACL_OBJECTS) \
$(NAC_LIBS) \
$(PTHREAD_LIBS)
if SET_SO_VERSION
EXTRA_libtoxcore_la_DEPENDENCIES = ../so.version
endif

View File

@ -14,7 +14,7 @@ libtoxdns_la_CFLAGS = -I$(top_srcdir) \
$(NACL_CFLAGS) \
$(PTHREAD_CFLAGS)
libtoxdns_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \
libtoxdns_la_LDFLAGS = $(LT_LDFLAGS) \
$(EXTRA_LT_LDFLAGS) \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
@ -27,3 +27,9 @@ libtoxdns_la_LIBADD = $(LIBSODIUM_LIBS) \
$(NAC_LIBS) \
$(PTHREAD_LIBS) \
libtoxcore.la
if SET_SO_VERSION
EXTRA_libtoxdns_la_DEPENDENCIES = ../so.version
endif

View File

@ -34,7 +34,7 @@ libtoxencryptsave_la_CFLAGS = -I$(top_srcdir) \
$(NACL_CFLAGS) \
$(PTHREAD_CFLAGS)
libtoxencryptsave_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \
libtoxencryptsave_la_LDFLAGS = $(LT_LDFLAGS) \
$(EXTRA_LT_LDFLAGS) \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
@ -47,3 +47,9 @@ libtoxencryptsave_la_LIBADD = $(LIBSODIUM_LIBS) \
$(NAC_LIBS) \
$(PTHREAD_LIBS) \
libtoxcore.la
if SET_SO_VERSION
EXTRA_libtoxencryptsave_la_DEPENDENCIES = ../so.version
endif