From 5f8189bc48aa7e4cfea90d74dccd242597381749 Mon Sep 17 00:00:00 2001 From: "Ryan A. Pavlik" Date: Wed, 13 Jul 2022 12:12:19 -0500 Subject: [PATCH] [liblsquic] Add new port (#24310) * [liblsquic] Add new port. * version * use vcpkg_install_copyright() Co-authored-by: Victor Romero --- ports/liblsquic/disable-asan.patch | 23 +++++++++ ports/liblsquic/portfile.cmake | 76 ++++++++++++++++++++++++++++++ ports/liblsquic/vcpkg.json | 24 ++++++++++ versions/baseline.json | 4 ++ versions/l-/liblsquic.json | 9 ++++ 5 files changed, 136 insertions(+) create mode 100644 ports/liblsquic/disable-asan.patch create mode 100644 ports/liblsquic/portfile.cmake create mode 100644 ports/liblsquic/vcpkg.json create mode 100644 versions/l-/liblsquic.json diff --git a/ports/liblsquic/disable-asan.patch b/ports/liblsquic/disable-asan.patch new file mode 100644 index 0000000000..2b05d0ee3a --- /dev/null +++ b/ports/liblsquic/disable-asan.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 65c4776..5d4086a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -60,12 +60,12 @@ ENDIF() + + IF(CMAKE_BUILD_TYPE STREQUAL "Debug") + SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -O0 -g3") +- IF(CMAKE_C_COMPILER MATCHES "clang" AND +- NOT "$ENV{TRAVIS}" MATCHES "^true$" AND +- NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-fsanitize") +- SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fsanitize=address") +- SET(LIBS ${LIBS} -fsanitize=address) +- ENDIF() ++ # IF(CMAKE_C_COMPILER MATCHES "clang" AND ++ # NOT "$ENV{TRAVIS}" MATCHES "^true$" AND ++ # NOT "$ENV{EXTRA_CFLAGS}" MATCHES "-fsanitize") ++ # SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fsanitize=address") ++ # SET(LIBS ${LIBS} -fsanitize=address) ++ # ENDIF() + # Uncomment to enable cleartext protocol mode (no crypto): + #SET (MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_ENABLE_HANDSHAKE_DISABLE=1") + ELSE() diff --git a/ports/liblsquic/portfile.cmake b/ports/liblsquic/portfile.cmake new file mode 100644 index 0000000000..1d3276082b --- /dev/null +++ b/ports/liblsquic/portfile.cmake @@ -0,0 +1,76 @@ +if(WIN32) + # The lib uses CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS, at least until + # https://github.com/litespeedtech/lsquic/pull/371 or similar is merged + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH + REPO litespeedtech/lsquic + REF v3.1.1 + SHA512 b4675be355703fea12f4b7d24812b93e739b2dbef04e3d8108b6fbe45dd16c129c9e04e58cdcfdf2a4448ee2edea68565dbd2445a76515bbdc8d9980f4210bee + HEAD_REF master + PATCHES disable-asan.patch) + +# Submodules +vcpkg_from_github(OUT_SOURCE_PATH LSQPACK_SOURCE_PATH + REPO litespeedtech/ls-qpack + REF v2.3.0 + HEAD_REF master + SHA512 7f5a9dd15bcd32c1bfafbecc5cea4da30f50a852c02d2bd140a2baaafd80ccb822c1701b0d20699af6367e9c712f4fe019741507c44156e9897d25162de0b8b4 +) +if(NOT EXISTS "${SOURCE_PATH}/src/ls-hpack/CMakeLists.txt") + file(REMOVE_RECURSE "${SOURCE_PATH}/src/liblsquic/ls-qpack") + file(RENAME "${LSQPACK_SOURCE_PATH}" "${SOURCE_PATH}/src/liblsquic/ls-qpack") +endif() + +vcpkg_from_github(OUT_SOURCE_PATH LSHPACK_SOURCE_PATH + REPO litespeedtech/ls-hpack + REF v2.3.0 + HEAD_REF master + SHA512 45866b18042125cbbd008eed2935a938a42e1682030aa52ff4a324ddbad7bf9bd483161352cc8988bae668e132ee8b4b043ddc09d9e0316a66aaefd927ae2d76 +) +if(NOT EXISTS "${SOURCE_PATH}/src/lshpack/CMakeLists.txt") + file(REMOVE_RECURSE "${SOURCE_PATH}/src/lshpack") + file(RENAME "${LSHPACK_SOURCE_PATH}" "${SOURCE_PATH}/src/lshpack") +endif() + +# Configuration +vcpkg_find_acquire_program(PERL) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LSQUIC_SHARED_LIB) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DPERL=${PERL}" + "-DPERL_EXECUTABLE=${PERL}" + "-DLSQUIC_SHARED_LIB=${LSQUIC_SHARED_LIB}" + "-DBORINGSSL_INCLUDE=${CURRENT_INSTALLED_DIR}/include" + -DLSQUIC_BIN=OFF + -DLSQUIC_TESTS=OFF + OPTIONS_RELEASE + "-DBORINGSSL_LIB=${CURRENT_INSTALLED_DIR}/lib" + OPTIONS_DEBUG + "-DBORINGSSL_LIB=${CURRENT_INSTALLED_DIR}/debug/lib" + -DLSQUIC_DEVEL=ON +) + +vcpkg_cmake_install() +if(VCPKG_TARGET_IS_WINDOWS) + # Upstream removed installation of this header after merging changes + file(INSTALL "${SOURCE_PATH}/wincompat/vc_compat.h" DESTINATION "${CURRENT_INSTALLED_DIR}/include/lsquic") +endif() + +vcpkg_cmake_config_fixup(PACKAGE_NAME lsquic) + +# Concatenate license files and install +vcpkg_install_copyright(FILE_LIST + "${SOURCE_PATH}/LICENSE" + "${SOURCE_PATH}/LICENSE.chrome" +) + +file(INSTALL "${CURRENT_BUILDTREES_DIR}/copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +# Remove duplicated include directory +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + diff --git a/ports/liblsquic/vcpkg.json b/ports/liblsquic/vcpkg.json new file mode 100644 index 0000000000..481a3bf16e --- /dev/null +++ b/ports/liblsquic/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "liblsquic", + "version": "3.1.1", + "description": "An implementation of the QUIC and HTTP/3 protocols.", + "homepage": "https://github.com/litespeedtech/lsquic", + "license": "MIT AND BSD-3-Clause", + "supports": "!x86", + "dependencies": [ + "boringssl", + { + "name": "getopt", + "platform": "windows" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 996472f650..0d63b37184 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3780,6 +3780,10 @@ "baseline": "1.16.0", "port-version": 0 }, + "liblsquic": { + "baseline": "3.1.1", + "port-version": 0 + }, "liblzma": { "baseline": "5.2.5", "port-version": 6 diff --git a/versions/l-/liblsquic.json b/versions/l-/liblsquic.json new file mode 100644 index 0000000000..e182c28c55 --- /dev/null +++ b/versions/l-/liblsquic.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "f6f4593aba81acc749f3223d0fd3987d5920b164", + "version": "3.1.1", + "port-version": 0 + } + ] +}