From 63b78a3d544e792a07a62fe910a7f396ad0134cf Mon Sep 17 00:00:00 2001 From: Lucas Holt Date: Thu, 23 Jan 2025 15:31:03 -0500 Subject: [PATCH] valkey 8.0.2 --- databases/Makefile | 1 + databases/valkey/Makefile | 69 +++++++++++++++++++ databases/valkey/distinfo | 3 + databases/valkey/files/patch-deps-Makefile | 21 ++++++ .../valkey/files/patch-deps-hiredis-Makefile | 41 +++++++++++ .../valkey/files/patch-deps-hiredis-net.c | 39 +++++++++++ .../files/patch-deps-linenoise-Makefile | 15 ++++ .../files/patch-deps_lua_src_lua__cjson.c | 12 ++++ databases/valkey/files/patch-sentinel.conf | 26 +++++++ databases/valkey/files/patch-src-Makefile | 54 +++++++++++++++ .../valkey/files/patch-src-mkreleasehdr.sh | 11 +++ databases/valkey/files/patch-valkey.conf | 38 ++++++++++ databases/valkey/files/pkg-message.in | 11 +++ databases/valkey/files/valkey.in | 67 ++++++++++++++++++ databases/valkey/files/valkeysentinel.in | 39 +++++++++++ databases/valkey/pkg-descr | 4 ++ databases/valkey/pkg-plist | 11 +++ 17 files changed, 462 insertions(+) create mode 100644 databases/valkey/Makefile create mode 100644 databases/valkey/distinfo create mode 100644 databases/valkey/files/patch-deps-Makefile create mode 100644 databases/valkey/files/patch-deps-hiredis-Makefile create mode 100644 databases/valkey/files/patch-deps-hiredis-net.c create mode 100644 databases/valkey/files/patch-deps-linenoise-Makefile create mode 100644 databases/valkey/files/patch-deps_lua_src_lua__cjson.c create mode 100644 databases/valkey/files/patch-sentinel.conf create mode 100644 databases/valkey/files/patch-src-Makefile create mode 100644 databases/valkey/files/patch-src-mkreleasehdr.sh create mode 100644 databases/valkey/files/patch-valkey.conf create mode 100644 databases/valkey/files/pkg-message.in create mode 100644 databases/valkey/files/valkey.in create mode 100644 databases/valkey/files/valkeysentinel.in create mode 100644 databases/valkey/pkg-descr create mode 100644 databases/valkey/pkg-plist diff --git a/databases/Makefile b/databases/Makefile index cb62d2af4d..63efe06a38 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -204,6 +204,7 @@ SUBDIR += tdb1 SUBDIR += tinycdb SUBDIR += tuning-primer SUBDIR += unixODBC +SUBDIR += valkey SUBDIR += virtualpg SUBDIR += vsqlite diff --git a/databases/valkey/Makefile b/databases/valkey/Makefile new file mode 100644 index 0000000000..c15e291427 --- /dev/null +++ b/databases/valkey/Makefile @@ -0,0 +1,69 @@ +PORTNAME= valkey +DISTVERSION= 8.0.2 +CATEGORIES= databases + +MAINTAINER= ports@MidnightBSD.org +COMMENT= High-performance data structure server that primarily serves key/value workloads +WWW= https://valkey.io/ + +LICENSE= bsd3 +LICENSE_FILE= ${WRKSRC}/COPYING + +USES= gmake pkgconfig tcl:test +USE_GITHUB= yes +GH_ACCOUNT= valkey-io +USE_RC_SUBR= valkey valkeysentinel + +MAKE_ENV= OPTIMIZATION= \ + V=1 + +LDFLAGS+= -lpthread -lm -lexecinfo + +SUB_FILES= pkg-message +SUB_LIST+= PORTNAME=${PORTNAME} \ + VALKEY_DBDIR=${VALKEY_DBDIR} \ + VALKEY_LOGDIR=${VALKEY_LOGDIR} \ + VALKEY_RUNDIR=${VALKEY_RUNDIR} \ + VALKEY_USER=${USERS} + +USERS= valkey +GROUPS= valkey + +PLIST_SUB+= VALKEY_DBDIR=${VALKEY_DBDIR} \ + VALKEY_GROUP=${GROUPS} \ + VALKEY_LOGDIR=${VALKEY_LOGDIR} \ + VALKEY_RUNDIR=${VALKEY_RUNDIR} \ + VALKEY_USER=${USERS} + +OPTIONS_DEFINE= JEMALLOC TLS +OPTIONS_DEFAULT= +OPTIONS_SUB= yes + +JEMALLOC_DESC= Use jemalloc +TLS_DESC= Use TLS + +JEMALLOC_MAKE_ENV= MALLOC=jemalloc +TLS_USES= ssl +TLS_MAKE_ENV= BUILD_TLS=yes + +VALKEY_DBDIR?= /var/db/valkey +VALKEY_RUNDIR?= /var/run/valkey +VALKEY_LOGDIR?= /var/log/valkey + +post-build: + ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${WRKSRC}/valkey.conf > ${WRKDIR}/valkey.conf + ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${WRKSRC}/sentinel.conf > ${WRKDIR}/valkey-sentinel.conf + +post-install: + ${INSTALL_DATA} ${WRKDIR}/valkey.conf ${STAGEDIR}${PREFIX}/etc/valkey.conf.sample + ${INSTALL_DATA} ${WRKDIR}/valkey-sentinel.conf ${STAGEDIR}${PREFIX}/etc/valkey-sentinel.conf.sample + ${MKDIR} ${STAGEDIR}${VALKEY_LOGDIR} \ + ${STAGEDIR}${VALKEY_DBDIR} \ + ${STAGEDIR}${VALKEY_RUNDIR} + +do-test: + @cd ${WRKSRC} && ${TCLSH} tests/test_helper.tcl + +.include diff --git a/databases/valkey/distinfo b/databases/valkey/distinfo new file mode 100644 index 0000000000..5081c222db --- /dev/null +++ b/databases/valkey/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1736296442 +SHA256 (valkey-io-valkey-8.0.2_GH0.tar.gz) = e052c45b3cbe512e24fdfdc3fd337f9f5e4b8f8b8713f349ba867b829c8ff11a +SIZE (valkey-io-valkey-8.0.2_GH0.tar.gz) = 3629598 diff --git a/databases/valkey/files/patch-deps-Makefile b/databases/valkey/files/patch-deps-Makefile new file mode 100644 index 0000000000..003ae439c2 --- /dev/null +++ b/databases/valkey/files/patch-deps-Makefile @@ -0,0 +1,21 @@ +--- deps/Makefile.orig 2024-04-01 02:56:24 UTC ++++ deps/Makefile +@@ -84,7 +84,7 @@ else + ifeq ($(LUA_DEBUG),yes) + LUA_CFLAGS+= -O0 -g -DLUA_USE_APICHECK + else +- LUA_CFLAGS+= -O2 ++ LUA_CFLAGS+= + endif + ifeq ($(LUA_COVERAGE),yes) + LUA_CFLAGS += -fprofile-arcs -ftest-coverage +@@ -112,7 +112,7 @@ jemalloc: .make-prerequisites + + jemalloc: .make-prerequisites + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) +- cd jemalloc && ./configure --disable-cxx --with-version=5.3.0-0-g0 --with-lg-quantum=3 --disable-cache-oblivious --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" $(JEMALLOC_CONFIGURE_OPTS) +- cd jemalloc && $(MAKE) lib/libjemalloc.a ++ cd jemalloc && ./configure --disable-cxx --with-version=5.3.0-0-g0 --with-lg-quantum=3 --disable-cache-oblivious --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" CXXFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" $(JEMALLOC_CONFIGURE_OPTS) ++ cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" CXXFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a + + .PHONY: jemalloc diff --git a/databases/valkey/files/patch-deps-hiredis-Makefile b/databases/valkey/files/patch-deps-hiredis-Makefile new file mode 100644 index 0000000000..a278907667 --- /dev/null +++ b/databases/valkey/files/patch-deps-hiredis-Makefile @@ -0,0 +1,41 @@ +--- deps/hiredis/Makefile.orig 2023-07-30 05:48:29 UTC ++++ deps/hiredis/Makefile +@@ -15,7 +15,7 @@ HIREDIS_PATCH=$(shell grep HIREDIS_PATCH hiredis.h | a + HIREDIS_SONAME=$(shell grep HIREDIS_SONAME hiredis.h | awk '{print $$3}') + + # Installation related variables and target +-PREFIX?=/usr/local ++PREFIX?=${PREFIX} + INCLUDE_PATH?=include/hiredis + LIBRARY_PATH?=lib + PKGCONF_PATH?=pkgconfig +@@ -38,10 +38,8 @@ export REDIS_TEST_CONFIG + # Fallback to gcc when $CC is not in $PATH. + CC:=$(shell sh -c 'type $${CC%% *} >/dev/null 2>/dev/null && echo $(CC) || echo gcc') + CXX:=$(shell sh -c 'type $${CXX%% *} >/dev/null 2>/dev/null && echo $(CXX) || echo g++') +-OPTIMIZATION?=-O3 + WARNINGS=-Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers +-DEBUG_FLAGS?= -g -ggdb +-REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS) $(PLATFORM_FLAGS) ++REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS) $(PLATFORM_FLAGS) + REAL_LDFLAGS=$(LDFLAGS) + + DYLIBSUFFIX=so +@@ -122,7 +120,16 @@ ifeq ($(uname_S),FreeBSD) + else + REAL_CFLAGS+=-pedantic + endif +- ++ifeq ($(uname_S),FreeBSD) ++ CFLAGS?=$(CFLAGS) ++ CCLINK?=pthread ++ LDFLAGS?=-L. -Wl,-rpath,. ++ DYLIBNAME?=libhiredis.so ++ DYLIB_MAKE_CMD?=$(CC) -o ${DYLIBNAME} ${OBJ} ++ STLIBNAME?=libhiredis.a ++ STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ} ++ SSL_LDFLAGS+=${OPENSSL_LDFLAGS} ++endif + ifeq ($(uname_S),SunOS) + IS_SUN_CC=$(shell sh -c '$(CC) -V 2>&1 |egrep -i -c "sun|studio"') + ifeq ($(IS_SUN_CC),1) diff --git a/databases/valkey/files/patch-deps-hiredis-net.c b/databases/valkey/files/patch-deps-hiredis-net.c new file mode 100644 index 0000000000..434ebf0e81 --- /dev/null +++ b/databases/valkey/files/patch-deps-hiredis-net.c @@ -0,0 +1,39 @@ +--- deps/hiredis/net.c.orig 2024-04-01 02:56:24 UTC ++++ deps/hiredis/net.c +@@ -185,14 +185,34 @@ int redisKeepAlive(redisContext *c, int interval) { + __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); + return REDIS_ERR; + } +-#else +-#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) ++#elif defined(__GLIBC__) + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) { + __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); + return REDIS_ERR; + } + + val = interval/3; ++ if (val == 0) val = 1; ++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) { ++ __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); ++ return REDIS_ERR; ++ } ++ ++ val = 3; ++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val)) < 0) { ++ __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); ++ return REDIS_ERR; ++ } ++#else ++#if !defined(__sun) && defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTL) && \ ++ defined(TCP_KEEPCNT) ++ val = interval; ++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) { ++ __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); ++ return REDIS_ERR; ++ } ++ ++ val = internal/3; + if (val == 0) val = 1; + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) { + __redisSetError(c,REDIS_ERR_OTHER,strerror(errno)); diff --git a/databases/valkey/files/patch-deps-linenoise-Makefile b/databases/valkey/files/patch-deps-linenoise-Makefile new file mode 100644 index 0000000000..aef0f10966 --- /dev/null +++ b/databases/valkey/files/patch-deps-linenoise-Makefile @@ -0,0 +1,15 @@ +--- deps/linenoise/Makefile.orig 2019-09-25 10:40:18 UTC ++++ deps/linenoise/Makefile +@@ -1,10 +1,10 @@ + STD= + WARN= -Wall +-OPT= -Os ++#OPT= -Os + + R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) + R_LDFLAGS= $(LDFLAGS) +-DEBUG= -g ++#DEBUG= -g + + R_CC=$(CC) $(R_CFLAGS) + R_LD=$(CC) $(R_LDFLAGS) diff --git a/databases/valkey/files/patch-deps_lua_src_lua__cjson.c b/databases/valkey/files/patch-deps_lua_src_lua__cjson.c new file mode 100644 index 0000000000..55f700aee7 --- /dev/null +++ b/databases/valkey/files/patch-deps_lua_src_lua__cjson.c @@ -0,0 +1,12 @@ +--- deps/lua/src/lua_cjson.c.orig 2024-04-01 02:56:24 UTC ++++ deps/lua/src/lua_cjson.c +@@ -47,7 +47,9 @@ + #include "strbuf.h" + #include "fpconv.h" + ++#if defined(__sun) + #include "../../../src/solarisfixes.h" ++#endif + + #ifndef CJSON_MODNAME + #define CJSON_MODNAME "cjson" diff --git a/databases/valkey/files/patch-sentinel.conf b/databases/valkey/files/patch-sentinel.conf new file mode 100644 index 0000000000..8f26502b81 --- /dev/null +++ b/databases/valkey/files/patch-sentinel.conf @@ -0,0 +1,26 @@ +--- sentinel.conf.orig 2024-04-16 04:18:47 UTC ++++ sentinel.conf +@@ -12,12 +12,12 @@ port 26379 + # By default Valkey Sentinel does not run as a daemon. Use 'yes' if you need it. + # Note that Valkey will write a pid file in /var/run/valkey-sentinel.pid when + # daemonized. +-daemonize no ++daemonize yes + + # When running daemonized, Valkey Sentinel writes a pid file in + # /var/run/valkey-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/valkey-sentinel.pid ++pidfile %%VALKEY_RUNDIR%%/valkey-sentinel.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -31,7 +31,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # Sentinel to log on the standard output. Note that if you use standard + # output for logging but daemonize, logs will be sent to /dev/null +-logfile "" ++logfile %%VALKEY_LOGDIR%%/valkey-sentinel.log + + # To enable logging to the system logger, just set 'syslog-enabled' to yes, + # and optionally update the other syslog parameters to suit your needs. diff --git a/databases/valkey/files/patch-src-Makefile b/databases/valkey/files/patch-src-Makefile new file mode 100644 index 0000000000..483fe6891d --- /dev/null +++ b/databases/valkey/files/patch-src-Makefile @@ -0,0 +1,54 @@ +--- src/Makefile.orig 2024-08-01 15:59:43 UTC ++++ src/Makefile +@@ -61,8 +61,8 @@ endif + STD+=-std=c99 + endif + +-PREFIX?=/usr/local +-INSTALL_BIN=$(PREFIX)/bin ++PREFIX:=$(PREFIX) ++INSTALL_BIN=$(DESTDIR)$(PREFIX)/bin + INSTALL=install + PKG_CONFIG?=pkg-config + +@@ -145,7 +145,6 @@ FINAL_LIBS=-lm + endif + FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG) + FINAL_LIBS=-lm +-DEBUG=-g -ggdb + + # Linux ARM32 needs -latomic at linking time + ifneq (,$(findstring armv,$(uname_M))) +@@ -189,6 +188,11 @@ else + OPENSSL_PREFIX?=/usr/local/opt/openssl + endif + else ++ifeq ($(uname_S),FreeBSD) ++ # FreeBSD ++ FINAL_CFLAGS?= $(CFLAGS) $(REDIS_CFLAGS) -I${PREFIX}/include ++ FINAL_LDFLAGS= $(LDFLAGS) -pthread ++else + ifeq ($(uname_S),AIX) + # AIX + FINAL_LDFLAGS+= -Wl,-bexpall +@@ -248,6 +252,7 @@ endif + endif + endif + endif ++endif + + ifdef OPENSSL_PREFIX + OPENSSL_CFLAGS=-I$(OPENSSL_PREFIX)/include +@@ -624,12 +629,6 @@ install: all + @ln -sf $(SERVER_NAME) $(INSTALL_BIN)/$(ENGINE_CHECK_RDB_NAME) + @ln -sf $(SERVER_NAME) $(INSTALL_BIN)/$(ENGINE_CHECK_AOF_NAME) + @ln -sf $(SERVER_NAME) $(INSTALL_BIN)/$(ENGINE_SENTINEL_NAME) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(SERVER_NAME),$(INSTALL_BIN)) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(ENGINE_CLI_NAME),$(INSTALL_BIN)) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(ENGINE_BENCHMARK_NAME),$(INSTALL_BIN)) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(ENGINE_CHECK_RDB_NAME),$(INSTALL_BIN)) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(ENGINE_CHECK_AOF_NAME),$(INSTALL_BIN)) +- $(call MAYBE_INSTALL_REDIS_SYMLINK,$(ENGINE_SENTINEL_NAME),$(INSTALL_BIN)) + + uninstall: + @rm -f $(INSTALL_BIN)/{$(SERVER_NAME),$(ENGINE_BENCHMARK_NAME),$(ENGINE_CLI_NAME),$(ENGINE_CHECK_RDB_NAME),$(ENGINE_CHECK_AOF_NAME),$(ENGINE_SENTINEL_NAME)} diff --git a/databases/valkey/files/patch-src-mkreleasehdr.sh b/databases/valkey/files/patch-src-mkreleasehdr.sh new file mode 100644 index 0000000000..b4dd26bd81 --- /dev/null +++ b/databases/valkey/files/patch-src-mkreleasehdr.sh @@ -0,0 +1,11 @@ +--- src/mkreleasehdr.sh.orig 2024-08-01 15:59:43 UTC ++++ src/mkreleasehdr.sh +@@ -1,6 +1,6 @@ + #!/bin/sh +-GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1` +-GIT_DIRTY=`git diff --no-ext-diff -- ../src ../deps 2> /dev/null | wc -l` ++GIT_SHA1="00000000" ++GIT_DIRTY="0" + BUILD_ID=`uname -n`"-"`date +%s` + if [ -n "$SOURCE_DATE_EPOCH" ]; then + BUILD_ID=$(date -u -d "@$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u +%s) diff --git a/databases/valkey/files/patch-valkey.conf b/databases/valkey/files/patch-valkey.conf new file mode 100644 index 0000000000..87d03a4935 --- /dev/null +++ b/databases/valkey/files/patch-valkey.conf @@ -0,0 +1,38 @@ +--- valkey.conf.orig 2024-04-16 04:18:47 UTC ++++ valkey.conf +@@ -303,7 +303,7 @@ tcp-keepalive 300 + # By default the server does not run as a daemon. Use 'yes' if you need it. + # Note that the server will write a pid file in /var/run/valkey.pid when daemonized. + # When the server is supervised by upstart or systemd, this parameter has no impact. +-daemonize no ++daemonize yes + + # If you run the server from upstart or systemd, the server can interact with your + # supervision tree. Options: +@@ -335,7 +335,7 @@ daemonize no + # + # Note that on modern Linux systems "/run/valkey.pid" is more conforming + # and should be used instead. +-pidfile /var/run/valkey_6379.pid ++pidfile %%VALKEY_RUNDIR%%/valkey.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -349,7 +349,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # the server to log on the standard output. Note that if you use standard + # output for logging but daemonize, logs will be sent to /dev/null +-logfile "" ++logfile %%VALKEY_LOGDIR%%/valkey.log + + # To enable logging to the system logger, just set 'syslog-enabled' to yes, + # and optionally update the other syslog parameters to suit your needs. +@@ -504,7 +504,7 @@ rdb-del-sync-files no + # The Append Only File will also be created inside this directory. + # + # Note that you must specify a directory here, not a file name. +-dir ./ ++dir %%VALKEY_DBDIR%%/ + + ################################# REPLICATION ################################# + diff --git a/databases/valkey/files/pkg-message.in b/databases/valkey/files/pkg-message.in new file mode 100644 index 0000000000..e32864db05 --- /dev/null +++ b/databases/valkey/files/pkg-message.in @@ -0,0 +1,11 @@ +[ +{ type: install + message: <