ruki 2 rokov pred
rodič
commit
bd558bb7fb
2 zmenil súbory, kde vykonal 28 pridanie a 2 odobranie
  1. 27 1
      configure
  2. 1 1
      src/xmake.sh

+ 27 - 1
configure

@@ -1457,8 +1457,9 @@ _get_target_soname() {
     local name="${1}"
     _get_target_item "${name}" "kind"; local targetkind="${_ret}"
     if test_eq "${targetkind}" "shared" && is_plat "macosx" "linux" "bsd"; then
+        _get_target_item "${name}" "version"; local version="${_ret}"
         _get_target_item "${name}" "version_soname"; local version_soname="${_ret}"
-        if test_nz "${version_soname}"; then
+        if test_nz "${version}" && test_nz "${version_soname}"; then
             _get_target_filename "${name}"; soname="${_ret}"
             _get_target_extension "${name}"; local extension="${_ret}"
             if test_eq "${extension}" ".dylib"; then
@@ -4032,6 +4033,31 @@ _gmake_add_build_target() {
         emar) _gmake_add_build_target_for_ar "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
         *) raise "unknown toolname(${toolname})!" ;;
     esac
+
+    # @see https://github.com/tboox/tbox/issues/214
+    if test_eq "${targetkind}" "shared"; then
+        _get_target_item "${target}" "version"; local version="${_ret}"
+        _get_target_soname "${target}"; local soname="${_ret}"
+        if test_nz "${soname}" && test_nz "${version}"; then
+            _get_target_filename "${target}"; local filename="${_ret}"
+            _get_target_extension "${target}"; local extension="${_ret}"
+            local targetfile_with_version="${targetdir}/${filename}.${version}"
+            if test_eq "${extension}" ".dylib"; then
+                path_basename "${filename}"; local basename="${_ret}"
+                targetfile_with_version="${targetdir}/${basename}.${version}${extension}"
+            fi
+            local targetfile_with_soname="${targetdir}/${soname}"
+            path_filename "${targetfile_with_version}"; local targetfilename_with_version="${_ret}"
+            if test_nq "${soname}" "${filename}" && test_nq "${soname}" "${targetfilename_with_version}"; then
+                print "\t@cp -p ${targetfile} ${targetfile_with_version}" >> "${xmake_sh_makefile}"
+                print "\t@rm ${targetfile}" >> "${xmake_sh_makefile}"
+                print "\t@if test -f ${targetfile_with_soname}; then rm ${targetfile_with_soname}; fi" >> "${xmake_sh_makefile}"
+                print "\t@cd ${targetdir} && ln -s ${targetfilename_with_version} ${soname} && ln -s ${soname} ${filename}" >> "${xmake_sh_makefile}"
+            fi
+        fi
+    fi
+
+    # end
     echo "" >> "${xmake_sh_makefile}"
 
     # build objects

+ 1 - 1
src/xmake.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 
 set_project "hello"
-set_version "1.0.1" "%Y%m%d%H%M" "1"
+set_version "1.0.1" "%Y%m%d%H%M" "1" # version, build, soname version
 
 option "debug" "Enable debug compilation mode." false
 option "tests" "Enable tests." true