aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/cpp-httplib
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/cpp-httplib
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/cpp-httplib')
-rw-r--r--vcpkg/ports/cpp-httplib/fix-find-brotli.patch55
-rw-r--r--vcpkg/ports/cpp-httplib/portfile.cmake37
-rw-r--r--vcpkg/ports/cpp-httplib/usage4
-rw-r--r--vcpkg/ports/cpp-httplib/vcpkg.json47
4 files changed, 143 insertions, 0 deletions
diff --git a/vcpkg/ports/cpp-httplib/fix-find-brotli.patch b/vcpkg/ports/cpp-httplib/fix-find-brotli.patch
new file mode 100644
index 0000000..9c0dcc6
--- /dev/null
+++ b/vcpkg/ports/cpp-httplib/fix-find-brotli.patch
@@ -0,0 +1,55 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0353b0c..5c0cd33 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -151,10 +151,10 @@ endif()
+ # This is so we can use our custom FindBrotli.cmake
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+ if(HTTPLIB_REQUIRE_BROTLI)
+- find_package(Brotli COMPONENTS encoder decoder common REQUIRED)
++ find_package(unofficial-brotli CONFIG REQUIRED)
+ set(HTTPLIB_IS_USING_BROTLI TRUE)
+ elseif(HTTPLIB_USE_BROTLI_IF_AVAILABLE)
+- find_package(Brotli COMPONENTS encoder decoder common QUIET)
++ find_package(unofficial-brotli CONFIG QUIET)
+ set(HTTPLIB_IS_USING_BROTLI ${Brotli_FOUND})
+ endif()
+
+@@ -236,9 +236,9 @@ target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
+ # Needed for API from MacOS Security framework
+ "$<$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>,$<BOOL:${HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN}>>:-framework CoreFoundation -framework Security>"
+ # Can't put multiple targets in a single generator expression or it bugs out.
+- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::common>
+- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::encoder>
+- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::decoder>
++ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:unofficial::brotli::brotlicommon>
++ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:unofficial::brotli::brotlienc>
++ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:unofficial::brotli::brotlidec>
+ $<$<BOOL:${HTTPLIB_IS_USING_ZLIB}>:ZLIB::ZLIB>
+ $<$<BOOL:${HTTPLIB_IS_USING_ZSTD}>:zstd::libzstd>
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL>
+@@ -296,9 +296,6 @@ if(HTTPLIB_INSTALL)
+ install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+- # Install it so it can be used later by the httplibConfig.cmake file.
+- # Put it in the same dir as our config file instead of a global path so we don't potentially stomp on other packages.
+- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindBrotli.cmake"
+ DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
+ )
+
+diff --git a/cmake/httplibConfig.cmake.in b/cmake/httplibConfig.cmake.in
+index bf57364..1c6fe62 100644
+--- a/cmake/httplibConfig.cmake.in
++++ b/cmake/httplibConfig.cmake.in
+@@ -34,8 +34,8 @@ if(@HTTPLIB_IS_USING_BROTLI@)
+ # Note that the FindBrotli.cmake file is installed in the same dir as this file.
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+ set(BROTLI_USE_STATIC_LIBS @BROTLI_USE_STATIC_LIBS@)
+- find_dependency(Brotli COMPONENTS common encoder decoder)
+- set(httplib_Brotli_FOUND ${Brotli_FOUND})
++ find_dependency(unofficial-brotli COMPONENTS common encoder decoder)
++ set(httplib_Brotli_FOUND ${unofficial-brotli_FOUND})
+ endif()
+
+ if(@HTTPLIB_IS_USING_ZSTD@)
diff --git a/vcpkg/ports/cpp-httplib/portfile.cmake b/vcpkg/ports/cpp-httplib/portfile.cmake
new file mode 100644
index 0000000..5fc4b82
--- /dev/null
+++ b/vcpkg/ports/cpp-httplib/portfile.cmake
@@ -0,0 +1,37 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO yhirose/cpp-httplib
+ REF "v${VERSION}"
+ SHA512 884d6be8209d8128af2b11c35d7fc592d8a236a65cdcd9b123a77aa73fbd0dbd03c1cbe17cf4dd92797b06d312c9476d59646b9034d8e559095852b021138acc
+ HEAD_REF master
+ PATCHES
+ fix-find-brotli.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ brotli HTTPLIB_REQUIRE_BROTLI
+ openssl HTTPLIB_REQUIRE_OPENSSL
+ zlib HTTPLIB_REQUIRE_ZLIB
+ zstd HTTPLIB_REQUIRE_ZSTD
+)
+
+set(VCPKG_BUILD_TYPE release) # header-only port
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF
+ -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=OFF
+ -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF
+ -DHTTPLIB_USE_ZSTD_IF_AVAILABLE=OFF
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(PACKAGE_NAME httplib CONFIG_PATH lib/cmake/httplib)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/cpp-httplib/usage b/vcpkg/ports/cpp-httplib/usage
new file mode 100644
index 0000000..8ee7571
--- /dev/null
+++ b/vcpkg/ports/cpp-httplib/usage
@@ -0,0 +1,4 @@
+cpp-httplib provides CMake targets:
+
+ find_package(httplib CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE httplib::httplib)
diff --git a/vcpkg/ports/cpp-httplib/vcpkg.json b/vcpkg/ports/cpp-httplib/vcpkg.json
new file mode 100644
index 0000000..fc113d1
--- /dev/null
+++ b/vcpkg/ports/cpp-httplib/vcpkg.json
@@ -0,0 +1,47 @@
+{
+ "name": "cpp-httplib",
+ "version": "0.27.0",
+ "description": "A single file C++11 header-only HTTP/HTTPS server and client library",
+ "homepage": "https://github.com/yhirose/cpp-httplib",
+ "license": "MIT",
+ "supports": "!x86 & !arm32",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "brotli"
+ ],
+ "features": {
+ "brotli": {
+ "description": "Enables brotli compression support using brotli",
+ "dependencies": [
+ "brotli"
+ ]
+ },
+ "openssl": {
+ "description": "Enables HTTPS support using OpenSSL",
+ "dependencies": [
+ "openssl"
+ ]
+ },
+ "zlib": {
+ "description": "Enables gzip compression support using zlib",
+ "dependencies": [
+ "zlib"
+ ]
+ },
+ "zstd": {
+ "description": "Enables zstd support",
+ "dependencies": [
+ "zstd"
+ ]
+ }
+ }
+}