Skip to content

Commit 0a0fe85

Browse files
committed
ngtcp2.sh: patch to disable requiring C++
C++ only necessary to build examples and BoringSSL feature detection. We build lib-only, meaning no examples. This breaks BoringSSL builds, because they would still require the C++ configuration. BoringSSL builds were broken anyway. Patch submitted upstream: ngtcp2/ngtcp2#1779
1 parent a62d807 commit 0a0fe85

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

ngtcp2.dev.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ngtcp2.patch

ngtcp2.patch

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 45bddf9f..14dd1282 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -28,7 +28,7 @@ cmake_minimum_required(VERSION 3.20)
6+
cmake_policy(SET CMP0063 NEW)
7+
8+
# XXX using 0.1.90 instead of 0.2.0-DEV
9+
-project(ngtcp2 VERSION 1.15.1)
10+
+project(ngtcp2 VERSION 1.15.1 LANGUAGES C)
11+
12+
# See versioning rule:
13+
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
14+
@@ -104,6 +104,10 @@ foreach(_build_type "Release" "MinSizeRel" "RelWithDebInfo")
15+
endforeach()
16+
endforeach()
17+
18+
+if(NOT ENABLE_LIB_ONLY OR ENABLE_BORINGSSL)
19+
+ enable_language(CXX)
20+
+endif()
21+
+
22+
include(CheckCCompilerFlag)
23+
include(CheckCXXCompilerFlag)
24+
25+
@@ -114,7 +118,12 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
26+
cmake_push_check_state()
27+
set(CMAKE_REQUIRED_LIBRARIES "-fsanitize=address")
28+
check_c_compiler_flag(-fsanitize=address C__fsanitize_address_VALID)
29+
- check_cxx_compiler_flag(-fsanitize=address CXX__fsanitize_address_VALID)
30+
+ if(NOT ENABLE_LIB_ONLY OR ENABLE_BORINGSSL)
31+
+ # Bypass C++-specific check for lib-only builds where C++ is not enabled.
32+
+ set(CXX__fsanitize_address_VALID TRUE)
33+
+ else()
34+
+ check_cxx_compiler_flag(-fsanitize=address CXX__fsanitize_address_VALID)
35+
+ endif()
36+
cmake_pop_check_state()
37+
if(NOT C__fsanitize_address_VALID OR NOT CXX__fsanitize_address_VALID)
38+
message(WARNING "ENABLE_ASAN was requested, but not supported!")

ngtcp2.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ _VER="$1"
4747
fi
4848

4949
# shellcheck disable=SC2086
50-
cmake -B "${_BLDDIR}" ${_CMAKE_GLOBAL} ${_CMAKE_CXX_GLOBAL} ${options} \
50+
cmake -B "${_BLDDIR}" ${_CMAKE_GLOBAL} ${options} \
5151
-DENABLE_LIB_ONLY=ON \
5252
-DENABLE_STATIC_LIB=ON \
5353
-DENABLE_SHARED_LIB=OFF \
5454
-DBUILD_TESTING=OFF \
5555
-DCMAKE_INSTALL_PREFIX="${PWD}/${_PPS}" \
56-
-DCMAKE_C_FLAGS="${_CFLAGS_GLOBAL_CMAKE} ${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL} ${CPPFLAGS} ${_LDFLAGS_GLOBAL} ${LDFLAGS} ${LIBS}" \
57-
-DCMAKE_CXX_FLAGS="${_CFLAGS_GLOBAL_CMAKE} ${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL} ${CPPFLAGS} ${_LDFLAGS_GLOBAL} ${LDFLAGS} ${LIBS} ${_CXXFLAGS_GLOBAL} ${_LDFLAGS_CXX_GLOBAL}"
56+
-DCMAKE_C_FLAGS="${_CFLAGS_GLOBAL_CMAKE} ${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL} ${CPPFLAGS} ${_LDFLAGS_GLOBAL} ${LDFLAGS} ${LIBS}"
5857

5958
cmake --build "${_BLDDIR}"
6059
cmake --install "${_BLDDIR}"

ngtcp2.test.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ngtcp2.patch

0 commit comments

Comments
 (0)