1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
# Redis does NOT build with Lua 5.2 or newer at this time:
|
7 |
|
# - 5.3 and 5.4 give:
|
8 |
|
# lua_bit.c:83:2: error: #error "Unknown number type, check LUA_NUMBER_* in luaconf.h"
|
9 |
|
# - 5.2 fails with:
|
10 |
|
# scripting.c:(.text+0x1f9b): undefined reference to `lua_open'
|
11 |
|
# because lua_open became lua_newstate in 5.2
|
12 |
|
LUA_COMPAT=( lua5-1 luajit )
|
13 |
|
|
14 |
|
# Upstream have deviated too far from vanilla Lua, adding their own APIs
|
15 |
|
# like lua_enablereadonlytable, but we still need the eclass and such
|
16 |
|
# for bug #841422.
|
17 |
|
inherit autotools edo flag-o-matic lua-single multiprocessing systemd tmpfiles toolchain-funcs
|
|
6 |
# N.B.: It is no clue in porting to Lua eclasses, as upstream have deviated
|
|
7 |
# too far from vanilla Lua, adding their own APIs like lua_enablereadonlytable
|
|
8 |
|
|
9 |
inherit autotools edo flag-o-matic multiprocessing systemd tmpfiles toolchain-funcs
|
18 |
10 |
|
19 |
11 |
DESCRIPTION="A persistent caching system, key-value, and data structures database"
|
20 |
12 |
HOMEPAGE="https://redis.io"
|
... | ... | |
22 |
14 |
|
23 |
15 |
LICENSE="BSD"
|
24 |
16 |
SLOT="0"
|
25 |
|
KEYWORDS="amd64 ~arm arm64 ~hppa ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
|
|
17 |
KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
|
26 |
18 |
IUSE="+jemalloc selinux ssl systemd tcmalloc test"
|
27 |
19 |
RESTRICT="!test? ( test )"
|
28 |
20 |
|
29 |
21 |
COMMON_DEPEND="
|
30 |
|
${LUA_DEPS}
|
31 |
22 |
jemalloc? ( >=dev-libs/jemalloc-5.1:= )
|
32 |
23 |
ssl? ( dev-libs/openssl:0= )
|
33 |
24 |
systemd? ( sys-apps/systemd:= )
|
... | ... | |
54 |
45 |
ssl? ( dev-tcltk/tls )
|
55 |
46 |
)"
|
56 |
47 |
|
57 |
|
REQUIRED_USE="?? ( jemalloc tcmalloc )
|
58 |
|
${LUA_REQUIRED_USE}"
|
|
48 |
REQUIRED_USE="?? ( jemalloc tcmalloc )"
|
59 |
49 |
|
60 |
50 |
PATCHES=(
|
61 |
51 |
"${FILESDIR}"/${PN}-6.2.1-config.patch
|
62 |
52 |
"${FILESDIR}"/${PN}-5.0-shared.patch
|
63 |
53 |
"${FILESDIR}"/${PN}-6.2.3-ppc-atomic.patch
|
64 |
54 |
"${FILESDIR}"/${PN}-sentinel-5.0-config.patch
|
|
55 |
"${FILESDIR}"/${PN}-7.0.4-no-which.patch
|
|
56 |
"${FILESDIR}"/${PN}-7.0.4-replica-tests-fix.patch
|
|
57 |
|
|
58 |
# see bug 877863
|
|
59 |
"${FILESDIR}/${PN}-7.0.5-cve-2022-3647.patch"
|
65 |
60 |
)
|
66 |
61 |
|
67 |
62 |
src_prepare() {
|
68 |
63 |
default
|
69 |
64 |
|
70 |
|
# Copy lua modules into build dir
|
71 |
|
#cp "${S}"/deps/lua/src/{fpconv,lua_bit,lua_cjson,lua_cmsgpack,lua_struct,strbuf}.c "${S}"/src || die
|
72 |
|
#cp "${S}"/deps/lua/src/{fpconv,strbuf}.h "${S}"/src || die
|
73 |
65 |
# Append cflag for lua_cjson
|
74 |
66 |
# https://github.com/antirez/redis/commit/4fdcd213#diff-3ba529ae517f6b57803af0502f52a40bL61
|
75 |
67 |
append-cflags "-DENABLE_CJSON_GLOBAL"
|
... | ... | |
89 |
81 |
makefiles+=" ${MKF}"
|
90 |
82 |
done
|
91 |
83 |
# autodetection of compiler and settings; generates the modified Makefiles
|
92 |
|
cp "${FILESDIR}"/configure.ac-3.2 configure.ac || die
|
|
84 |
cp "${FILESDIR}"/configure.ac-7.0 configure.ac || die
|
93 |
85 |
|
94 |
|
# Use the correct pkgconfig name for Lua.
|
95 |
|
# The upstream configure script handles luajit specially, and is not
|
96 |
|
# affected by these changes.
|
97 |
86 |
sed -i \
|
98 |
|
-e "/^AC_INIT/s|, [0-9].+, |, $PV, |" \
|
|
87 |
-e "/^AC_INIT/s|, __PV__, |, $PV, |" \
|
99 |
88 |
-e "s:AC_CONFIG_FILES(\[Makefile\]):AC_CONFIG_FILES([${makefiles}]):g" \
|
100 |
|
-e "/PKG_CHECK_MODULES.*\<LUA\>/s,lua5.1,${ELUA},g" \
|
101 |
89 |
configure.ac || die "Sed failed for configure.ac"
|
102 |
90 |
eautoreconf
|
103 |
91 |
}
|
104 |
92 |
|
105 |
93 |
src_configure() {
|
106 |
|
econf #$(use_with lua_single_target_luajit luajit)
|
|
94 |
econf
|
107 |
95 |
|
108 |
96 |
# Linenoise can't be built with -std=c99, see https://bugs.gentoo.org/451164
|
109 |
97 |
# also, don't define ANSI/c99 for lua twice
|
... | ... | |
134 |
122 |
src_test() {
|
135 |
123 |
local runtestargs=(
|
136 |
124 |
--clients "$(makeopts_jobs)" # see bug #649868
|
|
125 |
|
|
126 |
--skiptest "Active defrag eval scripts" # see bug #851654
|
137 |
127 |
)
|
138 |
128 |
|
139 |
129 |
if has usersandbox ${FEATURES} || ! has userpriv ${FEATURES}; then
|
140 |
|
ewarn "unit/oom-score-adj test will be skipped." \
|
141 |
|
"It is known to fail with FEATURES usersandbox or -userpriv. See bug #756382."
|
|
130 |
ewarn "oom-score-adj related tests will be skipped." \
|
|
131 |
"They are known to fail with FEATURES usersandbox or -userpriv. See bug #756382."
|
142 |
132 |
|
143 |
|
# unit/oom-score-adj was introduced in version 6.2.0
|
144 |
|
runtestargs+=( --skipunit unit/oom-score-adj ) # see bug #756382
|
|
133 |
runtestargs+=(
|
|
134 |
# unit/oom-score-adj was introduced in version 6.2.0
|
|
135 |
--skipunit unit/oom-score-adj # see bug #756382
|
|
136 |
|
|
137 |
# Following test was added in version 7.0.0 to unit/introspection.
|
|
138 |
# It also tries to adjust OOM score.
|
|
139 |
--skiptest "CONFIG SET rollback on apply error"
|
|
140 |
)
|
145 |
141 |
fi
|
146 |
142 |
|
147 |
143 |
if use ssl; then
|
... | ... | |
171 |
167 |
insinto /etc/logrotate.d/
|
172 |
168 |
newins "${FILESDIR}/${PN}.logrotate" ${PN}
|
173 |
169 |
|
174 |
|
dodoc 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO README.md
|
|
170 |
dodoc 00-RELEASENOTES BUGS CONTRIBUTING.md MANIFESTO README.md
|
175 |
171 |
|
176 |
172 |
dobin src/redis-cli
|
177 |
173 |
dosbin src/redis-benchmark src/redis-server src/redis-check-aof src/redis-check-rdb
|