lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [05/21] git commit: refs/heads/master - Set shared library version
Date Wed, 15 May 2013 22:28:39 GMT
Set shared library version

Using '-current_version' for Mach-O and '-Wl,-soname' for ELF systems.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8c0f0a12
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8c0f0a12
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8c0f0a12

Branch: refs/heads/master
Commit: 8c0f0a126ac2a427e15be8c5b714561863b76d7a
Parents: c66d966
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Mon May 13 20:51:50 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Wed May 15 19:13:53 2013 +0200

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/CFlags.c |   26 +++++++++++++++++++++++-
 charmonizer/src/Charmonizer/Core/CFlags.h |    4 +++
 charmonizer/src/Charmonizer/Core/Make.c   |    1 +
 3 files changed, 30 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/8c0f0a12/charmonizer/src/Charmonizer/Core/CFlags.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.c b/charmonizer/src/Charmonizer/Core/CFlags.c
index 4642a99..5b4e15d 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.c
+++ b/charmonizer/src/Charmonizer/Core/CFlags.c
@@ -214,7 +214,7 @@ chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
         string = "/DLL";
     }
     else if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
-        if (chaz_OS_is_darwin()) {
+        if (strcmp(chaz_OS_shared_lib_ext(), ".dylib") == 0) {
             string = "-dynamiclib";
         }
         else {
@@ -229,6 +229,30 @@ chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
 }
 
 void
+chaz_CFlags_set_shared_library_version(chaz_CFlags *flags,
+                                       chaz_SharedLib *lib) {
+    const char *shlib_ext = chaz_OS_shared_lib_ext();
+    char       *string;
+
+    if (flags->style != CHAZ_CFLAGS_STYLE_GNU
+        || strcmp(shlib_ext, ".dll") == 0) {
+        return;
+    }
+
+    if (strcmp(chaz_OS_shared_lib_ext(), ".dylib") == 0) {
+        const char *version = chaz_SharedLib_get_version(lib);
+        string = chaz_Util_join(" ", "-current_version", version, NULL);
+    }
+    else {
+        char *soname = chaz_SharedLib_major_version_filename(lib);
+        string = chaz_Util_join("", "-Wl,-soname,", soname, NULL);
+        free(soname);
+    }
+    chaz_CFlags_append(flags, string);
+    free(string);
+}
+
+void
 chaz_CFlags_set_link_output(chaz_CFlags *flags, const char *filename) {
     const char *output;
     char *string;

http://git-wip-us.apache.org/repos/asf/lucy/blob/8c0f0a12/charmonizer/src/Charmonizer/Core/CFlags.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.h b/charmonizer/src/Charmonizer/Core/CFlags.h
index 5f4151d..cb9c75f 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.h
+++ b/charmonizer/src/Charmonizer/Core/CFlags.h
@@ -77,6 +77,10 @@ void
 chaz_CFlags_link_shared_library(chaz_CFlags *flags);
 
 void
+chaz_CFlags_set_shared_library_version(chaz_CFlags *flags,
+                                       chaz_SharedLib *lib);
+
+void
 chaz_CFlags_set_link_output(chaz_CFlags *flags, const char *filename);
 
 void

http://git-wip-us.apache.org/repos/asf/lucy/blob/8c0f0a12/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 410254e..1df757a 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -339,6 +339,7 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, chaz_SharedLib *lib,
         link_flags_string = chaz_CFlags_get_string(link_flags);
     }
     chaz_CFlags_link_shared_library(local_flags);
+    chaz_CFlags_set_shared_library_version(local_flags, lib);
     chaz_CFlags_set_link_output(local_flags, filename);
     local_flags_string = chaz_CFlags_get_string(local_flags);
     command = chaz_Util_join(" ", link, sources, link_flags_string,


Mime
View raw message