pgpool2-3.6.1.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. MY_P="${PN/2/-II}-${PV}"
  5. inherit eutils user
  6. DESCRIPTION="Connection pool server for PostgreSQL"
  7. HOMEPAGE="http://www.pgpool.net/"
  8. SRC_URI="http://www.pgpool.net/download.php?f=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
  9. LICENSE="BSD"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="doc memcached pam ssl static-libs"
  13. RDEPEND="
  14. dev-db/postgresql:=
  15. memcached? ( dev-libs/libmemcached )
  16. pam? ( sys-auth/pambase )
  17. ssl? ( dev-libs/openssl:= )
  18. "
  19. DEPEND="${RDEPEND}
  20. sys-devel/bison
  21. !!dev-db/pgpool
  22. "
  23. S=${WORKDIR}/${MY_P}
  24. pkg_setup() {
  25. enewgroup postgres 70
  26. enewuser pgpool -1 -1 -1 postgres
  27. # We need the postgres user as well so we can set the proper
  28. # permissions on the sockets without getting into fights with
  29. # PostgreSQL's initialization scripts.
  30. enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
  31. }
  32. src_prepare() {
  33. epatch "${FILESDIR}/pgpool2-3.5.0-path-fix.patch"
  34. local pg_config_manual="$(pg_config --includedir)/pg_config_manual.h"
  35. local pgsql_socket_dir=$(grep DEFAULT_PGSOCKET_DIR "${pg_config_manual}" | \
  36. sed 's|.*\"\(.*\)\"|\1|g')
  37. local pgpool_socket_dir="$(dirname $pgsql_socket_dir)/pgpool"
  38. sed "s|@PGSQL_SOCKETDIR@|${pgsql_socket_dir}|g" \
  39. -i src/sample/pgpool.conf.sample* src/include/pool.h || die
  40. sed "s|@PGPOOL_SOCKETDIR@|${pgpool_socket_dir}|g" \
  41. -i src/sample/pgpool.conf.sample* src/include/pool.h || die
  42. }
  43. src_configure() {
  44. local myconf
  45. use memcached && \
  46. myconf="--with-memcached=\"${EROOT%/}/usr/include/libmemcached\""
  47. use pam && myconf+=' --with-pam'
  48. econf \
  49. --disable-rpath \
  50. --sysconfdir="${EROOT%/}/etc/${PN}" \
  51. $(use_with ssl openssl) \
  52. $(use_enable static-libs static) \
  53. ${myconf}
  54. }
  55. src_compile() {
  56. emake
  57. emake -C src/sql
  58. }
  59. src_install() {
  60. emake DESTDIR="${D}" install
  61. emake DESTDIR="${D}" -C src/sql install
  62. newinitd "${FILESDIR}/${PN}.initd" ${PN}
  63. newconfd "${FILESDIR}/${PN}.confd" ${PN}
  64. # Documentation
  65. dodoc NEWS TODO
  66. use doc && dohtml -r doc/*
  67. # Examples and extras
  68. # mv some files that get installed to /usr/share/pgpool-II so that
  69. # they all wind up in the same place
  70. mv "${ED%/}/usr/share/${PN/2/-II}" "${ED%/}/usr/share/${PN}" || die
  71. into "/usr/share/${PN}"
  72. dobin src/sample/pgpool_remote_start
  73. # One more thing: Evil la files!
  74. find "${ED}" -name '*.la' -exec rm -f {} +
  75. }