Ver Fonte

add soname

ruki há 2 anos atrás
pai
commit
8abb7e1d50
1 ficheiros alterados com 24 adições e 0 exclusões
  1. 24 0
      configure

+ 24 - 0
configure

@@ -1594,6 +1594,18 @@ _get_target_toolchain_flags_for_gcc() {
             flags="${flags} -fPIC"
         fi
     fi
+    # add soname, https://github.com/tboox/tbox/issues/214#issuecomment-1608882997
+    if test_eq "${targetkind}" "shared" && test_eq "${toolkind}" "sh" && is_plat "linux"; then
+        _get_target_item "${name}" "version"; local version="${_ret}"
+        if test_nz "${version}"; then
+            string_split "${version}" "."
+            local version_major="${_ret}"
+            local version_minor="${_ret2}"
+            local version_alter="${_ret3}"
+            _get_target_filename "${name}"; local filename="${_ret}"
+            flags="${flags} -Wl,-soname,${filename}.${version_major}.${version_minor}.${version_alter}"
+        fi
+    fi
     _ret="${flags}"
 }
 
@@ -1613,6 +1625,18 @@ _get_target_toolchain_flags_for_clang() {
             flags="${flags} -fPIC"
         fi
     fi
+    # add soname, https://github.com/tboox/tbox/issues/214#issuecomment-1608882997
+    if test_eq "${targetkind}" "shared" && test_eq "${toolkind}" "sh" && is_plat "linux"; then
+        _get_target_item "${name}" "version"; local version="${_ret}"
+        if test_nz "${version}"; then
+            string_split "${version}" "."
+            local version_major="${_ret}"
+            local version_minor="${_ret2}"
+            local version_alter="${_ret3}"
+            _get_target_filename "${name}"; local filename="${_ret}"
+            flags="${flags} -Wl,-soname,${filename}.${version_major}.${version_minor}.${version_alter}"
+        fi
+    fi
     if is_plat "macosx"; then
         _os_iorunv "xcrun" "-sdk" "macosx" "--show-sdk-path"; local sdkdir="${_ret}"
         if test_nz "${sdkdir}"; then