build: use separate versioning schemes for API & ABI
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 13 Mar 2018 17:14:48 +0000 (18:14 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 14 Mar 2018 18:43:35 +0000 (19:43 +0100)
Commit 783ff2e3c707 ("API: start certain enums from 1") broke the ABI
compatibility (while keeping the source compatibility). We need to
indicate that to the users by changing the SONAME string. Up until now
the SONAME would correspond with the major release number. We now need
to have a separate versioning schemes for API and ABI.

Keep using the same MAJOR.MINOR.RELEASE scheme for the API, but switch
to using the libtool versioning - CURRENT.REVISION.AGE - for ABI. Start
the ABI version from 2.0.0 to indicate that it changed since 1.0.0.

Define a separate ABI version for the C++ bindings, but start with 0.0.0
since it was not a part of any release yet.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
bindings/cxx/Makefile.am
configure.ac
src/lib/Makefile.am

index f7b3f17330d99dd01b7d7262db6f162e809c1c5e..16a2a2cb9697479659ba23341524ff59ff78735b 100644 (file)
@@ -10,7 +10,7 @@ lib_LTLIBRARIES = libgpiodcxx.la
 libgpiodcxx_la_SOURCES = chip.cpp iter.cpp line.cpp line_bulk.cpp
 libgpiodcxx_la_CPPFLAGS = -Wall -Wextra -g -std=gnu++11
 libgpiodcxx_la_CPPFLAGS += -fvisibility=hidden -I$(top_srcdir)/include/
-libgpiodcxx_la_LDFLAGS = -version-number $(subst .,:,$(PACKAGE_VERSION))
+libgpiodcxx_la_LDFLAGS = -version-info $(subst .,:,$(ABI_CXX_VERSION))
 libgpiodcxx_la_LDFLAGS += -lgpiod -L$(top_builddir)/src/lib
 
 include_HEADERS = gpiod.hpp
index 10048ccf5d48b1a3725e50b0bef01bcbe12c53a7..d318a0e0274821581f0de4a7abcff3538593bdee 100644 (file)
@@ -16,6 +16,23 @@ AC_DEFINE_UNQUOTED([GPIOD_VERSION_STR],
                        [Full library version string.])
 AC_SUBST(VERSION_STR, [$PACKAGE_VERSION$EXTRA_VERSION])
 
+# From the libtool manual:
+#
+# (...)
+# 3. If the library source code has changed at all since the last update, then
+#    increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
+# 4. If any interfaces have been added, removed, or changed since the last
+#    update, increment current, and set revision to 0.
+# 5. If any interfaces have been added since the last public release, then
+#    increment age.
+# 6. If any interfaces have been removed or changed since the last public
+#    release, then set age to 0.
+#
+# Define the libtool version as (C.R.A):
+AC_SUBST(ABI_VERSION, [2.0.0])
+# Have a separate ABI version for C++ bindings:
+AC_SUBST(ABI_CXX_VERSION, [0.0.0])
+
 AC_CONFIG_AUX_DIR([autostuff])
 AC_CONFIG_MACRO_DIRS([m4])
 AM_INIT_AUTOMAKE([foreign subdir-objects])
index 94c2a8416e902c7df6c9a7eb0ec1c23d14694335..3f797c418c549da633542db8c83f79120ee1d7e5 100644 (file)
@@ -11,4 +11,4 @@ libgpiod_la_SOURCES = core.c ctxless.c helpers.c iter.c misc.c
 libgpiod_la_CFLAGS = -Wall -Wextra -g
 libgpiod_la_CFLAGS += -fvisibility=hidden -I$(top_srcdir)/include/
 libgpiod_la_CFLAGS += -include $(top_builddir)/config.h
-libgpiod_la_LDFLAGS = -version-number $(subst .,:,$(PACKAGE_VERSION))
+libgpiod_la_LDFLAGS = -version-info $(subst .,:,$(ABI_VERSION))