pgpool2-9999.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. [[ ${PV} == 9999 ]] && MY_P=${PN/2/-II} || MY_P="${PN/2/-II}-${PV}"
  5. ECVS_SERVER="cvs.pgfoundry.org:/cvsroot/pgpool"
  6. ECVS_MODULE="pgpool-II"
  7. [[ ${PV} == 9999 ]] && SCM_ECLASS="cvs"
  8. inherit base user ${SCM_ECLASS}
  9. unset SCM_ECLASS
  10. DESCRIPTION="Connection pool server for PostgreSQL"
  11. HOMEPAGE="http://www.pgpool.net/"
  12. [[ ${PV} == 9999 ]] || SRC_URI="http://www.pgpool.net/download.php?f=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
  13. LICENSE="BSD"
  14. SLOT="0"
  15. # Don't move KEYWORDS on the previous line or ekeyword won't work # 399061
  16. [[ ${PV} == 9999 ]] || \
  17. KEYWORDS="~amd64 ~x86"
  18. IUSE="memcached pam ssl static-libs"
  19. RDEPEND="
  20. dev-db/postgresql
  21. memcached? ( dev-libs/libmemcached )
  22. pam? ( sys-auth/pambase )
  23. ssl? ( dev-libs/openssl )
  24. "
  25. DEPEND="${RDEPEND}
  26. sys-devel/bison
  27. !!dev-db/pgpool
  28. "
  29. AUTOTOOLS_IN_SOURCE_BUILD="1"
  30. S=${WORKDIR}/${MY_P}
  31. pkg_setup() {
  32. enewgroup postgres 70
  33. enewuser pgpool -1 -1 -1 postgres
  34. # We need the postgres user as well so we can set the proper
  35. # permissions on the sockets without getting into fights with
  36. # PostgreSQL's initialization scripts.
  37. enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
  38. }
  39. src_prepare() {
  40. epatch "${FILESDIR}/pgpool_run_paths.patch"
  41. local pg_config_manual="$(pg_config --includedir)/pg_config_manual.h"
  42. local pgsql_socket_dir=$(grep DEFAULT_PGSOCKET_DIR "${pg_config_manual}" | \
  43. sed 's|.*\"\(.*\)\"|\1|g')
  44. local pgpool_socket_dir="$(dirname $pgsql_socket_dir)/pgpool"
  45. sed "s|@PGSQL_SOCKETDIR@|${pgsql_socket_dir}|g" \
  46. -i *.conf.sample* pool.h || die
  47. sed "s|@PGPOOL_SOCKETDIR@|${pgpool_socket_dir}|g" \
  48. -i *.conf.sample* pool.h || die
  49. }
  50. src_configure() {
  51. local myconf
  52. use memcached && \
  53. myconf="--with-memcached=\"${EROOT%/}/usr/include/libmemcached\""
  54. use pam && myconf+=' --with-pam'
  55. econf \
  56. --disable-rpath \
  57. --sysconfdir="${EROOT%/}/etc/${PN}" \
  58. $(use_with ssl openssl) \
  59. $(use_enable static-libs static) \
  60. ${myconf}
  61. }
  62. src_compile() {
  63. emake
  64. cd sql
  65. emake
  66. }
  67. src_install() {
  68. emake DESTDIR="${D}" install
  69. cd sql
  70. emake DESTDIR="${D}" install
  71. cd "${S}"
  72. # `contrib' moved to `extension' with PostgreSQL 9.1
  73. local pgslot=$(postgresql-config show)
  74. if [[ ${pgslot//.} > 90 ]] ; then
  75. cd "${ED%/}$(pg_config --sharedir)"
  76. mv contrib extension || die
  77. cd "${S}"
  78. fi
  79. newinitd "${FILESDIR}/${PN}.initd" ${PN}
  80. newconfd "${FILESDIR}/${PN}.confd" ${PN}
  81. # Documentation
  82. dodoc NEWS TODO doc/where_to_send_queries.{pdf,odg}
  83. dohtml -r doc
  84. # Examples and extras
  85. insinto "/usr/share/${PN}"
  86. doins doc/{pgpool_remote_start,basebackup.sh,recovery.conf.sample}
  87. mv "${ED%/}/usr/share/${PN/2/-II}" "${ED%/}/usr/share/${PN}" || die
  88. # One more thing: Evil la files!
  89. find "${ED}" -name '*.la' -exec rm -f {} +
  90. }