diff options
author | Simon Warta <[email protected]> | 2015-08-24 19:04:56 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-08-24 19:04:56 +0200 |
commit | 58329e7602e07468396ba29d6404c01ce5edec42 (patch) | |
tree | e438dfd0e38dcd43a48bd2a8cc1764227511272c /src | |
parent | ce849c364c29ce020369685ce8d221f8e67cf538 (diff) | |
parent | a9be4d157cc913c9a7e93a08cc81c8a3603061b3 (diff) |
Merge pull request #260 from webmaster128/soname
Add soname_pattern
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/cc/clang.txt | 8 | ||||
-rw-r--r-- | src/build-data/cc/ekopath.txt | 2 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 10 | ||||
-rw-r--r-- | src/build-data/cc/hpcc.txt | 2 | ||||
-rw-r--r-- | src/build-data/cc/icc.txt | 2 | ||||
-rw-r--r-- | src/build-data/cc/pgi.txt | 4 | ||||
-rw-r--r-- | src/build-data/cc/sunstudio.txt | 2 | ||||
-rw-r--r-- | src/build-data/makefile/gmake_dso.in | 12 | ||||
-rw-r--r-- | src/build-data/os/android.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/darwin.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/hpux.txt | 2 | ||||
-rw-r--r-- | src/build-data/os/linux.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/mingw.txt | 5 | ||||
-rw-r--r-- | src/build-data/os/windows.txt | 3 | ||||
-rwxr-xr-x | src/scripts/install.py | 42 |
15 files changed, 57 insertions, 49 deletions
diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 8b09831d6..0fbc67ce9 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -26,12 +26,12 @@ visibility_attribute '__attribute__((visibility("default")))' makefile_style gmake <so_link_commands> -darwin -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME)" -darwin-debug -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME)" +darwin -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME_ABI)" +darwin-debug -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME_ABI)" # The default works for GNU ld and several other Unix linkers -default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" -default-debug -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" +default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" +default-debug -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" </so_link_commands> <binary_link_commands> diff --git a/src/build-data/cc/ekopath.txt b/src/build-data/cc/ekopath.txt index 823eed7a9..a41abc7c4 100644 --- a/src/build-data/cc/ekopath.txt +++ b/src/build-data/cc/ekopath.txt @@ -22,7 +22,7 @@ shared_flags "-fPIC" makefile_style gmake <so_link_commands> -default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" +default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" </so_link_commands> <mach_opt> diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt index 225440a35..877ce4d58 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -30,13 +30,13 @@ makefile_style gmake <so_link_commands> # The default works for GNU ld and several other Unix linkers -default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" -default-debug -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" +default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" +default-debug -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" # Darwin, HP-UX and Solaris linkers use different syntax -darwin -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME)" -hpux -> "$(CXX) -shared -fPIC -Wl,+h,$(SONAME)" -solaris -> "$(CXX) -shared -fPIC -Wl,-h,$(SONAME)" +darwin -> "$(CXX) -dynamiclib -fPIC -install_name $(LIBDIR)/$(SONAME_ABI)" +hpux -> "$(CXX) -shared -fPIC -Wl,+h,$(SONAME_ABI)" +solaris -> "$(CXX) -shared -fPIC -Wl,-h,$(SONAME_ABI)" # AIX and OpenBSD don't use sonames at all aix -> "$(CXX) -shared -fPIC" diff --git a/src/build-data/cc/hpcc.txt b/src/build-data/cc/hpcc.txt index 904e489c9..2e30995f6 100644 --- a/src/build-data/cc/hpcc.txt +++ b/src/build-data/cc/hpcc.txt @@ -25,5 +25,5 @@ hppa2.0 -> "+DA2.0W" </mach_abi_linking> <so_link_commands> -default -> "$(CXX) +Z -b -Wl,+h,$(SONAME)" # Documented in cc(1), but not CC(1) (?) +default -> "$(CXX) +Z -b -Wl,+h,$(SONAME_ABI)" # Documented in cc(1), but not CC(1) (?) </so_link_commands> diff --git a/src/build-data/cc/icc.txt b/src/build-data/cc/icc.txt index f15d9eb9c..f7fdf72be 100644 --- a/src/build-data/cc/icc.txt +++ b/src/build-data/cc/icc.txt @@ -30,5 +30,5 @@ westmere -> "-march=core2" </mach_opt> <so_link_commands> -default -> "$(CXX) -fPIC -shared -Wl,-soname,$(SONAME)" +default -> "$(CXX) -fPIC -shared -Wl,-soname,$(SONAME_ABI)" </so_link_commands> diff --git a/src/build-data/cc/pgi.txt b/src/build-data/cc/pgi.txt index 50042388d..ca4b49cd9 100644 --- a/src/build-data/cc/pgi.txt +++ b/src/build-data/cc/pgi.txt @@ -16,8 +16,8 @@ shared_flags "-fPIC" makefile_style gmake <so_link_commands> -linux -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" -solaris -> "$(CXX) -G -fPIC -Wl,-h,$(SONAME)" +linux -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME_ABI)" +solaris -> "$(CXX) -G -fPIC -Wl,-h,$(SONAME_ABI)" </so_link_commands> <mach_opt> diff --git a/src/build-data/cc/sunstudio.txt b/src/build-data/cc/sunstudio.txt index 37998e859..964c878ff 100644 --- a/src/build-data/cc/sunstudio.txt +++ b/src/build-data/cc/sunstudio.txt @@ -21,7 +21,7 @@ ar_command "CC -xar -o" makefile_style gmake <so_link_commands> -default -> "$(CXX) -G -h$(SONAME)" +default -> "$(CXX) -G -h$(SONAME_ABI)" </so_link_commands> <mach_opt> diff --git a/src/build-data/makefile/gmake_dso.in b/src/build-data/makefile/gmake_dso.in index 0e7974791..fa167b780 100644 --- a/src/build-data/makefile/gmake_dso.in +++ b/src/build-data/makefile/gmake_dso.in @@ -1,12 +1,12 @@ -SHARED_LIB_NAME = $(LIB_BASENAME).%{so_suffix}.%{so_abi_rev}.%{version_patch} -SONAME = $(LIB_BASENAME).%{so_suffix}.%{so_abi_rev} -SYMLINK = $(LIB_BASENAME).%{so_suffix} +SONAME_PATCH = %{soname_patch} +SONAME_ABI = %{soname_abi} +SONAME_BASE = %{soname_base} -SHARED_LIB = %{out_dir}/$(SHARED_LIB_NAME) +SHARED_LIB = %{out_dir}/$(SONAME_PATCH) $(SHARED_LIB): $(LIBOBJS) $(LIB_LINK_CMD) $(LDFLAGS) $(LIBOBJS) $(LIB_LINKS_TO) -o $(SHARED_LIB) - $(LN) $(SHARED_LIB_NAME) %{out_dir}/$(SONAME) - $(LN) $(SHARED_LIB_NAME) %{out_dir}/$(SYMLINK) + $(LN) $(SONAME_PATCH) %{out_dir}/$(SONAME_ABI) + $(LN) $(SONAME_PATCH) %{out_dir}/$(SONAME_BASE) LIBRARIES += $(SHARED_LIB) diff --git a/src/build-data/os/android.txt b/src/build-data/os/android.txt index 5df133c8e..43e5fdc44 100644 --- a/src/build-data/os/android.txt +++ b/src/build-data/os/android.txt @@ -1,5 +1,9 @@ os_type unix +soname_pattern_base "libbotan-{version_major}.{version_minor}.so" +soname_pattern_abi "libbotan-{version_major}.{version_minor}.so.{abi_rev}" +soname_pattern_patch "libbotan-{version_major}.{version_minor}.so.{abi_rev}.{version_patch}" + <target_features> clock_gettime gettimeofday diff --git a/src/build-data/os/darwin.txt b/src/build-data/os/darwin.txt index 3a13b34e4..56285ccf7 100644 --- a/src/build-data/os/darwin.txt +++ b/src/build-data/os/darwin.txt @@ -1,6 +1,8 @@ os_type unix -so_suffix dylib +soname_pattern_base "libbotan-{version_major}.{version_minor}.dylib" +soname_pattern_abi "libbotan-{version_major}.{version_minor}.{abi_rev}.dylib" +soname_pattern_patch "libbotan-{version_major}.{version_minor}.{abi_rev}.{version_patch}.dylib" # It doesn't have the 's' option; you need to use needs ranlib ar_command "ar cr" diff --git a/src/build-data/os/hpux.txt b/src/build-data/os/hpux.txt index cea405554..726b0b960 100644 --- a/src/build-data/os/hpux.txt +++ b/src/build-data/os/hpux.txt @@ -1,7 +1,5 @@ os_type unix -so_suffix sl - <target_features> gettimeofday getsid diff --git a/src/build-data/os/linux.txt b/src/build-data/os/linux.txt index 48c3bf318..c83e57afa 100644 --- a/src/build-data/os/linux.txt +++ b/src/build-data/os/linux.txt @@ -1,5 +1,9 @@ os_type unix +soname_pattern_base "libbotan-{version_major}.{version_minor}.so" +soname_pattern_abi "libbotan-{version_major}.{version_minor}.so.{abi_rev}" +soname_pattern_patch "libbotan-{version_major}.{version_minor}.so.{abi_rev}.{version_patch}" + <target_features> clock_gettime gettimeofday diff --git a/src/build-data/os/mingw.txt b/src/build-data/os/mingw.txt index cc98b11e6..a2ba363f2 100644 --- a/src/build-data/os/mingw.txt +++ b/src/build-data/os/mingw.txt @@ -2,9 +2,12 @@ os_type windows program_suffix .exe obj_suffix o -so_suffix dll static_suffix a +soname_pattern_base "libbotan-{version_major}.{version_minor}.dll" +soname_pattern_abi "libbotan-{version_major}.{version_minor}.dll.{abi_rev}" +soname_pattern_patch "libbotan-{version_major}.{version_minor}.dll.{abi_rev}.{version_patch}" + build_shared no ar_command "ar crs" diff --git a/src/build-data/os/windows.txt b/src/build-data/os/windows.txt index fd74fe817..32236e00b 100644 --- a/src/build-data/os/windows.txt +++ b/src/build-data/os/windows.txt @@ -2,9 +2,10 @@ os_type windows program_suffix .exe obj_suffix obj -so_suffix dll static_suffix lib +soname_pattern_base "botan.dll" + install_root c:\\Botan doc_dir docs diff --git a/src/scripts/install.py b/src/scripts/install.py index d3fb7c124..2c69213e5 100755 --- a/src/scripts/install.py +++ b/src/scripts/install.py @@ -69,6 +69,15 @@ def makedirs(dirname, exist_ok = True): if e.errno != errno.EEXIST or not exist_ok: raise e +# Clear link and create new one +def force_symlink(target, linkname): + try: + os.unlink(linkname) + except OSError as e: + if e.errno != errno.ENOENT: + raise e + os.symlink(target, linkname) + def main(args = None): if args is None: args = sys.argv @@ -143,36 +152,23 @@ def main(args = None): if bool(cfg['build_shared_lib']): if str(cfg['os']) == "windows": - shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') # botan.dll - copy_executable(os.path.join(out_dir, shared_lib), - os.path.join(lib_dir, os.path.basename(shared_lib))) + soname_base = process_template('%{soname_base}') # botan.dll + copy_executable(os.path.join(out_dir, soname_base), + os.path.join(lib_dir, soname_base)) else: - shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}.%{version_patch}') - soname = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}') - baselib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') + soname_patch = process_template('%{soname_patch}') + soname_abi = process_template('%{soname_abi}') + soname_base = process_template('%{soname_base}') - copy_executable(os.path.join(out_dir, shared_lib), - os.path.join(lib_dir, os.path.basename(shared_lib))) + copy_executable(os.path.join(out_dir, soname_patch), + os.path.join(lib_dir, soname_patch)) prev_cwd = os.getcwd() try: os.chdir(lib_dir) - - try: - os.unlink(soname) - except OSError as e: - if e.errno != errno.ENOENT: - raise e - - try: - os.unlink(baselib) - except OSError as e: - if e.errno != errno.ENOENT: - raise e - - os.symlink(shared_lib, soname) - os.symlink(soname, baselib) + force_symlink(soname_patch, soname_abi) + force_symlink(soname_patch, soname_base) finally: os.chdir(prev_cwd) |