Skip to content

Commit

Permalink
databases/redis*: Refine ports
Browse files Browse the repository at this point in the history
* Alway build with base system compiler. In 2018 Makefile was changed
  so GCC is used with i386. It seems to be workaround of build error,
  But now build succeeds without GCC on i386 and all supported FreeBSD
  versions.
* Remove options for external lua library and related patches. On
  April 2022 upstream made incompatible change of bundled lua library
  to fix vulnerability. As a result build got failed when external lua
  library is enabled. Upstream said in commit message of their
  repository that they took codes from lua repository. So I kept the
  options with marking as broken hoping breakage will be solved in the
  future. But it is still broken after two years and doesn't seem to
  change.
* Remove TRIB option. When it is enabled ruby script named
  redis-trib.rb is installed. But it just prints warning message that
  it is no longer available and redis-cli should be used instead, and
  exit. So it isn't usefull anymore.
* Fix post-patch-JEMALLOC-on target so proper line is replaced.
* Pet portclippy.
  • Loading branch information
Yasuhiro Kimura authored and Yasuhiro Kimura committed Apr 3, 2024
1 parent 59889ee commit 81b6dcb
Show file tree
Hide file tree
Showing 27 changed files with 52 additions and 1,019 deletions.
93 changes: 22 additions & 71 deletions databases/redis-devel/Makefile
@@ -1,5 +1,6 @@
PORTNAME= redis
DISTVERSION= 7.2.4.20240229
PORTREVISION= 1
CATEGORIES= databases
PKGNAMESUFFIX= -devel

Expand All @@ -14,99 +15,52 @@ USES+= compiler:c11 cpe gmake tcl:test
CPE_VENDOR= redislabs
USE_GITHUB= yes
GH_TAGNAME= f17381a38
USE_RC_SUBR= redis sentinel

MAKE_ENV= OPTIMIZATION= \
V=yo

LDFLAGS+= -lpthread -lm -lexecinfo

CONFLICTS_INSTALL= redis redis6 redis62 redis70 # etc/rc.d/redis

PORTSCOUT= ignore:1
SUB_FILES= pkg-message
SUB_LIST+= PORTNAME=${PORTNAME} \
REDIS_DBDIR=${REDIS_DBDIR} \
REDIS_LOGDIR=${REDIS_LOGDIR} \
REDIS_RUNDIR=${REDIS_RUNDIR} \
REDIS_USER=${USERS}

USERS= redis
GROUPS= redis

PLIST_SUB+= REDIS_DBDIR=${REDIS_DBDIR} \
REDIS_GROUP=${GROUPS} \
REDIS_LOGDIR=${REDIS_LOGDIR} \
REDIS_RUNDIR=${REDIS_RUNDIR} \
REDIS_USER=${USERS}

OPTIONS_DEFINE= JEMALLOC TLS TRIB
OPTIONS_DEFINE= JEMALLOC TLS
OPTIONS_DEFAULT= TLS
OPTIONS_RADIO= EXTLUA
OPTIONS_RADIO_EXTLUA= LUA LUAJIT
OPTIONS_SUB= yes

JEMALLOC_DESC= Use jemalloc
LUAJIT_DESC= Use luajit instead of builtin lua
LUA_DESC= Use lang/lua instead of builtin lua
TLS_DESC= Use TLS (openssl req.)
TRIB_DESC= Install redis-trib.rb (lang/ruby req.)

JEMALLOC_MAKE_ENV= USE_JEMALLOC=yes
LUAJIT_BROKEN= Fails to link
LUAJIT_USES= luajit
LUAJIT_VARS= _ADDFLAGS=true
LUA_BROKEN= Fails to link
LUA_USES= lua:51
LUA_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-src-Makefile.lua
LUA_VARS= _ADDFLAGS=true
TLS_USES= ssl
TLS_MAKE_ENV= BUILD_TLS=yes
TRIB_CATEGORIES= ruby
TRIB_RUN_DEPENDS= rubygem-redis>=2.2:databases/rubygem-redis
TRIB_USES= ruby

.include <bsd.port.pre.mk>

.if ${ARCH} == i386 && !${CFLAGS:M-march=*}
# Needed for __atomic_fetch_add_8
USE_GCC= yes
CFLAGS+= -march=i586
.endif

.if defined(_ADDFLAGS)
CFLAGS+= -fPIC
LDFLAGS+= -Wl,-E
.endif

.if ${PORT_OPTIONS:MLUAJIT}
. if ${LUAJIT_VER} == luajit
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-src-Makefile.luajit
. else
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-src-Makefile.luajit-or \
${PATCHDIR}/extra-patch-src-function_lua.c \
${PATCHDIR}/extra-patch-deps_lua_src_lua__cjson.c
. endif
.endif

LDFLAGS+= -lpthread -lm -lexecinfo

USE_RC_SUBR= redis sentinel
BIN_FILES= redis-benchmark redis-check-aof redis-check-rdb redis-cli \
redis-sentinel redis-server

USERS= redis
GROUPS= redis

REDIS_DBDIR?= /var/db/redis
REDIS_RUNDIR?= /var/run/redis
REDIS_LOGDIR?= /var/log/redis

SUB_FILES= pkg-message
SUB_LIST+= PORTNAME=${PORTNAME} \
REDIS_DBDIR=${REDIS_DBDIR} \
REDIS_LOGDIR=${REDIS_LOGDIR} \
REDIS_RUNDIR=${REDIS_RUNDIR} \
REDIS_USER=${USERS}

PLIST_SUB+= REDIS_DBDIR=${REDIS_DBDIR} \
REDIS_GROUP=${GROUPS} \
REDIS_LOGDIR=${REDIS_LOGDIR} \
REDIS_RUNDIR=${REDIS_RUNDIR} \
REDIS_USER=${USERS}

post-patch:
${REINPLACE_CMD} '77s!malloc.h!stdlib.h!' ${WRKSRC}/src/zmalloc.h

post-patch-JEMALLOC-on:
@${REINPLACE_CMD} '35s!Linux!FreeBSD!g' ${WRKSRC}/src/Makefile

post-patch-LUA-on:
@cd ${WRKSRC}/deps/lua/src && ${CP} fpconv.* lua_* strbuf.* ${WRKSRC}/src/
post-patch-LUAJIT-on: post-patch-LUA-on
post-patch-LUAJITOR-on: post-patch-LUA-on
@${REINPLACE_CMD} '72s!Linux!FreeBSD!g' ${WRKSRC}/src/Makefile

post-build:
${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
Expand All @@ -120,10 +74,7 @@ do-install:
${STAGEDIR}${REDIS_DBDIR} \
${STAGEDIR}${REDIS_RUNDIR}

do-install-TRIB-on:
${INSTALL_SCRIPT} ${WRKSRC}/src/redis-trib.rb ${STAGEDIR}${PREFIX}/bin/

do-test:
@cd ${WRKSRC} && ${TCLSH} tests/test_helper.tcl

.include <bsd.port.post.mk>
.include <bsd.port.mk>
11 changes: 0 additions & 11 deletions databases/redis-devel/files/extra-patch-deps_lua_src_lua__cjson.c

This file was deleted.

58 changes: 0 additions & 58 deletions databases/redis-devel/files/extra-patch-src-Makefile.lua

This file was deleted.

58 changes: 0 additions & 58 deletions databases/redis-devel/files/extra-patch-src-Makefile.luajit

This file was deleted.

58 changes: 0 additions & 58 deletions databases/redis-devel/files/extra-patch-src-Makefile.luajit-or

This file was deleted.

13 changes: 0 additions & 13 deletions databases/redis-devel/files/extra-patch-src-function_lua.c

This file was deleted.

1 change: 0 additions & 1 deletion databases/redis-devel/pkg-plist
Expand Up @@ -4,7 +4,6 @@ bin/redis-check-rdb
bin/redis-cli
bin/redis-sentinel
bin/redis-server
%%TRIB%%bin/redis-trib.rb
@sample etc/redis.conf.sample
@sample(%%REDIS_USER%%,%%REDIS_GROUP%%,) etc/sentinel.conf.sample
@dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_DBDIR%%
Expand Down

0 comments on commit 81b6dcb

Please sign in to comment.