mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
build: tidy up and improve versioned-symbols options
- autotools: add support for custom prefix.
Usage: `--enable-versioned-symbols=MYPREFIX_`
Catching up with cmake.
- add default versioned prefix for Rustls builds.
- delete `HIDDEN` entry from version script `lib/libcurl.vers.in`.
It referred to symbol names that never existed in libcurl.
- cmake: use `lib/libcurl.vers.in` as a template instead of generating
it from scratch. Adapt `./configure` accordingly, and add comments
to keep hard-wired soname in sync with `lib/Makefile.soname`.
- autotools: delete Schannel and Secure Transport version prefixes.
Windows and macOS don't support the versioned symbols option.
Follow-up to 7b14449790
#14378
Closes #14818
This commit is contained in:
parent
30ab1133c4
commit
7100c5bc9b
27
configure.ac
27
configure.ac
@ -2546,7 +2546,11 @@ AC_ARG_ENABLE(versioned-symbols,
|
||||
AS_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
|
||||
AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
|
||||
[ case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_MSG_CHECKING([if libraries can be versioned])
|
||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||
if test -z "$GLD"; then
|
||||
@ -2554,7 +2558,9 @@ AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shar
|
||||
AC_MSG_WARN([You need an ld version supporting the --version-script option])
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
|
||||
if test "x$enableval" != "xyes"; then
|
||||
versioned_symbols_flavour="$enableval"
|
||||
elif test "x$CURL_WITH_MULTI_SSL" = "x1"; then
|
||||
versioned_symbols_flavour="MULTISSL_"
|
||||
elif test "x$OPENSSL_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="OPENSSL_"
|
||||
@ -2562,14 +2568,12 @@ AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shar
|
||||
versioned_symbols_flavour="MBEDTLS_"
|
||||
elif test "x$BEARSSL_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="BEARSSL_"
|
||||
elif test "x$GNUTLS_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="GNUTLS_"
|
||||
elif test "x$WOLFSSL_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="WOLFSSL_"
|
||||
elif test "x$SCHANNEL_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="SCHANNEL_"
|
||||
elif test "x$SECURETRANSPORT_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="SECURE_TRANSPORT_"
|
||||
elif test "x$GNUTLS_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="GNUTLS_"
|
||||
elif test "x$RUSTLS_ENABLED" = "x1"; then
|
||||
versioned_symbols_flavour="RUSTLS_"
|
||||
else
|
||||
versioned_symbols_flavour=""
|
||||
fi
|
||||
@ -2577,17 +2581,14 @@ AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shar
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
|
||||
["$versioned_symbols_flavour"])
|
||||
AC_SUBST([CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX], ["$versioned_symbols_flavour"])
|
||||
AC_SUBST([CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME], ["4"]) dnl Keep in sync with VERSIONCHANGE - VERSIONDEL in lib/Makefile.soname
|
||||
AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
|
||||
[test "x$versioned_symbols" = 'xyes'])
|
||||
|
||||
|
@ -238,15 +238,18 @@ if(BUILD_SHARED_LIBS)
|
||||
set(CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX "WOLFSSL_")
|
||||
elseif(CURL_USE_GNUTLS)
|
||||
set(CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX "GNUTLS_")
|
||||
elseif(CURL_USE_RUSTLS)
|
||||
set(CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX "RUSTLS_")
|
||||
endif()
|
||||
endif()
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers" "
|
||||
HIDDEN {};
|
||||
CURL_${CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX}${_cmakesoname}
|
||||
{
|
||||
global: curl_*;
|
||||
local: *;
|
||||
};")
|
||||
# Generate version script for the linker, for versioned symbols.
|
||||
# Consumed variables:
|
||||
# CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX
|
||||
# CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME
|
||||
set(CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME ${_cmakesoname})
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libcurl.vers.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers" @ONLY)
|
||||
include(CheckCSourceCompiles)
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers")
|
||||
check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSIONED_SYMBOLS)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Keep in sync with CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME in configure.ac
|
||||
VERSIONCHANGE=12
|
||||
VERSIONADD=0
|
||||
VERSIONDEL=8
|
||||
|
@ -1,12 +1,4 @@
|
||||
HIDDEN
|
||||
{
|
||||
local:
|
||||
__*;
|
||||
_rest*;
|
||||
_save*;
|
||||
};
|
||||
|
||||
CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@4
|
||||
CURL_@CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX@@CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME@
|
||||
{
|
||||
global: curl_*;
|
||||
local: *;
|
||||
|
Loading…
Reference in New Issue
Block a user