diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/hiredis | |
Diffstat (limited to 'vcpkg/ports/hiredis')
| -rw-r--r-- | vcpkg/ports/hiredis/fix-cmake-conf-install-dir.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/hiredis/fix-ssize_t.patch | 11 | ||||
| -rw-r--r-- | vcpkg/ports/hiredis/fix-timeval.patch | 16 | ||||
| -rw-r--r-- | vcpkg/ports/hiredis/portfile.cmake | 52 | ||||
| -rw-r--r-- | vcpkg/ports/hiredis/support-static.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/hiredis/vcpkg.json | 25 |
6 files changed, 148 insertions, 0 deletions
diff --git a/vcpkg/ports/hiredis/fix-cmake-conf-install-dir.patch b/vcpkg/ports/hiredis/fix-cmake-conf-install-dir.patch new file mode 100644 index 0000000..d074821 --- /dev/null +++ b/vcpkg/ports/hiredis/fix-cmake-conf-install-dir.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fca0ee8..b67888e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -125,7 +127,7 @@ export(EXPORT hiredis-targets + if(WIN32) + SET(CMAKE_CONF_INSTALL_DIR share/hiredis) + else() +- SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/hiredis) ++ SET(CMAKE_CONF_INSTALL_DIR share/hiredis) + endif() + SET(INCLUDE_INSTALL_DIR include) + include(CMakePackageConfigHelpers) +@@ -200,7 +204,7 @@ IF(ENABLE_SSL) + if(WIN32) + SET(CMAKE_CONF_INSTALL_DIR share/hiredis_ssl) + else() +- SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/hiredis_ssl) ++ SET(CMAKE_CONF_INSTALL_DIR share/hiredis_ssl) + endif() + configure_package_config_file(hiredis_ssl-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/hiredis_ssl-config.cmake + INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR} diff --git a/vcpkg/ports/hiredis/fix-ssize_t.patch b/vcpkg/ports/hiredis/fix-ssize_t.patch new file mode 100644 index 0000000..521313a --- /dev/null +++ b/vcpkg/ports/hiredis/fix-ssize_t.patch @@ -0,0 +1,11 @@ +diff --git a/hiredis.h b/hiredis.h
+--- a/hiredis.h
++++ b/hiredis.h
+@@ -40,6 +40,7 @@
+ #else
+ struct timeval; /* forward declaration */
+ typedef long long ssize_t;
++#define _SSIZE_T_ /* for compatibility with libuv */
+ #endif
+ #include <stdint.h> /* uintXX_t, etc */
+ #include "sds.h" /* for sds */
diff --git a/vcpkg/ports/hiredis/fix-timeval.patch b/vcpkg/ports/hiredis/fix-timeval.patch new file mode 100644 index 0000000..f389de5 --- /dev/null +++ b/vcpkg/ports/hiredis/fix-timeval.patch @@ -0,0 +1,16 @@ +diff --git a/async_private.h b/async_private.h +index d0133ae..7760b60 100644 +--- a/async_private.h ++++ b/async_private.h +@@ -32,6 +32,11 @@ + #ifndef __HIREDIS_ASYNC_PRIVATE_H + #define __HIREDIS_ASYNC_PRIVATE_H + ++#ifdef _WIN32 ++#include <time.h> ++#include <windows.h> ++#endif ++ + #define _EL_ADD_READ(ctx) \ + do { \ + refreshTimeout(ctx); \ diff --git a/vcpkg/ports/hiredis/portfile.cmake b/vcpkg/ports/hiredis/portfile.cmake new file mode 100644 index 0000000..8f321c8 --- /dev/null +++ b/vcpkg/ports/hiredis/portfile.cmake @@ -0,0 +1,52 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO redis/hiredis + REF "v${VERSION}" + SHA512 e6e9f7e617bf1d03bdf64a80e74ed24816b6c71607b976757a9962ae02a3b65be7006d84fd353dd5a63c8d0ef1ed385c3b73851b4a119c5ed48f3f86437cf250 + HEAD_REF master + PATCHES + fix-timeval.patch + fix-ssize_t.patch + support-static.patch + fix-cmake-conf-install-dir.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + ssl ENABLE_SSL +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + -DDISABLE_TESTS=ON + -DBUILD_SHARED_LIBS=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +vcpkg_fixup_pkgconfig() + +vcpkg_cmake_config_fixup() +if("ssl" IN_LIST FEATURES) + vcpkg_cmake_config_fixup(PACKAGE_NAME hiredis_ssl CONFIG_PATH share/hiredis_ssl) +endif() + +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/hiredis/hiredis.h" +[[typedef long long ssize_t; +#define _SSIZE_T_ /* for compatibility with libuv */]] +[[typedef intptr_t ssize_t;]] +) +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/hiredis/sds.h" +[[typedef long long ssize_t; +#define SSIZE_MAX (LLONG_MAX >> 1)]] +[[typedef intptr_t ssize_t; +#define SSIZE_MAX INTPTR_MAX]] +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/hiredis/support-static.patch b/vcpkg/ports/hiredis/support-static.patch new file mode 100644 index 0000000..e9f0bb2 --- /dev/null +++ b/vcpkg/ports/hiredis/support-static.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b7d6ee8..8cf6c4d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,6 +45,8 @@ ENDIF() + + ADD_LIBRARY(hiredis ${hiredis_sources}) + ADD_LIBRARY(hiredis::hiredis ALIAS hiredis) ++ADD_LIBRARY(hiredis_static STATIC ${hiredis_sources}) ++SET_TARGET_PROPERTIES(hiredis_static PROPERTIES EXCLUDE_FROM_ALL TRUE) + set(hiredis_export_name hiredis CACHE STRING "Name of the exported target") + set_target_properties(hiredis PROPERTIES EXPORT_NAME ${hiredis_export_name}) + +@@ -156,6 +158,8 @@ IF(ENABLE_SSL) + ssl.c) + ADD_LIBRARY(hiredis_ssl ${hiredis_ssl_sources}) + ADD_LIBRARY(hiredis::hiredis_ssl ALIAS hiredis_ssl) ++ ADD_LIBRARY(hiredis_ssl_static STATIC ${hiredis_ssl_sources}) ++ SET_TARGET_PROPERTIES(hiredis_ssl_static PROPERTIES EXCLUDE_FROM_ALL TRUE) + + IF (APPLE AND BUILD_SHARED_LIBS) + SET_PROPERTY(TARGET hiredis_ssl PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup") diff --git a/vcpkg/ports/hiredis/vcpkg.json b/vcpkg/ports/hiredis/vcpkg.json new file mode 100644 index 0000000..c9c4789 --- /dev/null +++ b/vcpkg/ports/hiredis/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "hiredis", + "version": "1.3.0", + "description": "Hiredis is a minimalistic C client library for the Redis database.", + "homepage": "https://github.com/redis/hiredis", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "ssl": { + "description": "Build hiredis_ssl for SSL support", + "dependencies": [ + "openssl" + ] + } + } +} |