diff --git a/ports/nghttp2/CONTROL b/ports/nghttp2/CONTROL index beb237aada0ba2..f4ff49ae06cdab 100644 --- a/ports/nghttp2/CONTROL +++ b/ports/nghttp2/CONTROL @@ -1,3 +1,3 @@ Source: nghttp2 -Version: 1.29.0 +Version: 1.30.0-1 Description: Implementation of the Hypertext Transfer Protocol version 2 in C diff --git a/ports/nghttp2/enable-static.patch b/ports/nghttp2/enable-static.patch new file mode 100644 index 00000000000000..3b58979cf8c420 --- /dev/null +++ b/ports/nghttp2/enable-static.patch @@ -0,0 +1,23 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 0846d06..290679f 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -38,7 +38,7 @@ if(WIN32) + endif() + + # Public shared library +-add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) ++add_library(nghttp2 ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) + set_target_properties(nghttp2 PROPERTIES + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} +@@ -48,6 +48,9 @@ target_include_directories(nghttp2 INTERFACE + "${CMAKE_CURRENT_BINARY_DIR}/includes" + "${CMAKE_CURRENT_SOURCE_DIR}/includes" + ) ++if(NOT BUILD_SHARED_LIBS) ++ target_compile_definitions(nghttp2 PUBLIC "-DNGHTTP2_STATICLIB") ++endif() + + if(HAVE_CUNIT) + # Static library (for unittests because of symbol visibility) diff --git a/ports/nghttp2/portfile.cmake b/ports/nghttp2/portfile.cmake index 02133feeb1d547..3c082c19138ada 100644 --- a/ports/nghttp2/portfile.cmake +++ b/ports/nghttp2/portfile.cmake @@ -1,15 +1,7 @@ include(vcpkg_common_functions) set(LIB_NAME nghttp2) -set(LIB_VERSION 1.29.0) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - message("nghttp2 doesn't currently support static library build") - set(VCPKG_LIBRARY_LINKAGE dynamic) - if(VCPKG_CRT_LINKAGE STREQUAL static) - message(FATAL_ERROR "avoiding building DLL with static CRT.") - endif() -endif() +set(LIB_VERSION 1.30.0) set(LIB_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.gz) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) @@ -17,12 +9,19 @@ set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://github.com/nghttp2/nghttp2/releases/download/v${LIB_VERSION}/${LIB_FILENAME}" FILENAME "${LIB_FILENAME}" - SHA512 34dfda7ba637fb23b24141aacf8a0c342a369a59c84d4e2bfed9b5a867f85a5d1d950267f018a820645954406d70bf499f01e2f9b1ebaa4b76e8f47c3693fd6e + SHA512 26ce717a085e9fbdf8e644d4c8ab6961ca60029c4dfa112c9932523d1c4cc3f40fda4283afddf78a649e7f6fb7d3f3bfce3197186a4f70819b5996e8158089da ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/enable-static.patch" +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DENABLE_LIB_ONLY=ON -DENABLE_ASIO_LIB=OFF @@ -37,7 +36,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) # Move dll files from /lib to /bin where vcpkg expects them -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/${LIB_NAME}.dll ${CURRENT_PACKAGES_DIR}/bin/${LIB_NAME}.dll)