[icinga-checkins] icinga.org: icinga2/feature/soname-12552: Set versions for all internal libraries

git at icinga.org git at icinga.org
Thu Aug 25 17:51:43 CEST 2016


Module: icinga2
Branch: feature/soname-12552
Commit: 28ecf5cce71127642c603a61f6d59bae3fc7b3cf
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=28ecf5cce71127642c603a61f6d59bae3fc7b3cf

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Aug 25 17:32:20 2016 +0200

Set versions for all internal libraries

fixes #12552

---

 CMakeLists.txt                        |   12 +++++++-----
 lib/base/CMakeLists.txt               |    1 +
 lib/base/application-version.cpp      |    5 +++++
 lib/base/application.hpp              |    1 +
 lib/base/loader.cpp                   |    4 ++--
 lib/checker/CMakeLists.txt            |    1 +
 lib/cli/CMakeLists.txt                |    1 +
 lib/compat/CMakeLists.txt             |    1 +
 lib/config/CMakeLists.txt             |    1 +
 lib/db_ido/CMakeLists.txt             |    1 +
 lib/db_ido_mysql/CMakeLists.txt       |    1 +
 lib/db_ido_pgsql/CMakeLists.txt       |    1 +
 lib/demo/CMakeLists.txt               |    1 +
 lib/hello/CMakeLists.txt              |    1 +
 lib/icinga/CMakeLists.txt             |    1 +
 lib/livestatus/CMakeLists.txt         |    1 +
 lib/methods/CMakeLists.txt            |    1 +
 lib/notification/CMakeLists.txt       |    1 +
 lib/perfdata/CMakeLists.txt           |    1 +
 lib/remote/CMakeLists.txt             |    1 +
 third-party/execvpe/CMakeLists.txt    |    1 +
 third-party/mmatch/CMakeLists.txt     |    1 +
 third-party/socketpair/CMakeLists.txt |    1 +
 23 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4902627..3076851 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,17 +70,19 @@ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDIT
 set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE})
 
+file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
+string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH)
+math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9")
+string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)
+
+configure_file(icinga-spec-version.h.cmake icinga-spec-version.h)
+
 include(GetGitRevisionDescription)
 git_describe(GIT_VERSION --tags)
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
   configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
 else()
   if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
-    file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
-    string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH)
-    math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9")
-    string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)
-
     file(STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision ")
     string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH)
     math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17")
diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt
index fed2c56..3eebeab 100644
--- a/lib/base/CMakeLists.txt
+++ b/lib/base/CMakeLists.txt
@@ -77,6 +77,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_BASE_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")")
diff --git a/lib/base/application-version.cpp b/lib/base/application-version.cpp
index ed632b8..c216ced 100644
--- a/lib/base/application-version.cpp
+++ b/lib/base/application-version.cpp
@@ -19,6 +19,7 @@
 
 #include "base/application.hpp"
 #include "icinga-version.h"
+#include "icinga-spec-version.h"
 
 using namespace icinga;
 
@@ -27,3 +28,7 @@ String Application::GetAppVersion(void)
 	return VERSION;
 }
 
+String Application::GetAppSpecVersion(void)
+{
+	return SPEC_VERSION;
+}
diff --git a/lib/base/application.hpp b/lib/base/application.hpp
index b732378..a5cfcb6 100644
--- a/lib/base/application.hpp
+++ b/lib/base/application.hpp
@@ -132,6 +132,7 @@ public:
 	static ThreadPool& GetTP(void);
 
 	static String GetAppVersion(void);
+	static String GetAppSpecVersion(void);
 
 	static double GetStartTime(void);
 	static void SetStartTime(double ts);
diff --git a/lib/base/loader.cpp b/lib/base/loader.cpp
index 9900bbe..0724779 100644
--- a/lib/base/loader.cpp
+++ b/lib/base/loader.cpp
@@ -34,9 +34,9 @@ void Loader::LoadExtensionLibrary(const String& library)
 #if defined(_WIN32)
 	path = library + ".dll";
 #elif defined(__APPLE__)
-	path = "lib" + library + ".dylib";
+	path = "lib" + library + "." + Application::GetAppSpecVersion() + ".dylib";
 #else /* __APPLE__ */
-	path = "lib" + library + ".so";
+	path = "lib" + library + ".so." + Application::GetAppSpecVersion();
 #endif /* _WIN32 */
 
 	Log(LogNotice, "Loader")
diff --git a/lib/checker/CMakeLists.txt b/lib/checker/CMakeLists.txt
index 0ba4cf0..4ba6a51 100644
--- a/lib/checker/CMakeLists.txt
+++ b/lib/checker/CMakeLists.txt
@@ -34,6 +34,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_CHECKER_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install_if_not_exists(
diff --git a/lib/cli/CMakeLists.txt b/lib/cli/CMakeLists.txt
index 74156d5..271fe2f 100644
--- a/lib/cli/CMakeLists.txt
+++ b/lib/cli/CMakeLists.txt
@@ -54,6 +54,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_CLI_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/compat/CMakeLists.txt b/lib/compat/CMakeLists.txt
index a3a3675..e44d2e5 100644
--- a/lib/compat/CMakeLists.txt
+++ b/lib/compat/CMakeLists.txt
@@ -39,6 +39,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_COMPAT_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install_if_not_exists(
diff --git a/lib/config/CMakeLists.txt b/lib/config/CMakeLists.txt
index c687ba2..3304020 100644
--- a/lib/config/CMakeLists.txt
+++ b/lib/config/CMakeLists.txt
@@ -53,6 +53,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_CONFIG_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/db_ido/CMakeLists.txt b/lib/db_ido/CMakeLists.txt
index 25d2952..d2ac1f2 100644
--- a/lib/db_ido/CMakeLists.txt
+++ b/lib/db_ido/CMakeLists.txt
@@ -42,6 +42,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_DB_IDO_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/db_ido_mysql/CMakeLists.txt b/lib/db_ido_mysql/CMakeLists.txt
index 4f45eb7..4181753 100644
--- a/lib/db_ido_mysql/CMakeLists.txt
+++ b/lib/db_ido_mysql/CMakeLists.txt
@@ -38,6 +38,7 @@ if(MYSQL_FOUND)
     INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
     DEFINE_SYMBOL I2_DB_IDO_MYSQL_BUILD
     FOLDER Components
+    VERSION ${SPEC_VERSION}
   )
 
   install_if_not_exists(
diff --git a/lib/db_ido_pgsql/CMakeLists.txt b/lib/db_ido_pgsql/CMakeLists.txt
index fd792b1..f029218 100644
--- a/lib/db_ido_pgsql/CMakeLists.txt
+++ b/lib/db_ido_pgsql/CMakeLists.txt
@@ -40,6 +40,7 @@ if(PostgreSQL_FOUND)
     INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
     DEFINE_SYMBOL I2_DB_IDO_PGSQL_BUILD
     FOLDER Components
+    VERSION ${SPEC_VERSION}
   )
 
   install_if_not_exists(
diff --git a/lib/demo/CMakeLists.txt b/lib/demo/CMakeLists.txt
index ab8533d..8e43561 100644
--- a/lib/demo/CMakeLists.txt
+++ b/lib/demo/CMakeLists.txt
@@ -34,6 +34,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_DEMO_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/hello/CMakeLists.txt b/lib/hello/CMakeLists.txt
index fb40ad3..36df66f 100644
--- a/lib/hello/CMakeLists.txt
+++ b/lib/hello/CMakeLists.txt
@@ -34,6 +34,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_HELLO_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt
index 8ef9e97..9272334 100644
--- a/lib/icinga/CMakeLists.txt
+++ b/lib/icinga/CMakeLists.txt
@@ -66,6 +66,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_ICINGA_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/livestatus/CMakeLists.txt b/lib/livestatus/CMakeLists.txt
index 40d56b9..716e8da 100644
--- a/lib/livestatus/CMakeLists.txt
+++ b/lib/livestatus/CMakeLists.txt
@@ -44,6 +44,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_LIVESTATUS_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install_if_not_exists(
diff --git a/lib/methods/CMakeLists.txt b/lib/methods/CMakeLists.txt
index e0c6d5e..d701d5c 100644
--- a/lib/methods/CMakeLists.txt
+++ b/lib/methods/CMakeLists.txt
@@ -43,6 +43,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_METHODS_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/lib/notification/CMakeLists.txt b/lib/notification/CMakeLists.txt
index b944083..bb5fc9c 100644
--- a/lib/notification/CMakeLists.txt
+++ b/lib/notification/CMakeLists.txt
@@ -34,6 +34,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_NOTIFICATION_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install_if_not_exists(
diff --git a/lib/perfdata/CMakeLists.txt b/lib/perfdata/CMakeLists.txt
index 91cc5fa..e654367 100644
--- a/lib/perfdata/CMakeLists.txt
+++ b/lib/perfdata/CMakeLists.txt
@@ -38,6 +38,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_PERFDATA_BUILD
   FOLDER Components
+  VERSION ${SPEC_VERSION}
 )
 
 install_if_not_exists(
diff --git a/lib/remote/CMakeLists.txt b/lib/remote/CMakeLists.txt
index 1d557a7..d74ad9f 100644
--- a/lib/remote/CMakeLists.txt
+++ b/lib/remote/CMakeLists.txt
@@ -47,6 +47,7 @@ set_target_properties (
   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
   DEFINE_SYMBOL I2_REMOTE_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/third-party/execvpe/CMakeLists.txt b/third-party/execvpe/CMakeLists.txt
index e8146c1..9ad12ad 100644
--- a/third-party/execvpe/CMakeLists.txt
+++ b/third-party/execvpe/CMakeLists.txt
@@ -21,6 +21,7 @@ set_target_properties (
   execvpe PROPERTIES
   DEFINE_SYMBOL I2_EXECVPE_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/third-party/mmatch/CMakeLists.txt b/third-party/mmatch/CMakeLists.txt
index d46e118..cb49b43 100644
--- a/third-party/mmatch/CMakeLists.txt
+++ b/third-party/mmatch/CMakeLists.txt
@@ -21,6 +21,7 @@ set_target_properties(
   mmatch PROPERTIES
   DEFINE_SYMBOL I2_MMATCH_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 install(
diff --git a/third-party/socketpair/CMakeLists.txt b/third-party/socketpair/CMakeLists.txt
index 625301c..7eb9ebb 100644
--- a/third-party/socketpair/CMakeLists.txt
+++ b/third-party/socketpair/CMakeLists.txt
@@ -21,6 +21,7 @@ set_target_properties (
   socketpair PROPERTIES
   DEFINE_SYMBOL I2_SOCKETPAIR_BUILD
   FOLDER Lib
+  VERSION ${SPEC_VERSION}
 )
 
 if(WIN32)



More information about the icinga-checkins mailing list