diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-02-07 12:12:14 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-02-07 12:12:14 -0800 |
| commit | b4676f2dd583a2399b195cc6d49bd77d01bd8878 (patch) | |
| tree | 7f8c6f14747198e1f28eea6e0f9140d7d15bce7e | |
| parent | 2d324592a4ac01086191c5137efe6eead3c3c65c (diff) | |
| download | vcpkg-b4676f2dd583a2399b195cc6d49bd77d01bd8878.tar.gz vcpkg-b4676f2dd583a2399b195cc6d49bd77d01bd8878.zip | |
[nghttp2] Enable static builds
| -rw-r--r-- | ports/nghttp2/CONTROL | 2 | ||||
| -rw-r--r-- | ports/nghttp2/enable-static.patch | 23 | ||||
| -rw-r--r-- | ports/nghttp2/portfile.cmake | 17 |
3 files changed, 32 insertions, 10 deletions
diff --git a/ports/nghttp2/CONTROL b/ports/nghttp2/CONTROL index beb237aad..448f6cc89 100644 --- a/ports/nghttp2/CONTROL +++ b/ports/nghttp2/CONTROL @@ -1,3 +1,3 @@ Source: nghttp2 -Version: 1.29.0 +Version: 1.29.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 000000000..3b58979cf --- /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 02133feeb..6850a70d6 100644 --- a/ports/nghttp2/portfile.cmake +++ b/ports/nghttp2/portfile.cmake @@ -3,14 +3,6 @@ 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_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.gz) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIB_NAME}-${LIB_VERSION}) @@ -21,8 +13,15 @@ vcpkg_download_distfile(ARCHIVE ) 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) |
