diff options
Diffstat (limited to 'databases/keydb/files')
-rw-r--r-- | databases/keydb/files/keydb.in | 67 | ||||
-rw-r--r-- | databases/keydb/files/keydb_sentinel.in | 39 | ||||
-rw-r--r-- | databases/keydb/files/patch-deps-hiredis-Makefile | 40 | ||||
-rw-r--r-- | databases/keydb/files/patch-deps-hiredis-net.c | 39 | ||||
-rw-r--r-- | databases/keydb/files/patch-deps-linenoise-Makefile | 15 | ||||
-rw-r--r-- | databases/keydb/files/patch-deps_Makefile | 10 | ||||
-rw-r--r-- | databases/keydb/files/patch-deps_lua_src_lua__cjson.c | 12 | ||||
-rw-r--r-- | databases/keydb/files/patch-keydb.conf | 38 | ||||
-rw-r--r-- | databases/keydb/files/patch-src-Makefile | 52 | ||||
-rw-r--r-- | databases/keydb/files/patch-src-mkreleasehdr.sh | 11 | ||||
-rw-r--r-- | databases/keydb/files/pkg-message.in | 11 |
11 files changed, 334 insertions, 0 deletions
diff --git a/databases/keydb/files/keydb.in b/databases/keydb/files/keydb.in new file mode 100644 index 000000000000..3179aa20ce1f --- /dev/null +++ b/databases/keydb/files/keydb.in @@ -0,0 +1,67 @@ +#!/bin/sh + +# PROVIDE: keydb +# REQUIRE: LOGIN +# BEFORE: securelevel +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable `keydb': +# +#keydb_enable="YES" +# +# Define profiles here to run separate keydb instances: +# +#keydb_profiles="foo bar" # Script uses %%PREFIX%%/etc/keydb-NAME.conf respectively. +# For correct script working please update pidfile entries in +# keydb-NAME.conf files. + +. /etc/rc.subr + +name="keydb" +rcvar="${name}_enable" + +extra_commands="reload" + +command="%%PREFIX%%/bin/keydb-server" +pidfile="%%KEYDB_RUNDIR%%/$name.pid" + +# read configuration and set defaults +load_rc_config "$name" +: ${keydb_enable="NO"} +: ${keydb_user="%%KEYDB_USER%%"} +: ${keydb_config="%%PREFIX%%/etc/$name.conf"} + +command_args="${keydb_config}" +required_files="${keydb_config}" + +_profile_exists() { + for _p in ${keydb_profiles}; do + [ "${_p}" = "$1" ] && return 1; + done + return 0 +} + +if [ $# -eq 2 ]; then + _profile=$2 + _profile_exists $_profile + _exists=$? + [ ${_exists} -ne 1 ] && { + echo "`basename %%PREFIX%%/etc/rc.d/keydb`: no '$2' in 'keydb_profiles'" + exit 1 + }; + echo "-- Profile: ${_profile} --" + config_file="%%PREFIX%%/etc/${name}-${_profile}.conf" + command_args="${config_file}" + pidfile="%%KEYDB_RUNDIR%%/${_profile}.pid" + required_files="${config_file}" +elif [ -n "${keydb_profiles}" ]; then + _swap=$*; shift; _profiles=$* + _profiles=${_profiles:-${keydb_profiles}} + set -- ${_swap} + for _profile in ${_profiles}; do + %%PREFIX%%/etc/rc.d/keydb $1 ${_profile} + done + exit 0 +fi + +run_rc_command "$1" diff --git a/databases/keydb/files/keydb_sentinel.in b/databases/keydb/files/keydb_sentinel.in new file mode 100644 index 000000000000..b2b88e779834 --- /dev/null +++ b/databases/keydb/files/keydb_sentinel.in @@ -0,0 +1,39 @@ +#!/bin/sh + +# PROVIDE: keydb_sentinel +# REQUIRE: LOGIN +# BEFORE: securelevel +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable `sentinel': +# +#keydb_sentinel_enable="YES" +# + +. /etc/rc.subr + +name="keydb_sentinel" +rcvar="${name}_enable" + +command="/usr/local/bin/keydb-sentinel" +pidfile="/var/run/keydb/$name.pid" + +# read configuration and set defaults +load_rc_config "$name" +: ${keydb_sentinel_enable="NO"} +: ${keydb_sentinel_user="keydb"} +: ${keydb_sentinel_config="/usr/local/etc/$name.conf"} + +command_args="${keydb_sentinel_config} --daemonize yes --pidfile ${pidfile}" +required_files="${keydb_sentinel_config}" +start_precmd="${name}_checks" +restart_precmd="${name}_checks" + +keydb_sentinel_checks() +{ + if [ x`id -u ${keydb_sentinel_user}` != x`stat -f %u ${keydb_sentinel_config}` ]; then + err 1 "${keydb_sentinel_config} must be owned by user ${keydb_sentinel_user}" + fi +} + +run_rc_command "$1" diff --git a/databases/keydb/files/patch-deps-hiredis-Makefile b/databases/keydb/files/patch-deps-hiredis-Makefile new file mode 100644 index 000000000000..78f5c6184fb4 --- /dev/null +++ b/databases/keydb/files/patch-deps-hiredis-Makefile @@ -0,0 +1,40 @@ +--- deps/hiredis/Makefile.orig 2023-10-25 15:54:51 UTC ++++ deps/hiredis/Makefile +@@ -21,7 +21,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 +@@ -44,10 +44,9 @@ 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 -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers + DEBUG_FLAGS?= -g -ggdb +-REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS) ++REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS) $(PLATFORM_FLAGS) + REAL_LDFLAGS=$(LDFLAGS) + + DYLIBSUFFIX=so +@@ -106,6 +105,16 @@ ifeq ($(uname_S),Darwin) + DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS) + SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS) + DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup ++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 + + all: $(DYLIBNAME) $(STLIBNAME) hiredis-test $(PKGCONFNAME) diff --git a/databases/keydb/files/patch-deps-hiredis-net.c b/databases/keydb/files/patch-deps-hiredis-net.c new file mode 100644 index 000000000000..0dfde3135238 --- /dev/null +++ b/databases/keydb/files/patch-deps-hiredis-net.c @@ -0,0 +1,39 @@ +--- deps/hiredis/net.c.orig 2019-11-28 19:32:05 UTC ++++ deps/hiredis/net.c +@@ -178,14 +178,34 @@ + __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/keydb/files/patch-deps-linenoise-Makefile b/databases/keydb/files/patch-deps-linenoise-Makefile new file mode 100644 index 000000000000..aef0f10966af --- /dev/null +++ b/databases/keydb/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/keydb/files/patch-deps_Makefile b/databases/keydb/files/patch-deps_Makefile new file mode 100644 index 000000000000..f5352bbfde00 --- /dev/null +++ b/databases/keydb/files/patch-deps_Makefile @@ -0,0 +1,10 @@ +--- deps/Makefile.orig 2023-10-25 17:16:24 UTC ++++ deps/Makefile +@@ -38,7 +38,6 @@ distclean: + -(cd linenoise && $(MAKE) clean) > /dev/null || true + -(cd lua && $(MAKE) clean) > /dev/null || true + -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true +- -(cd rocksdb && $(MAKE) clean) > /dev/null || true + -(cd hdr_histogram && $(MAKE) clean) > /dev/null || true + -(rm -f .make-*) + diff --git a/databases/keydb/files/patch-deps_lua_src_lua__cjson.c b/databases/keydb/files/patch-deps_lua_src_lua__cjson.c new file mode 100644 index 000000000000..0bb150504c67 --- /dev/null +++ b/databases/keydb/files/patch-deps_lua_src_lua__cjson.c @@ -0,0 +1,12 @@ +--- deps/lua/src/lua_cjson.c.orig 2019-09-25 10:40:18 UTC ++++ deps/lua/src/lua_cjson.c +@@ -46,7 +46,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/keydb/files/patch-keydb.conf b/databases/keydb/files/patch-keydb.conf new file mode 100644 index 000000000000..e28a0d9305df --- /dev/null +++ b/databases/keydb/files/patch-keydb.conf @@ -0,0 +1,38 @@ +--- keydb.conf.orig 2023-10-25 15:57:07 UTC ++++ keydb.conf +@@ -281,7 +281,7 @@ tcp-keepalive 300 + + # By default KeyDB does not run as a daemon. Use 'yes' if you need it. + # Note that KeyDB will write a pid file in /var/run/keydb.pid when daemonized. +-daemonize no ++daemonize yes + + # If you run KeyDB from upstart or systemd, KeyDB can interact with your + # supervision tree. Options: +@@ -304,7 +304,7 @@ supervised no + # + # Creating a pid file is best effort: if KeyDB is not able to create it + # nothing bad happens, the server will start and run normally. +-pidfile /var/run/keydb_6379.pid ++pidfile %%KEYDB_RUNDIR%%/keydb.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -317,7 +317,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # KeyDB 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 %%KEYDB_LOGDIR%%/keydb.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. +@@ -470,7 +470,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 %%KEYDB_DBDIR%%/ + + ################################# REPLICATION ################################# + diff --git a/databases/keydb/files/patch-src-Makefile b/databases/keydb/files/patch-src-Makefile new file mode 100644 index 000000000000..4703d6eb6daf --- /dev/null +++ b/databases/keydb/files/patch-src-Makefile @@ -0,0 +1,52 @@ +--- src/Makefile.orig 2023-10-25 15:47:51 UTC ++++ src/Makefile +@@ -138,21 +138,11 @@ endif + # Override default settings if possible + -include .make-settings + +-DEBUG=-g -ggdb + FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(KEYDB_CFLAGS) $(REDIS_CFLAGS) + FINAL_CXXFLAGS=$(CXX_STD) $(WARN) $(OPT) $(DEBUG) $(CXXFLAGS) $(KEYDB_CFLAGS) $(REDIS_CFLAGS) + FINAL_LDFLAGS=$(LDFLAGS) $(KEYDB_LDFLAGS) $(DEBUG) + FINAL_LIBS+=-lm -lz -lcrypto -lbz2 -lzstd -llz4 -lsnappy + +-ifneq ($(uname_S),Darwin) +- FINAL_LIBS+=-latomic +-endif +-# Linux ARM32 needs -latomic at linking time +-ifneq (,$(findstring armv,$(uname_M))) +- FINAL_LIBS+=-latomic +-endif +- +- + ifeq ($(uname_S),SunOS) + # SunOS + ifeq ($(findstring -m32,$(FINAL_CFLAGS)),) +@@ -211,7 +201,9 @@ ifeq ($(uname_S),NetBSD) + else + ifeq ($(uname_S),FreeBSD) + # FreeBSD +- FINAL_LIBS+= -lpthread -lexecinfo ++ FINAL_LIBS+= -lpthread -lexecinfo -luuid ++ FINAL_CFLAGS?= $(CFLAGS) $(REDIS_CFLAGS) -I${PREFIX}/include ++ FINAL_LDFLAGS= $(LDFLAGS) -pthread + else + ifeq ($(uname_S),DragonFly) + # DragonFly +@@ -347,7 +339,7 @@ else + endif + + # Alpine OS doesn't have support for the execinfo backtrace library we use for debug, so we provide an alternate implementation using libwunwind. +-OS := $(shell cat /etc/os-release | grep ID= | head -n 1 | cut -d'=' -f2) ++OS := $(shell uname -r) + ifeq ($(OS),alpine) + FINAL_CXXFLAGS+=-DUNW_LOCAL_ONLY -DALPINE + FINAL_LIBS += -lunwind +@@ -417,7 +409,6 @@ persist-settings: distclean + echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings + echo PREV_FINAL_CXXFLAGS=$(FINAL_CXXFLAGS) >> .make-settings + echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings +- -(cd modules && $(MAKE)) + -(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS)) + + .PHONY: persist-settings diff --git a/databases/keydb/files/patch-src-mkreleasehdr.sh b/databases/keydb/files/patch-src-mkreleasehdr.sh new file mode 100644 index 000000000000..e48b3174d315 --- /dev/null +++ b/databases/keydb/files/patch-src-mkreleasehdr.sh @@ -0,0 +1,11 @@ +--- src/mkreleasehdr.sh.orig 2019-11-22 16:54:22 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 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/keydb/files/pkg-message.in b/databases/keydb/files/pkg-message.in new file mode 100644 index 000000000000..8014e03653d3 --- /dev/null +++ b/databases/keydb/files/pkg-message.in @@ -0,0 +1,11 @@ +[ +{ type: install + message: <<EOM + To setup "%%PORTNAME%%" you need to edit the configuration file: + %%PREFIX%%/etc/%%PORTNAME%%.conf + + To run keydb from startup, add %%PORTNAME%%_enable="YES" + in your /etc/rc.conf. +EOM +} +] |