memcached-1.4.34.ebuild 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit autotools eutils flag-o-matic systemd user
  5. MY_PV="${PV/_rc/-rc}"
  6. MY_P="${PN}-${MY_PV}"
  7. DESCRIPTION="High-performance, distributed memory object caching system"
  8. HOMEPAGE="http://memcached.org/"
  9. SRC_URI="https://www.memcached.org/files/${MY_P}.tar.gz
  10. https://www.memcached.org/files/old/${MY_P}.tar.gz"
  11. LICENSE="BSD"
  12. SLOT="0"
  13. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
  14. IUSE="test slabs-reassign debug sasl selinux" # hugetlbfs later
  15. RDEPEND=">=dev-libs/libevent-1.4:=
  16. dev-lang/perl
  17. sasl? ( dev-libs/cyrus-sasl )
  18. selinux? ( sec-policy/selinux-memcached )"
  19. DEPEND="${RDEPEND}
  20. test? ( virtual/perl-Test-Harness >=dev-perl/Cache-Memcached-1.24 )"
  21. S="${WORKDIR}/${MY_P}"
  22. src_prepare() {
  23. epatch "${FILESDIR}/${PN}-1.2.2-fbsd.patch"
  24. epatch "${FILESDIR}/${PN}-1.4.0-fix-as-needed-linking.patch"
  25. epatch "${FILESDIR}/${PN}-1.4.4-as-needed.patch"
  26. epatch "${FILESDIR}/${PN}-1.4.17-EWOULDBLOCK.patch"
  27. sed -i -e 's,-Werror,,g' configure.ac || die
  28. sed -i -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,' configure.ac || die
  29. eautoreconf
  30. use slabs-reassign && append-flags -DALLOW_SLABS_REASSIGN
  31. # Tweak upstream systemd unit to use Gentoo variables/envfile.
  32. # As noted by bug #587440
  33. sed -i -e '/^ExecStart/{
  34. s,{USER},{MEMCACHED_RUNAS},g;
  35. s,{CACHESIZE},{MEMUSAGE},g;
  36. s,OPTIONS,MISC_OPTS,g;
  37. };
  38. /Environment=/{s,OPTIONS,MISC_OPTS,g;};
  39. /EnvironmentFile=/{s,/sysconfig/,/conf.d/,g;};
  40. ' \
  41. "${S}"/scripts/memcached.service
  42. }
  43. src_configure() {
  44. econf \
  45. --disable-docs \
  46. $(use_enable sasl)
  47. # The xml2rfc tool to build the additional docs requires TCL :-(
  48. # `use_enable doc docs`
  49. }
  50. src_compile() {
  51. # There is a heavy degree of per-object compile flags
  52. # Users do NOT know better than upstream. Trying to compile the testapp and
  53. # the -debug version with -DNDEBUG _WILL_ fail.
  54. append-flags -UNDEBUG -pthread
  55. emake testapp memcached-debug CFLAGS="${CFLAGS}"
  56. filter-flags -UNDEBUG
  57. emake
  58. }
  59. src_install() {
  60. emake DESTDIR="${D}" install
  61. dobin scripts/memcached-tool
  62. use debug && dobin memcached-debug
  63. dodoc AUTHORS ChangeLog NEWS README.md doc/{CONTRIBUTORS,*.txt}
  64. newconfd "${FILESDIR}/memcached.confd" memcached
  65. newinitd "${FILESDIR}/memcached.init2" memcached
  66. systemd_dounit "${S}/scripts/memcached.service"
  67. }
  68. pkg_postinst() {
  69. enewuser memcached -1 -1 /dev/null daemon
  70. elog "With this version of Memcached Gentoo now supports multiple instances."
  71. elog "To enable this you should create a symlink in /etc/init.d/ for each instance"
  72. elog "to /etc/init.d/memcached and create the matching conf files in /etc/conf.d/"
  73. elog "Please see Gentoo bug #122246 for more info"
  74. }
  75. src_test() {
  76. emake -j1 test
  77. }