blob: 7ed151922480f31891e66a64eb51e880225c7304 [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001SUMMARY = "Redis key-value store"
2DESCRIPTION = "Redis is an open source, advanced key-value store."
3HOMEPAGE = "http://redis.io"
4SECTION = "libs"
5LICENSE = "BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://COPYING;md5=8ffdd6c926faaece928cf9d9640132d2"
7DEPENDS = "readline lua ncurses"
8
Patrick Williams92b42cb2022-09-03 06:53:57 -05009FILESPATH =. "${FILE_DIRNAME}/${BPN}-7:"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000010
11SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \
12 file://redis.conf \
13 file://init-redis-server \
14 file://redis.service \
15 file://hiredis-use-default-CC-if-it-is-set.patch \
16 file://lua-update-Makefile-to-use-environment-build-setting.patch \
17 file://oe-use-libc-malloc.patch \
18 file://0001-src-Do-not-reset-FINAL_LIBS.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050019 file://GNU_SOURCE-7.patch \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000020 file://0006-Define-correct-gregs-for-RISCV32.patch \
21 "
Patrick Williams975a06f2022-10-21 14:42:47 -050022SRC_URI[sha256sum] = "67054cc37b58c125df93bd78000261ec0ef4436a26b40f38262c780e56315cc3"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000023
24inherit autotools-brokensep update-rc.d systemd useradd
25
26FINAL_LIBS:x86:toolchain-clang = "-latomic"
27FINAL_LIBS:riscv32:toolchain-clang = "-latomic"
28FINAL_LIBS:mips = "-latomic"
29FINAL_LIBS:arm = "-latomic"
30FINAL_LIBS:powerpc = "-latomic"
31
32export FINAL_LIBS
33
34USERADD_PACKAGES = "${PN}"
35USERADD_PARAM:${PN} = "--system --home-dir /var/lib/redis -g redis --shell /bin/false redis"
36GROUPADD_PARAM:${PN} = "--system redis"
37
Andrew Geissler87f5cff2022-09-30 13:13:31 -050038PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
39PACKAGECONFIG[systemd] = "USE_SYSTEMD=yes,USE_SYSTEMD=no,systemd"
40
41EXTRA_OEMAKE += "${PACKAGECONFIG_CONFARGS}"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000042
43do_compile:prepend() {
44 (cd deps && oe_runmake hiredis lua linenoise)
45}
46
47do_install() {
48 export PREFIX=${D}/${prefix}
49 oe_runmake install
50 install -d ${D}/${sysconfdir}/redis
51 install -m 0644 ${WORKDIR}/redis.conf ${D}/${sysconfdir}/redis/redis.conf
52 install -d ${D}/${sysconfdir}/init.d
53 install -m 0755 ${WORKDIR}/init-redis-server ${D}/${sysconfdir}/init.d/redis-server
54 install -d ${D}/var/lib/redis/
55 chown redis.redis ${D}/var/lib/redis/
56
57 install -d ${D}${systemd_system_unitdir}
58 install -m 0644 ${WORKDIR}/redis.service ${D}${systemd_system_unitdir}
59 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${systemd_system_unitdir}/redis.service
60
Andrew Geissler87f5cff2022-09-30 13:13:31 -050061 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000062 sed -i 's!daemonize yes!# daemonize yes!' ${D}/${sysconfdir}/redis/redis.conf
Andrew Geissler87f5cff2022-09-30 13:13:31 -050063 sed -i 's!supervised no!supervised systemd!' ${D}/${sysconfdir}/redis/redis.conf
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000064 fi
65}
66
67CONFFILES:${PN} = "${sysconfdir}/redis/redis.conf"
68
69INITSCRIPT_NAME = "redis-server"
70INITSCRIPT_PARAMS = "defaults 87"
71
72SYSTEMD_SERVICE:${PN} = "redis.service"