aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/civetweb
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/civetweb')
-rw-r--r--vcpkg/ports/civetweb/disable_warnings.patch37
-rw-r--r--vcpkg/ports/civetweb/fix-fseeko.patch17
-rw-r--r--vcpkg/ports/civetweb/pkgconfig.patch49
-rw-r--r--vcpkg/ports/civetweb/portfile.cmake54
-rw-r--r--vcpkg/ports/civetweb/usage4
-rw-r--r--vcpkg/ports/civetweb/vcpkg.json27
6 files changed, 188 insertions, 0 deletions
diff --git a/vcpkg/ports/civetweb/disable_warnings.patch b/vcpkg/ports/civetweb/disable_warnings.patch
new file mode 100644
index 0000000..8b10a43
--- /dev/null
+++ b/vcpkg/ports/civetweb/disable_warnings.patch
@@ -0,0 +1,37 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1eb391f2c..2665fa73e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -360,6 +360,7 @@ if (CIVETWEB_ENABLE_CXX)
+ else()
+ add_cxx_compiler_flag(-std=${CIVETWEB_CXX_STANDARD})
+ endif()
++ if(0)
+ add_cxx_compiler_flag(-Wall)
+ add_cxx_compiler_flag(-Wextra)
+ add_cxx_compiler_flag(-Wshadow)
+@@ -377,6 +378,7 @@ if (CIVETWEB_ENABLE_CXX)
+ add_cxx_compiler_flag(-Werror)
+ add_cxx_compiler_flag(/WX)
+ endif()
++ endif()
+ add_cxx_compiler_flag(-pedantic-errors)
+ add_cxx_compiler_flag(-fvisibility=hidden)
+ add_cxx_compiler_flag(-fstack-protector-strong RELEASE)
+@@ -403,6 +405,7 @@ endif()
+
+ if (NOT ZEPHYR)
+ #Warnings: enable everything
++ if(0)
+ add_c_compiler_flag(-Wall)
+ add_c_compiler_flag(-Wextra)
+ add_c_compiler_flag(-Wshadow)
+@@ -422,7 +425,7 @@ if (NOT ZEPHYR)
+ add_c_compiler_flag(-Wno-format-nonliteral) # printf(myFormatStringVar, ...)
+ add_c_compiler_flag(-Wno-cast-qual) # const cast
+ add_c_compiler_flag(/Wd4820) # padding
+-
++ endif()
+ add_c_compiler_flag(-pedantic-errors)
+ add_c_compiler_flag(-fvisibility=hidden)
+ add_c_compiler_flag(-fstack-protector-strong RELEASE)
diff --git a/vcpkg/ports/civetweb/fix-fseeko.patch b/vcpkg/ports/civetweb/fix-fseeko.patch
new file mode 100644
index 0000000..3e2f585
--- /dev/null
+++ b/vcpkg/ports/civetweb/fix-fseeko.patch
@@ -0,0 +1,17 @@
+diff --git a/src/civetweb.c b/src/civetweb.c
+index 9e321ed..0f11407 100644
+--- a/src/civetweb.c
++++ b/src/civetweb.c
+@@ -892,6 +892,12 @@ typedef unsigned short int in_port_t;
+ #if defined(USE_X_DOM_SOCKET)
+ #include <sys/un.h>
+ #endif
++
++#if defined(__ANDROID_API__) && __ANDROID_API__ < 24
++ // Cf. https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md#32_bit-and
++ #define fseeko fseek
++#endif
++
+ #endif
+
+ #define vsnprintf_impl vsnprintf
diff --git a/vcpkg/ports/civetweb/pkgconfig.patch b/vcpkg/ports/civetweb/pkgconfig.patch
new file mode 100644
index 0000000..4c23cbf
--- /dev/null
+++ b/vcpkg/ports/civetweb/pkgconfig.patch
@@ -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@
diff --git a/vcpkg/ports/civetweb/portfile.cmake b/vcpkg/ports/civetweb/portfile.cmake
new file mode 100644
index 0000000..caa0b31
--- /dev/null
+++ b/vcpkg/ports/civetweb/portfile.cmake
@@ -0,0 +1,54 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO civetweb/civetweb
+ REF "v${VERSION}"
+ SHA512 a0b943dfc76d7fd47f5a7d2c834fd38ddd4cf01a11730cf2f7cfaf32fea9698f59672f3a0f86ac80e0abc315d94d2367a500d37013f305c87d45e84cf39ca816
+ HEAD_REF master
+ 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
+ ssl CIVETWEB_ENABLE_SSL
+)
+
+# Fixes arm64-windows build. CIVETWEB_ARCHITECTURE is used only for CPack, which is not used by vcpkg
+vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" "determine_target_architecture(CIVETWEB_ARCHITECTURE)" "")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DCIVETWEB_BUILD_TESTING=OFF
+ -DCIVETWEB_ENABLE_DEBUG_TOOLS=OFF
+ -DCIVETWEB_ENABLE_ASAN=OFF
+ -DCIVETWEB_ENABLE_CXX=ON
+ -DCIVETWEB_ENABLE_IPV6=ON
+ -DCIVETWEB_ENABLE_SERVER_EXECUTABLE=OFF
+ -DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=OFF
+ -DCIVETWEB_ENABLE_WEBSOCKETS=ON
+ -DCIVETWEB_ALLOW_WARNINGS=ON
+ -DCIVETWEB_ENABLE_ZLIB=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(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig")
+
+file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
diff --git a/vcpkg/ports/civetweb/usage b/vcpkg/ports/civetweb/usage
new file mode 100644
index 0000000..287a2ff
--- /dev/null
+++ b/vcpkg/ports/civetweb/usage
@@ -0,0 +1,4 @@
+civetweb provides CMake targets:
+
+ find_package(civetweb CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE civetweb::civetweb)
diff --git a/vcpkg/ports/civetweb/vcpkg.json b/vcpkg/ports/civetweb/vcpkg.json
new file mode 100644
index 0000000..bb2dd92
--- /dev/null
+++ b/vcpkg/ports/civetweb/vcpkg.json
@@ -0,0 +1,27 @@
+{
+ "name": "civetweb",
+ "version": "1.16",
+ "port-version": 2,
+ "description": "Easy to use, powerful, C/C++ embeddable web server.",
+ "homepage": "https://github.com/civetweb/civetweb",
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ },
+ "zlib"
+ ],
+ "features": {
+ "ssl": {
+ "description": "Enable SSL support",
+ "dependencies": [
+ "openssl"
+ ]
+ }
+ }
+}