master
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23###########################################################################
24# Find the ngtcp2 library
25#
26# This module accepts optional COMPONENTS to control the crypto library (these are
27# mutually exclusive):
28#
29# - BoringSSL: Use `libngtcp2_crypto_boringssl`. (also for AWS-LC)
30# - GnuTLS: Use `libngtcp2_crypto_gnutls`.
31# - LibreSSL: Use `libngtcp2_crypto_libressl`. (requires ngtcp2 1.15.0+)
32# - ossl: Use `libngtcp2_crypto_ossl`.
33# - quictls: Use `libngtcp2_crypto_quictls`. (also for LibreSSL with ngtcp2 <1.15.0)
34# - wolfSSL: Use `libngtcp2_crypto_wolfssl`.
35#
36# Input variables:
37#
38# - `NGTCP2_INCLUDE_DIR`: Absolute path to ngtcp2 include directory.
39# - `NGTCP2_LIBRARY`: Absolute path to `ngtcp2` library.
40# - `NGTCP2_CRYPTO_BORINGSSL_LIBRARY`: Absolute path to `ngtcp2_crypto_boringssl` library.
41# - `NGTCP2_CRYPTO_GNUTLS_LIBRARY`: Absolute path to `ngtcp2_crypto_gnutls` library.
42# - `NGTCP2_CRYPTO_LIBRESSL_LIBRARY`: Absolute path to `ngtcp2_crypto_libressl` library.
43# - `NGTCP2_CRYPTO_OSSL_LIBRARY`: Absolute path to `ngtcp2_crypto_ossl` library.
44# - `NGTCP2_CRYPTO_QUICTLS_LIBRARY`: Absolute path to `ngtcp2_crypto_quictls` library.
45# - `NGTCP2_CRYPTO_WOLFSSL_LIBRARY`: Absolute path to `ngtcp2_crypto_wolfssl` library.
46# - `NGTCP2_USE_STATIC_LIBS`: Configure for static ngtcp2 libraries.
47#
48# Defines:
49#
50# - `NGTCP2_FOUND`: System has ngtcp2.
51# - `NGTCP2_VERSION`: Version of ngtcp2.
52# - `NGTCP2_CRYPTO_BACKEND`: Name of the crypto library component. (Empty if COMPONENTS was not used.)
53# - `CURL::ngtcp2`: ngtcp2 library target.
55set(NGTCP2_CRYPTO_BACKEND "")
56if(NGTCP2_FIND_COMPONENTS)
57 foreach(_component IN LISTS NGTCP2_FIND_COMPONENTS)
58 if(_component MATCHES "^(BoringSSL|GnuTLS|LibreSSL|ossl|quictls|wolfSSL)")
59 if(NGTCP2_CRYPTO_BACKEND)
60 message(FATAL_ERROR "NGTCP2: Only one crypto library can be selected")
61 endif()
62 set(NGTCP2_CRYPTO_BACKEND ${_component})
63 endif()
64 endforeach()
66 if(NGTCP2_CRYPTO_BACKEND)
67 string(TOLOWER "ngtcp2_crypto_${NGTCP2_CRYPTO_BACKEND}" _crypto_library_lower)
68 string(TOUPPER "ngtcp2_crypto_${NGTCP2_CRYPTO_BACKEND}" _crypto_library_upper)
69 endif()
70endif()
72set(_ngtcp2_pc_requires "libngtcp2")
73if(NGTCP2_CRYPTO_BACKEND)
74 list(APPEND _ngtcp2_pc_requires "lib${_crypto_library_lower}")
75endif()
77set(_tried_pkgconfig FALSE)
78if(NOT DEFINED NGTCP2_INCLUDE_DIR AND
79 NOT DEFINED NGTCP2_LIBRARY)
80 if(CURL_USE_PKGCONFIG)
81 find_package(PkgConfig QUIET)
82 pkg_check_modules(_ngtcp2 ${_ngtcp2_pc_requires})
83 set(_tried_pkgconfig TRUE)
84 endif()
85 if(NOT _ngtcp2_FOUND AND CURL_USE_CMAKECONFIG AND NGTCP2_CRYPTO_BACKEND)
86 find_package(ngtcp2 CONFIG QUIET)
87 # Skip using it if the crypto library target is not available
88 if(ngtcp2_CONFIG AND
89 NOT TARGET ngtcp2::${_crypto_library_lower}_static AND
90 NOT TARGET ngtcp2::${_crypto_library_lower})
91 unset(ngtcp2_CONFIG)
92 endif()
93 endif()
94endif()
96if(_ngtcp2_FOUND)
97 set(NGTCP2_FOUND TRUE)
98 set(NGTCP2_VERSION ${_ngtcp2_libngtcp2_VERSION})
99 if(NGTCP2_USE_STATIC_LIBS)
100 set(_ngtcp2_CFLAGS "${_ngtcp2_STATIC_CFLAGS}")
101 set(_ngtcp2_INCLUDE_DIRS "${_ngtcp2_STATIC_INCLUDE_DIRS}")
102 set(_ngtcp2_LIBRARY_DIRS "${_ngtcp2_STATIC_LIBRARY_DIRS}")
103 set(_ngtcp2_LIBRARIES "${_ngtcp2_STATIC_LIBRARIES}")
104 endif()
105 message(STATUS "Found NGTCP2 (via pkg-config): ${_ngtcp2_INCLUDE_DIRS} (found version \"${NGTCP2_VERSION}\")")
106elseif(ngtcp2_CONFIG)
107 set(NGTCP2_FOUND TRUE)
108 set(NGTCP2_VERSION ${ngtcp2_VERSION})
109 if(NGTCP2_USE_STATIC_LIBS OR NOT TARGET ngtcp2::ngtcp2)
110 set(_ngtcp2_LIBRARIES ngtcp2::ngtcp2_static ngtcp2::${_crypto_library_lower}_static)
111 else()
112 set(_ngtcp2_LIBRARIES ngtcp2::ngtcp2 ngtcp2::${_crypto_library_lower})
113 endif()
114 message(STATUS "Found NGTCP2 (via CMake Config): ${ngtcp2_CONFIG} (found version \"${NGTCP2_VERSION}\")")
115else()
116 find_path(NGTCP2_INCLUDE_DIR NAMES "ngtcp2/ngtcp2.h")
117 if(NGTCP2_USE_STATIC_LIBS)
118 set(_ngtcp2_CFLAGS "-DNGTCP2_STATICLIB")
119 find_library(NGTCP2_LIBRARY NAMES "ngtcp2_static" "ngtcp2")
120 else()
121 find_library(NGTCP2_LIBRARY NAMES "ngtcp2")
122 endif()
124 unset(NGTCP2_VERSION CACHE)
125 if(NGTCP2_INCLUDE_DIR AND EXISTS "${NGTCP2_INCLUDE_DIR}/ngtcp2/version.h")
126 set(_version_regex "#[\t ]*define[\t ]+NGTCP2_VERSION[\t ]+\"([^\"]*)\"")
127 file(STRINGS "${NGTCP2_INCLUDE_DIR}/ngtcp2/version.h" _version_str REGEX "${_version_regex}")
128 string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}")
129 set(NGTCP2_VERSION "${_version_str}")
130 unset(_version_regex)
131 unset(_version_str)
132 endif()
134 if(NGTCP2_CRYPTO_BACKEND)
135 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
136 cmake_path(GET NGTCP2_LIBRARY PARENT_PATH _ngtcp2_library_dir)
137 else()
138 get_filename_component(_ngtcp2_library_dir "${NGTCP2_LIBRARY}" DIRECTORY)
139 endif()
140 if(NGTCP2_USE_STATIC_LIBS)
141 find_library(${_crypto_library_upper}_LIBRARY NAMES ${_crypto_library_lower}_static ${_crypto_library_lower}
142 HINTS ${_ngtcp2_library_dir})
143 else()
144 find_library(${_crypto_library_upper}_LIBRARY NAMES ${_crypto_library_lower}
145 HINTS ${_ngtcp2_library_dir})
146 endif()
148 if(${_crypto_library_upper}_LIBRARY)
149 set(NGTCP2_${NGTCP2_CRYPTO_BACKEND}_FOUND TRUE)
150 set(NGTCP2_CRYPTO_LIBRARY ${${_crypto_library_upper}_LIBRARY})
151 endif()
152 endif()
154 include(FindPackageHandleStandardArgs)
155 find_package_handle_standard_args(NGTCP2
156 REQUIRED_VARS
157 NGTCP2_INCLUDE_DIR
158 NGTCP2_LIBRARY
159 VERSION_VAR
160 NGTCP2_VERSION
161 HANDLE_COMPONENTS
162 )
164 if(NGTCP2_FOUND)
165 set(_ngtcp2_INCLUDE_DIRS ${NGTCP2_INCLUDE_DIR})
166 set(_ngtcp2_LIBRARIES ${NGTCP2_LIBRARY} ${NGTCP2_CRYPTO_LIBRARY})
167 endif()
169 mark_as_advanced(NGTCP2_INCLUDE_DIR NGTCP2_LIBRARY NGTCP2_CRYPTO_LIBRARY)
171 if(NOT NGTCP2_FOUND AND _tried_pkgconfig) # reset variables to allow another round of detection
172 unset(NGTCP2_INCLUDE_DIR CACHE)
173 unset(NGTCP2_LIBRARY CACHE)
174 endif()
175endif()
177if(NGTCP2_FOUND)
178 if(NOT TARGET CURL::ngtcp2)
179 add_library(CURL::ngtcp2 INTERFACE IMPORTED)
180 set_target_properties(CURL::ngtcp2 PROPERTIES
181 INTERFACE_LIBCURL_PC_MODULES "${_ngtcp2_pc_requires}"
182 INTERFACE_COMPILE_OPTIONS "${_ngtcp2_CFLAGS}"
183 INTERFACE_INCLUDE_DIRECTORIES "${_ngtcp2_INCLUDE_DIRS}"
184 INTERFACE_LINK_DIRECTORIES "${_ngtcp2_LIBRARY_DIRS}"
185 INTERFACE_LINK_LIBRARIES "${_ngtcp2_LIBRARIES}")
186 endif()
187endif()
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.5 KiB · hit24 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=23 git.response.bytes=2512 git.response.cache=HIT git.response.duration_ms=24 git.fetch.wants=bf2f4887774936df2cf19fb8aa5ed4a1bd80afae git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2512 git.pkt.payload.max=2491 git.sideband.band1.bytes=2490 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2fd7a7b01cf81
- Request
- e0de5125…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format