Skip to content

Commit

Permalink
valkey 8.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Jan 23, 2025
1 parent 54707da commit 63b78a3
Show file tree
Hide file tree
Showing 17 changed files with 462 additions and 0 deletions.
1 change: 1 addition & 0 deletions databases/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ SUBDIR += tdb1
SUBDIR += tinycdb
SUBDIR += tuning-primer
SUBDIR += unixODBC
SUBDIR += valkey
SUBDIR += virtualpg
SUBDIR += vsqlite

Expand Down
69 changes: 69 additions & 0 deletions databases/valkey/Makefile
Original file line number Diff line number Diff line change
@@ -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 <bsd.port.mk>
3 changes: 3 additions & 0 deletions databases/valkey/distinfo
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions databases/valkey/files/patch-deps-Makefile
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions databases/valkey/files/patch-deps-hiredis-Makefile
Original file line number Diff line number Diff line change
@@ -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)
39 changes: 39 additions & 0 deletions databases/valkey/files/patch-deps-hiredis-net.c
Original file line number Diff line number Diff line change
@@ -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));
15 changes: 15 additions & 0 deletions databases/valkey/files/patch-deps-linenoise-Makefile
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions databases/valkey/files/patch-deps_lua_src_lua__cjson.c
Original file line number Diff line number Diff line change
@@ -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"
26 changes: 26 additions & 0 deletions databases/valkey/files/patch-sentinel.conf
Original file line number Diff line number Diff line change
@@ -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.
54 changes: 54 additions & 0 deletions databases/valkey/files/patch-src-Makefile
Original file line number Diff line number Diff line change
@@ -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)}
11 changes: 11 additions & 0 deletions databases/valkey/files/patch-src-mkreleasehdr.sh
Original file line number Diff line number Diff line change
@@ -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)
38 changes: 38 additions & 0 deletions databases/valkey/files/patch-valkey.conf
Original file line number Diff line number Diff line change
@@ -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 #################################

11 changes: 11 additions & 0 deletions databases/valkey/files/pkg-message.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{ type: install
message: <<EOM
To setup "%%PORTNAME%%" you need to edit the configuration file:
%%PREFIX%%/etc/%%PORTNAME%%.conf

To run valkey from startup, add %%PORTNAME%%_enable="YES"
in your /etc/rc.conf.
EOM
}
]
Loading

0 comments on commit 63b78a3

Please sign in to comment.