-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
submodule changed: upgrade c-ares and solve related problem (#186)
Squashed commit for update c-ares. This commit squashes multiple commits that update c-ares submodule for proton. The changes were taken from the ClickHouse community and consolidated several pull requests to support the macOS build.
- Loading branch information
Showing
23 changed files
with
2,165 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule c-ares
updated
84 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,96 @@ | ||
# Choose to build static or shared library for c-ares. | ||
if (USE_STATIC_LIBRARIES) | ||
set(CARES_STATIC ON CACHE BOOL "" FORCE) | ||
set(CARES_SHARED OFF CACHE BOOL "" FORCE) | ||
else () | ||
set(CARES_STATIC OFF CACHE BOOL "" FORCE) | ||
set(CARES_SHARED ON CACHE BOOL "" FORCE) | ||
endif () | ||
set(LIBRARY_DIR "${proton_SOURCE_DIR}/contrib/c-ares") | ||
|
||
# Generated from contrib/c-ares/src/lib/Makefile.inc | ||
SET(SRCS | ||
"${LIBRARY_DIR}/src/lib/ares__addrinfo2hostent.c" | ||
"${LIBRARY_DIR}/src/lib/ares__addrinfo_localhost.c" | ||
"${LIBRARY_DIR}/src/lib/ares__close_sockets.c" | ||
"${LIBRARY_DIR}/src/lib/ares__get_hostent.c" | ||
"${LIBRARY_DIR}/src/lib/ares__parse_into_addrinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares__readaddrinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares__sortaddrinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares__read_line.c" | ||
"${LIBRARY_DIR}/src/lib/ares__timeval.c" | ||
"${LIBRARY_DIR}/src/lib/ares_android.c" | ||
"${LIBRARY_DIR}/src/lib/ares_cancel.c" | ||
"${LIBRARY_DIR}/src/lib/ares_data.c" | ||
"${LIBRARY_DIR}/src/lib/ares_destroy.c" | ||
"${LIBRARY_DIR}/src/lib/ares_expand_name.c" | ||
"${LIBRARY_DIR}/src/lib/ares_expand_string.c" | ||
"${LIBRARY_DIR}/src/lib/ares_fds.c" | ||
"${LIBRARY_DIR}/src/lib/ares_free_hostent.c" | ||
"${LIBRARY_DIR}/src/lib/ares_free_string.c" | ||
"${LIBRARY_DIR}/src/lib/ares_freeaddrinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares_getaddrinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares_getenv.c" | ||
"${LIBRARY_DIR}/src/lib/ares_gethostbyaddr.c" | ||
"${LIBRARY_DIR}/src/lib/ares_gethostbyname.c" | ||
"${LIBRARY_DIR}/src/lib/ares_getnameinfo.c" | ||
"${LIBRARY_DIR}/src/lib/ares_getsock.c" | ||
"${LIBRARY_DIR}/src/lib/ares_init.c" | ||
"${LIBRARY_DIR}/src/lib/ares_library_init.c" | ||
"${LIBRARY_DIR}/src/lib/ares_llist.c" | ||
"${LIBRARY_DIR}/src/lib/ares_mkquery.c" | ||
"${LIBRARY_DIR}/src/lib/ares_create_query.c" | ||
"${LIBRARY_DIR}/src/lib/ares_nowarn.c" | ||
"${LIBRARY_DIR}/src/lib/ares_options.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_a_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_aaaa_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_caa_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_mx_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_naptr_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_ns_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_ptr_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_soa_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_srv_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_txt_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_parse_uri_reply.c" | ||
"${LIBRARY_DIR}/src/lib/ares_platform.c" | ||
"${LIBRARY_DIR}/src/lib/ares_process.c" | ||
"${LIBRARY_DIR}/src/lib/ares_query.c" | ||
"${LIBRARY_DIR}/src/lib/ares_rand.c" | ||
"${LIBRARY_DIR}/src/lib/ares_search.c" | ||
"${LIBRARY_DIR}/src/lib/ares_send.c" | ||
"${LIBRARY_DIR}/src/lib/ares_strcasecmp.c" | ||
"${LIBRARY_DIR}/src/lib/ares_strdup.c" | ||
"${LIBRARY_DIR}/src/lib/ares_strerror.c" | ||
"${LIBRARY_DIR}/src/lib/ares_strsplit.c" | ||
"${LIBRARY_DIR}/src/lib/ares_timeout.c" | ||
"${LIBRARY_DIR}/src/lib/ares_version.c" | ||
"${LIBRARY_DIR}/src/lib/ares_writev.c" | ||
"${LIBRARY_DIR}/src/lib/bitncmp.c" | ||
"${LIBRARY_DIR}/src/lib/inet_net_pton.c" | ||
"${LIBRARY_DIR}/src/lib/inet_ntop.c" | ||
"${LIBRARY_DIR}/src/lib/windows_port.c" | ||
) | ||
|
||
# Disable looking for libnsl on a platforms that has gethostbyname in glibc | ||
# | ||
# c-ares searching for gethostbyname in the libnsl library, however in the | ||
# version that shipped with gRPC it doing it wrong [1], since it uses | ||
# CHECK_LIBRARY_EXISTS(), which will return TRUE even if the function exists in | ||
# another dependent library. The upstream already contains correct macro [2], | ||
# but it is not included in gRPC (even upstream gRPC, not the one that is | ||
# shipped with clickhousee). | ||
# | ||
# [1]: https://github.com/c-ares/c-ares/blob/e982924acee7f7313b4baa4ee5ec000c5e373c30/CMakeLists.txt#L125 | ||
# [2]: https://github.com/c-ares/c-ares/blob/44fbc813685a1fa8aa3f27fcd7544faf612d376a/CMakeLists.txt#L146 | ||
# | ||
# And because if you by some reason have libnsl [3] installed, clickhouse will | ||
# reject to start w/o it. While this is completelly different library. | ||
# | ||
# [3]: https://packages.debian.org/bullseye/libnsl2 | ||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") | ||
set(HAVE_LIBNSL OFF CACHE BOOL "" FORCE) | ||
if (USE_STATIC_LIBRARIES) | ||
add_library(_c-ares STATIC ${SRCS}) | ||
target_compile_definitions(_c-ares PUBLIC CARES_STATICLIB) | ||
else() | ||
add_library(_c-ares SHARED ${SRCS}) | ||
target_compile_definitions(_c-ares PUBLIC CARES_BUILDING_LIBRARY) | ||
endif() | ||
|
||
# Force use of c-ares inet_net_pton instead of libresolv one | ||
set(HAVE_INET_NET_PTON OFF CACHE BOOL "" FORCE) | ||
target_compile_definitions(_c-ares PRIVATE HAVE_CONFIG_H=1) | ||
|
||
add_subdirectory("../c-ares/" "../c-ares/") | ||
target_include_directories(_c-ares SYSTEM PUBLIC | ||
"${LIBRARY_DIR}/src/lib" | ||
"${LIBRARY_DIR}/include" | ||
) | ||
|
||
add_library(ch_contrib::c-ares ALIAS c-ares) | ||
# Platform-specific include directories. The original build system does a lot of checks to eventually generate two header files with defines: | ||
# ares_build.h and ares_config.h. To update, run the original CMake build in c-ares for each platform and copy the headers into the | ||
# platform-specific folder. | ||
# For the platform-specific compile definitions, see c-ares top-level CMakeLists.txt. | ||
if (OS_LINUX) | ||
target_include_directories(_c-ares SYSTEM PUBLIC "${proton_SOURCE_DIR}/contrib/c-ares-cmake/linux") | ||
target_compile_definitions(_c-ares PRIVATE -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -D_XOPEN_SOURCE=600) | ||
elseif (OS_DARWIN) | ||
target_include_directories(_c-ares SYSTEM PUBLIC "${proton_SOURCE_DIR}/contrib/c-ares-cmake/darwin") | ||
target_compile_definitions(_c-ares PRIVATE -D_DARWIN_C_SOURCE) | ||
elseif (OS_FREEBSD) | ||
target_include_directories(_c-ares SYSTEM PUBLIC "${proton_SOURCE_DIR}/contrib/c-ares-cmake/freebsd") | ||
endif() | ||
|
||
add_library(ch_contrib::c-ares ALIAS _c-ares) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __CARES_BUILD_H | ||
#define __CARES_BUILD_H | ||
|
||
#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t | ||
#define CARES_TYPEOF_ARES_SSIZE_T ssize_t | ||
|
||
/* Prefix names with CARES_ to make sure they don't conflict with other config.h | ||
* files. We need to include some dependent headers that may be system specific | ||
* for C-Ares */ | ||
#define CARES_HAVE_SYS_TYPES_H | ||
#define CARES_HAVE_SYS_SOCKET_H | ||
/* #undef CARES_HAVE_WINDOWS_H */ | ||
/* #undef CARES_HAVE_WS2TCPIP_H */ | ||
/* #undef CARES_HAVE_WINSOCK2_H */ | ||
/* #undef CARES_HAVE_WINDOWS_H */ | ||
#define CARES_HAVE_ARPA_NAMESER_H | ||
#define CARES_HAVE_ARPA_NAMESER_COMPAT_H | ||
|
||
#ifdef CARES_HAVE_SYS_TYPES_H | ||
# include <sys/types.h> | ||
#endif | ||
|
||
#ifdef CARES_HAVE_SYS_SOCKET_H | ||
# include <sys/socket.h> | ||
#endif | ||
|
||
#ifdef CARES_HAVE_WINSOCK2_H | ||
# include <winsock2.h> | ||
#endif | ||
|
||
#ifdef CARES_HAVE_WS2TCPIP_H | ||
# include <ws2tcpip.h> | ||
#endif | ||
|
||
#ifdef CARES_HAVE_WINDOWS_H | ||
# include <windows.h> | ||
#endif | ||
|
||
|
||
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; | ||
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; | ||
|
||
#endif /* __CARES_BUILD_H */ |
Oops, something went wrong.