forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/mohsaka/velox into ipprefix…
…_final
- Loading branch information
Showing
491 changed files
with
16,310 additions
and
5,760 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
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
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
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
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,40 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
find_package(c-ares CONFIG) | ||
if(c-ares_FOUND) | ||
if(TARGET c-ares::cares) | ||
return() | ||
endif() | ||
endif() | ||
|
||
find_path( | ||
C_ARES_INCLUDE_DIR | ||
NAMES ares.h | ||
PATH_SUFFIXES c-ares) | ||
find_library(C_ARES_LIBRARY NAMES c-ares) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(c-ares DEFAULT_MSG C_ARES_LIBRARY | ||
C_ARES_INCLUDE_DIR) | ||
|
||
if(c-ares_FOUND AND NOT TARGET c-ares::cares) | ||
add_library(c-ares::cares UNKNOWN IMPORTED) | ||
set_target_properties( | ||
c-ares::cares | ||
PROPERTIES IMPORTED_LOCATION "${C_ARES_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${C_ARES_INCLUDE_DIR}") | ||
endif() | ||
|
||
mark_as_advanced(C_ARES_INCLUDE_DIR C_ARES_LIBRARY) |
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
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 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
include_guard(GLOBAL) | ||
|
||
set(VELOX_CARES_BUILD_VERSION cares-1_13_0) | ||
set(VELOX_CARES_BUILD_SHA256_CHECKSUM | ||
7c48c57706a38691041920e705d2a04426ad9c68d40edd600685323f214b2d57) | ||
string( | ||
CONCAT VELOX_CARES_SOURCE_URL | ||
"https://github.com/c-ares/c-ares/archive/refs/tags/" | ||
"${VELOX_CARES_BUILD_VERSION}.tar.gz") | ||
|
||
resolve_dependency_url(CARES) | ||
|
||
message(STATUS "Building C-ARES from source") | ||
|
||
FetchContent_Declare( | ||
c-ares | ||
URL ${VELOX_CARES_SOURCE_URL} | ||
URL_HASH ${VELOX_CARES_BUILD_SHA256_CHECKSUM} | ||
PATCH_COMMAND | ||
git init && git apply | ||
${CMAKE_CURRENT_LIST_DIR}/c-ares/c-ares-random-file.patch | ||
OVERRIDE_FIND_PACKAGE EXCLUDE_FROM_ALL SYSTEM) | ||
|
||
set(CARES_STATIC ON) | ||
set(CARES_INSTALL ON) | ||
set(CARES_SHARED OFF) | ||
FetchContent_MakeAvailable(c-ares) | ||
if(NOT TARGET c-ares::cares) | ||
add_library(c-ares::cares ALIAS c-ares) | ||
endif() |
73 changes: 73 additions & 0 deletions
73
CMake/resolve_dependency_modules/c-ares/c-ares-random-file.patch
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,73 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 364b6c7c..c96a5b6c 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -333,6 +333,8 @@ SET (CMAKE_EXTRA_INCLUDE_FILES) | ||
SET (CMAKE_REQUIRED_DEFINITIONS) | ||
SET (CMAKE_REQUIRED_LIBRARIES) | ||
|
||
+find_file(CARES_RANDOM_FILE urandom /dev) | ||
+mark_as_advanced(CARES_RANDOM_FILE) | ||
|
||
################################################################################ | ||
# recv, recvfrom, send, getnameinfo, gethostname | ||
diff --git a/ares_config.h.cmake b/ares_config.h.cmake | ||
index 0cb2f6ae..b5da36d3 100644 | ||
--- a/ares_config.h.cmake | ||
+++ b/ares_config.h.cmake | ||
@@ -338,7 +338,7 @@ | ||
#cmakedefine NEED_MEMORY_H | ||
|
||
/* a suitable file/device to read random data from */ | ||
-#cmakedefine RANDOM_FILE | ||
+#cmakedefine CARES_RANDOM_FILE "@CARES_RANDOM_FILE@" | ||
|
||
/* Define to the type qualifier pointed by arg 5 for recvfrom. */ | ||
#define RECVFROM_QUAL_ARG5 @RECVFROM_QUAL_ARG5@ | ||
diff --git a/ares_init.c b/ares_init.c | ||
index f7b700bf..29bb9784 100644 | ||
--- a/ares_init.c | ||
+++ b/ares_init.c | ||
@@ -2376,8 +2376,8 @@ static void randomize_key(unsigned char* key,int key_data_len) | ||
randomized = 1; | ||
} | ||
#else /* !WIN32 */ | ||
-#ifdef RANDOM_FILE | ||
- FILE *f = fopen(RANDOM_FILE, "rb"); | ||
+#ifdef CARES_RANDOM_FILE | ||
+ FILE *f = fopen(CARES_RANDOM_FILE, "rb"); | ||
if(f) { | ||
counter = aresx_uztosi(fread(key, 1, key_data_len, f)); | ||
fclose(f); | ||
diff --git a/configure.ac b/configure.ac | ||
index 7e86ad67..ffdcfdf7 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -829,22 +829,22 @@ dnl Check for user-specified random device | ||
AC_ARG_WITH(random, | ||
AC_HELP_STRING([--with-random=FILE], | ||
[read randomness from FILE (default=/dev/urandom)]), | ||
- [ RANDOM_FILE="$withval" ], | ||
+ [ CARES_RANDOM_FILE="$withval" ], | ||
[ | ||
dnl Check for random device. If we're cross compiling, we can't | ||
dnl check, and it's better to assume it doesn't exist than it is | ||
dnl to fail on AC_CHECK_FILE or later. | ||
if test "$cross_compiling" = "no"; then | ||
- AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] ) | ||
+ AC_CHECK_FILE("/dev/urandom", [ CARES_RANDOM_FILE="/dev/urandom"] ) | ||
else | ||
AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none]) | ||
fi | ||
|
||
] | ||
) | ||
-if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then | ||
- AC_SUBST(RANDOM_FILE) | ||
- AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE", | ||
+if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then | ||
+ AC_SUBST(CARES_RANDOM_FILE) | ||
+ AC_DEFINE_UNQUOTED(CARES_RANDOM_FILE, "$CARES_RANDOM_FILE", | ||
[a suitable file/device to read random data from]) | ||
fi | ||
|
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
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
Oops, something went wrong.