Skip to content

Commit

Permalink
[civetweb] Dynamic linkage, debug pc file (#34654)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Oct 23, 2023
1 parent 374023b commit 2d0bfe5
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 12 deletions.
49 changes: 49 additions & 0 deletions ports/civetweb/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5368c0..c297861 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -614,6 +614,10 @@ configure_package_config_file(
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CIVETWEB_ENABLE_CXX
)

+set(PROJECT_VERSION "${VERSION}")
+if(CIVETWEB_ENABLE_SSL)
+ set(REQUIRES_OPENSSL openssl)
+endif()
configure_file(
cmake/${PROJECT_NAME}.pc.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc
@@ -629,13 +633,13 @@ configure_file(
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-cpp.pc"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake
diff --git a/cmake/civetweb-cpp.pc.in b/cmake/civetweb-cpp.pc.in
index ca1232c..495da46 100644
--- a/cmake/civetweb-cpp.pc.in
+++ b/cmake/civetweb-cpp.pc.in
@@ -10,3 +10,4 @@ Requires:
Libs: -L${libdir} -l@PROJECT_NAME@-cpp
Cflags: -I${includedir}

+Requires.private: civetweb
diff --git a/cmake/civetweb.pc.in b/cmake/civetweb.pc.in
index 27cea8f..0826f61 100644
--- a/cmake/civetweb.pc.in
+++ b/cmake/civetweb.pc.in
@@ -11,3 +11,4 @@ Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir}


+Requires.private: @REQUIRES_OPENSSL@
23 changes: 12 additions & 11 deletions ports/civetweb/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO civetweb/civetweb
Expand All @@ -9,7 +7,9 @@ vcpkg_from_github(
PATCHES
disable_warnings.patch # cl will simply ignore the other invalid options.
fix-fseeko.patch
pkgconfig.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/src/third_party")

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
Expand All @@ -31,22 +31,23 @@ vcpkg_cmake_configure(
-DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=OFF
-DCIVETWEB_ENABLE_WEBSOCKETS=ON
-DCIVETWEB_ALLOW_WARNINGS=ON
"-DVERSION=${VERSION}"
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()

vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/civetweb)
vcpkg_fixup_pkgconfig()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/civetweb.h" "defined(CIVETWEB_DLL_IMPORTS)" 1)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/CivetServer.h" "defined(CIVETWEB_CXX_DLL_IMPORTS)" 1)
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/civetweb.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/civetweb.pc")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/civetweb-cpp.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/civetweb-cpp.pc")
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig")

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

vcpkg_copy_pdbs()
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
4 changes: 4 additions & 0 deletions ports/civetweb/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
civetweb provides CMake targets:

find_package(civetweb CONFIG REQUIRED)
target_link_libraries(main PRIVATE civetweb::civetweb)
1 change: 1 addition & 0 deletions ports/civetweb/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "civetweb",
"version": "1.16",
"port-version": 1,
"description": "Easy to use, powerful, C/C++ embeddable web server.",
"homepage": "https://github.com/civetweb/civetweb",
"supports": "!uwp",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@
},
"civetweb": {
"baseline": "1.16",
"port-version": 0
"port-version": 1
},
"cjson": {
"baseline": "1.7.16",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/civetweb.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "23fa18e460290d6b0629ca6487f69b56845cfbda",
"version": "1.16",
"port-version": 1
},
{
"git-tree": "46ba5309a5759827c0d729344e8f17cc5f3132b9",
"version": "1.16",
Expand Down

0 comments on commit 2d0bfe5

Please # to comment.