logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

redict-9999.ebuild (4146B)


  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. # N.B.: It is no clue in porting to Lua eclasses, as upstream have deviated
  5. # too far from vanilla Lua, adding their own APIs like lua_enablereadonlytable
  6. inherit edo multiprocessing systemd tmpfiles toolchain-funcs
  7. if [ ${PV} = "9999" ]; then
  8. inherit git-r3
  9. EGIT_REPO_URI="https://git.sr.ht/~lanodan/redict"
  10. else
  11. die "live-only for now"
  12. KEYWORDS="amd64 ~arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
  13. fi
  14. DESCRIPTION="A persistent caching system, key-value, and data structures database (personal branch!)"
  15. HOMEPAGE="
  16. https://git.sr.ht/~lanodan/redict
  17. https://codeberg.org/redict/redict
  18. "
  19. LICENSE="BSD Boost-1.0 GPL-3"
  20. SLOT="0/$(ver_cut 1-2)"
  21. IUSE="+jemalloc selinux ssl systemd tcmalloc test"
  22. RESTRICT="!test? ( test )"
  23. REQUIRED_USE="?? ( jemalloc tcmalloc )"
  24. COMMON_DEPEND="
  25. jemalloc? ( >=dev-libs/jemalloc-5.1:= )
  26. ssl? ( dev-libs/openssl:0= )
  27. systemd? ( sys-apps/systemd:= )
  28. tcmalloc? ( dev-util/google-perftools )
  29. "
  30. RDEPEND="
  31. ${COMMON_DEPEND}
  32. acct-group/redis
  33. acct-user/redis
  34. selinux? ( sec-policy/selinux-redis )
  35. "
  36. BDEPEND="
  37. ${COMMON_DEPEND}
  38. virtual/pkgconfig
  39. "
  40. # Tcl is only needed in the CHOST test env
  41. DEPEND="
  42. ${COMMON_DEPEND}
  43. test? (
  44. dev-lang/tcl:0=
  45. ssl? ( dev-tcltk/tls )
  46. )"
  47. PATCHES=(
  48. "${FILESDIR}"/redict-6.2.1-config.patch
  49. "${FILESDIR}"/redict-sentinel-7.2.0-config.patch
  50. )
  51. src_prepare() {
  52. default
  53. # Respect user CFLAGS in bundled lua
  54. sed -i '/LUA_CFLAGS/s: -O2::g' deps/Makefile || die
  55. }
  56. src_compile() {
  57. tc-export AR CC RANLIB
  58. local myconf=(
  59. AR="${AR}"
  60. CC="${CC}"
  61. RANLIB="${RANLIB}"
  62. V=1 # verbose
  63. # OPTIMIZATION defaults to -O3. Let's respect user CFLAGS by setting it
  64. # to empty value.
  65. OPTIMIZATION=''
  66. # Disable debug flags in bundled hiredis
  67. DEBUG_FLAGS=''
  68. BUILD_TLS=$(usex ssl)
  69. USE_SYSTEMD=$(usex systemd)
  70. )
  71. if use jemalloc; then
  72. myconf+=( MALLOC=jemalloc )
  73. elif use tcmalloc; then
  74. myconf+=( MALLOC=tcmalloc )
  75. else
  76. myconf+=( MALLOC=libc )
  77. fi
  78. emake -C src "${myconf[@]}"
  79. }
  80. src_test() {
  81. local runtestargs=(
  82. --clients "$(makeopts_jobs)" # see bug #649868
  83. --skiptest "Active defrag eval scripts" # see bug #851654
  84. )
  85. if has usersandbox ${FEATURES} || ! has userpriv ${FEATURES}; then
  86. ewarn "oom-score-adj related tests will be skipped." \
  87. "They are known to fail with FEATURES usersandbox or -userpriv. See bug #756382."
  88. runtestargs+=(
  89. # unit/oom-score-adj was introduced in version 6.2.0
  90. --skipunit unit/oom-score-adj # see bug #756382
  91. # Following test was added in version 7.0.0 to unit/introspection.
  92. # It also tries to adjust OOM score.
  93. --skiptest "CONFIG SET rollback on apply error"
  94. )
  95. fi
  96. if use ssl; then
  97. edo ./utils/gen-test-certs.sh
  98. runtestargs+=( --tls )
  99. fi
  100. edo ./runtest "${runtestargs[@]}"
  101. }
  102. src_install() {
  103. insinto /etc/redict
  104. doins redict.conf sentinel.conf
  105. use prefix || fowners -R redis:redis /etc/redict /etc/redict/{redict,sentinel}.conf
  106. fperms 0750 /etc/redict
  107. fperms 0644 /etc/redict/{redict,sentinel}.conf
  108. newconfd "${FILESDIR}/redis.confd-r2" redict
  109. newinitd "${FILESDIR}/redis.initd-6" redict
  110. systemd_newunit "${FILESDIR}/redis.service-4" redict.service
  111. newtmpfiles "${FILESDIR}/redis.tmpfiles-2" redict.conf
  112. newconfd "${FILESDIR}/redis-sentinel.confd-r1" redict-sentinel
  113. newinitd "${FILESDIR}/redis-sentinel.initd-r1" redict-sentinel
  114. insinto /etc/logrotate.d/
  115. newins "${FILESDIR}/redis.logrotate" ${PN}
  116. dodoc 00-RELEASENOTES BUGS CONTRIBUTING.md MANIFESTO README.md
  117. dobin src/redict-cli
  118. dosbin src/redict-benchmark src/redict-server src/redict-check-aof src/redict-check-rdb
  119. fperms 0750 /usr/sbin/redict-benchmark
  120. dosym redict-server /usr/sbin/redict-sentinel
  121. if use prefix; then
  122. diropts -m0750
  123. else
  124. diropts -m0750 -o redis -g redis
  125. fi
  126. keepdir /var/{log,lib}/redict
  127. }
  128. pkg_postinst() {
  129. tmpfiles_process redict.conf
  130. ewarn "The default redict configuration file location changed to:"
  131. ewarn " /etc/redict/{redict,sentinel}.conf"
  132. ewarn "Please apply your changes to the new configuration files."
  133. }