[ngtcp2] new port (#26955)

* Add ngtcp2 port

* add usage patch

* version

* del patch

* version

* add binary file

* version

* correct namespace

* version

* simplify patch

* version

* simplify patch

* version

* update version to 0.11.0

* update version

Co-authored-by: FrankXie <v-frankxie@microsoft.com>
This commit is contained in:
talregev 2022-12-02 19:23:59 +02:00 committed by GitHub
parent ae02b3ec16
commit c4294eab36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,49 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index d98747f..2bc20d0 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -80,12 +80,15 @@ if(ENABLE_SHARED_LIB)
C_VISIBILITY_PRESET hidden
POSITION_INDEPENDENT_CODE ON
)
- target_include_directories(ngtcp2 PUBLIC ${ngtcp2_INCLUDE_DIRS})
-
- install(TARGETS ngtcp2
+ target_include_directories(ngtcp2 PRIVATE ${ngtcp2_INCLUDE_DIRS})
+ install(TARGETS ngtcp2 EXPORT unofficial-ngtcp2-config
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ install(
+ EXPORT unofficial-ngtcp2-config
+ NAMESPACE unofficial::ngtcp2::
+ DESTINATION share/unofficial-ngtcp2)
endif()
if(HAVE_CUNIT OR ENABLE_STATIC_LIB)
@@ -97,10 +100,14 @@ if(HAVE_CUNIT OR ENABLE_STATIC_LIB)
C_VISIBILITY_PRESET hidden
)
target_compile_definitions(ngtcp2_static PUBLIC "-DNGTCP2_STATICLIB")
- target_include_directories(ngtcp2_static PUBLIC ${ngtcp2_INCLUDE_DIRS})
+ target_include_directories(ngtcp2_static PRIVATE ${ngtcp2_INCLUDE_DIRS})
if(ENABLE_STATIC_LIB)
- install(TARGETS ngtcp2_static
+ install(TARGETS ngtcp2_static EXPORT unofficial-ngtcp2_static-config
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(
+ EXPORT unofficial-ngtcp2_static-config
+ NAMESPACE unofficial::ngtcp2_static::
+ DESTINATION share/unofficial-ngtcp2)
endif()
endif()
diff --git a/lib/includes/CMakeLists.txt b/lib/includes/CMakeLists.txt
index 5eabf73..78bb715 100644
--- a/lib/includes/CMakeLists.txt
+++ b/lib/includes/CMakeLists.txt
@@ -1,3 +1,4 @@
+configure_file("${CMAKE_CURRENT_LIST_DIR}/ngtcp2/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/ngtcp2/version.h")
install(FILES
ngtcp2/ngtcp2.h
"${CMAKE_CURRENT_BINARY_DIR}/ngtcp2/version.h"

View File

@ -0,0 +1,36 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ngtcp2/ngtcp2
REF v0.11.0
SHA512 e15296c7ffd85e85c32db3bcd109fb473ca6af9b0c03b0d0559ae29c0938da59163ad45968a27cc020f56929732edbb42755c9bc83a2b1c5bdb396b69650d936
HEAD_REF master
PATCHES
export-unofficical-target.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC_LIB)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED_LIB)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DENABLE_STATIC_LIB=${ENABLE_STATIC_LIB}"
"-DENABLE_SHARED_LIB=${ENABLE_SHARED_LIB}"
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(CONFIG_PATH "share/unofficial-ngtcp2")
# Clean
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/doc")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
#License
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

18
ports/ngtcp2/vcpkg.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "ngtcp2",
"version": "0.11.0",
"description": "ngtcp2 project is an effort to implement RFC9000 QUIC protocol.",
"homepage": "https://github.com/ngtcp2/ngtcp2",
"license": "MIT",
"supports": "!(arm & uwp)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -5208,6 +5208,10 @@
"baseline": "37",
"port-version": 0
},
"ngtcp2": {
"baseline": "0.11.0",
"port-version": 0
},
"nifly": {
"baseline": "1.0.0",
"port-version": 0

9
versions/n-/ngtcp2.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "84ab1e937c8536276a0dbd41ef161818f3227a27",
"version": "0.11.0",
"port-version": 0
}
]
}