Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/redis/, dev-db/redis/files/
Date: Wed, 01 Jun 2022 02:08:28
Message-Id: 1654049258.c401269e5d01422852304a01133cdcde9c9706fc.sam@gentoo
1 commit: c401269e5d01422852304a01133cdcde9c9706fc
2 Author: Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 3 22:27:09 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 1 02:07:38 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c401269e
7
8 dev-db/redis: get rid of external Lua
9
10 Bug: https://bugs.gentoo.org/842444
11 Package-Manager: Portage-3.0.30, Repoman-3.0.1
12 Signed-off-by: Vadim Misbakh-Soloviov <mva <AT> gentoo.org>
13 Closes: https://github.com/gentoo/gentoo/pull/25310
14 Signed-off-by: Sam James <sam <AT> gentoo.org>
15
16 dev-db/redis/files/configure.ac-7.0 | 58 ++++++++++++
17 dev-db/redis/redis-7.0.0-r1.ebuild | 173 ++++++++++++++++++++++++++++++++++++
18 2 files changed, 231 insertions(+)
19
20 diff --git a/dev-db/redis/files/configure.ac-7.0 b/dev-db/redis/files/configure.ac-7.0
21 new file mode 100644
22 index 000000000000..45397b33b7ec
23 --- /dev/null
24 +++ b/dev-db/redis/files/configure.ac-7.0
25 @@ -0,0 +1,58 @@
26 +# -*- Autoconf -*-
27 +# Process this file with autoconf to produce a configure script.
28 +
29 +AC_PREREQ(2.63)
30 +AC_INIT(redis, __PV__, antirez@×××××.com)
31 +AM_CFLAGS="-std=c99 -pedantic -Wall -W -D__EXTENSIONS__ -D_XPG6"
32 +if test x"$CFLAGS" = x""; then
33 + AM_CFLAGS="$AM_CFLAGS -O2"
34 +else
35 + AM_CFLAGS="$AM_CFLAGS $CFLAGS"
36 +fi
37 +
38 +# options
39 +AC_MSG_CHECKING([whether to build with debug information])
40 +AC_ARG_ENABLE([debug],
41 + [AS_HELP_STRING([--enable-debug],
42 + [enable debug data generation (def=no)])],
43 + [debugit="$enableval"],
44 + [debugit=no])
45 +AC_MSG_RESULT([$debugit])
46 +
47 +if test x"$debugit" = x"yes"; then
48 + AC_DEFINE([DEBUG],[],[Debug Mode])
49 + AM_CFLAGS="$AM_CFLAGS -g -rdynamic -ggdb"
50 +else
51 + AC_DEFINE([NDEBUG],[],[No-debug Mode])
52 +fi
53 +AC_SUBST([AM_CFLAGS])
54 +
55 +# Checks for programs.
56 +AC_PROG_CC
57 +
58 +# Checks for libraries.
59 +
60 +# Checks for header files.
61 +AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
62 +
63 +# Checks for typedefs, structures, and compiler characteristics.
64 +AC_HEADER_STDBOOL
65 +AC_C_INLINE
66 +AC_TYPE_INT16_T
67 +AC_TYPE_INT32_T
68 +AC_TYPE_OFF_T
69 +AC_TYPE_PID_T
70 +AC_TYPE_SIZE_T
71 +AC_TYPE_SSIZE_T
72 +AC_TYPE_UINT16_T
73 +AC_TYPE_UINT32_T
74 +
75 +# Checks for library functions.
76 +AC_FUNC_ERROR_AT_LINE
77 +AC_FUNC_FORK
78 +AC_FUNC_STRCOLL
79 +AC_FUNC_STRTOD
80 +AC_CHECK_FUNCS([dup2 gethostbyname gettimeofday inet_ntoa memchr memmove memset select socket strcasecmp strchr strerror strstr strtol])
81 +
82 +AC_CONFIG_FILES([Makefile])
83 +AC_OUTPUT
84
85 diff --git a/dev-db/redis/redis-7.0.0-r1.ebuild b/dev-db/redis/redis-7.0.0-r1.ebuild
86 new file mode 100644
87 index 000000000000..1b969c9cf4c8
88 --- /dev/null
89 +++ b/dev-db/redis/redis-7.0.0-r1.ebuild
90 @@ -0,0 +1,173 @@
91 +# Copyright 1999-2022 Gentoo Authors
92 +# Distributed under the terms of the GNU General Public License v2
93 +
94 +EAPI=8
95 +
96 +# N.B.: It is no clue in porting to Lua eclasses, as upstream have deviated
97 +# too far from vanilla Lua, adding their own APIs like lua_enablereadonlytable
98 +
99 +inherit autotools flag-o-matic systemd toolchain-funcs tmpfiles
100 +
101 +DESCRIPTION="A persistent caching system, key-value, and data structures database"
102 +HOMEPAGE="https://redis.io"
103 +SRC_URI="https://download.redis.io/releases/${P}.tar.gz"
104 +
105 +LICENSE="BSD"
106 +SLOT="0"
107 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-solaris"
108 +IUSE="+jemalloc ssl systemd tcmalloc test"
109 +RESTRICT="!test? ( test )"
110 +
111 +COMMON_DEPEND="
112 + jemalloc? ( >=dev-libs/jemalloc-5.1:= )
113 + ssl? ( dev-libs/openssl:0= )
114 + systemd? ( sys-apps/systemd:= )
115 + tcmalloc? ( dev-util/google-perftools )
116 +"
117 +
118 +RDEPEND="
119 + ${COMMON_DEPEND}
120 + acct-group/redis
121 + acct-user/redis
122 +"
123 +
124 +BDEPEND="
125 + ${COMMON_DEPEND}
126 + virtual/pkgconfig
127 +"
128 +
129 +# Tcl is only needed in the CHOST test env
130 +DEPEND="
131 + test? (
132 + dev-lang/tcl:0=
133 + ssl? ( dev-tcltk/tls )
134 + )"
135 +
136 +REQUIRED_USE="?? ( jemalloc tcmalloc )"
137 +
138 +PATCHES=(
139 + "${FILESDIR}"/${PN}-6.2.1-config.patch
140 + "${FILESDIR}"/${PN}-5.0-shared.patch
141 + "${FILESDIR}"/${PN}-6.2.3-ppc-atomic.patch
142 + "${FILESDIR}"/${PN}-sentinel-5.0-config.patch
143 +)
144 +
145 +src_prepare() {
146 + default
147 +
148 + # unstable on jemalloc
149 + > tests/unit/memefficiency.tcl || die
150 +
151 + # Append cflag for lua_cjson
152 + # https://github.com/antirez/redis/commit/4fdcd213#diff-3ba529ae517f6b57803af0502f52a40bL61
153 + append-cflags "-DENABLE_CJSON_GLOBAL"
154 +
155 + # now we will rewrite present Makefiles
156 + local makefiles="" MKF
157 + for MKF in $(find -name 'Makefile' | cut -b 3-); do
158 + mv "${MKF}" "${MKF}.in"
159 + sed -i -e 's:$(CC):@CC@:g' \
160 + -e 's:$(CFLAGS):@AM_CFLAGS@:g' \
161 + -e 's: $(DEBUG)::g' \
162 + -e 's:$(OBJARCH)::g' \
163 + -e 's:ARCH:TARCH:g' \
164 + -e '/^CCOPT=/s:$: $(LDFLAGS):g' \
165 + "${MKF}.in" \
166 + || die "Sed failed for ${MKF}"
167 + makefiles+=" ${MKF}"
168 + done
169 + # autodetection of compiler and settings; generates the modified Makefiles
170 + cp "${FILESDIR}"/configure.ac-7.0 configure.ac || die
171 +
172 + sed -i \
173 + -e "/^AC_INIT/s|, __PV__, |, $PV, |" \
174 + -e "s:AC_CONFIG_FILES(\[Makefile\]):AC_CONFIG_FILES([${makefiles}]):g" \
175 + configure.ac || die "Sed failed for configure.ac"
176 + eautoreconf
177 +}
178 +
179 +src_configure() {
180 + econf
181 +
182 + # Linenoise can't be built with -std=c99, see https://bugs.gentoo.org/451164
183 + # also, don't define ANSI/c99 for lua twice
184 + sed -i -e "s:-std=c99::g" deps/linenoise/Makefile deps/Makefile || die
185 +}
186 +
187 +src_compile() {
188 + local myconf=""
189 +
190 + if use jemalloc; then
191 + myconf+="MALLOC=jemalloc"
192 + elif use tcmalloc; then
193 + myconf+="MALLOC=tcmalloc"
194 + else
195 + myconf+="MALLOC=libc"
196 + fi
197 +
198 + if use ssl; then
199 + myconf+=" BUILD_TLS=yes"
200 + fi
201 +
202 + export USE_SYSTEMD=$(usex systemd)
203 +
204 + tc-export AR CC RANLIB
205 + emake V=1 ${myconf} AR="${AR}" CC="${CC}" RANLIB="${RANLIB}"
206 +}
207 +
208 +src_test() {
209 + # Known to fail with FEATURES=usersandbox
210 + if has usersandbox ${FEATURES}; then
211 + ewarn "You are emerging ${P} with 'usersandbox' enabled." \
212 + "Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
213 + fi
214 +
215 + if use ssl; then
216 + ./utils/gen-test-certs.sh
217 + ./runtest --tls
218 + else
219 + ./runtest
220 + fi
221 +}
222 +
223 +src_install() {
224 + insinto /etc/redis
225 + doins redis.conf sentinel.conf
226 + use prefix || fowners -R redis:redis /etc/redis /etc/redis/{redis,sentinel}.conf
227 + fperms 0750 /etc/redis
228 + fperms 0644 /etc/redis/{redis,sentinel}.conf
229 +
230 + newconfd "${FILESDIR}/redis.confd-r2" redis
231 + newinitd "${FILESDIR}/redis.initd-6" redis
232 +
233 + systemd_newunit "${FILESDIR}/redis.service-4" redis.service
234 + newtmpfiles "${FILESDIR}/redis.tmpfiles-2" redis.conf
235 +
236 + newconfd "${FILESDIR}/redis-sentinel.confd-r1" redis-sentinel
237 + newinitd "${FILESDIR}/redis-sentinel.initd-r1" redis-sentinel
238 +
239 + insinto /etc/logrotate.d/
240 + newins "${FILESDIR}/${PN}.logrotate" ${PN}
241 +
242 + dodoc 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO README.md
243 +
244 + dobin src/redis-cli
245 + dosbin src/redis-benchmark src/redis-server src/redis-check-aof src/redis-check-rdb
246 + fperms 0750 /usr/sbin/redis-benchmark
247 + dosym redis-server /usr/sbin/redis-sentinel
248 +
249 + if use prefix; then
250 + diropts -m0750
251 + else
252 + diropts -m0750 -o redis -g redis
253 + fi
254 + keepdir /var/{log,lib}/redis
255 +}
256 +
257 +pkg_postinst() {
258 + tmpfiles_process redis.conf
259 +
260 + ewarn "The default redis configuration file location changed to:"
261 + ewarn " /etc/redis/{redis,sentinel}.conf"
262 + ewarn "Please apply your changes to the new configuration files."
263 +}