dev-libs/leatherman: remove installing vendored boost library
[gentoo.git] / dev-db / pgbouncer / pgbouncer-1.11.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit user
7
8 DESCRIPTION="Lightweight connection pooler for PostgreSQL"
9 HOMEPAGE="https://pgbouncer.github.io"
10 SRC_URI="https://pgbouncer.github.io/downloads/files/${PV}/${P}.tar.gz"
11 LICENSE="BSD"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="+c-ares debug doc pam ssl -udns"
15
16 # At-most-one-of, one can be enabled but not both
17 REQUIRED_USE="?? ( c-ares udns )"
18
19 RDEPEND="
20         >=dev-libs/libevent-2.0
21         >=sys-libs/glibc-2.10
22         c-ares? ( >=net-dns/c-ares-1.10 )
23         ssl? ( >=dev-libs/openssl-1.0.1:=[-bindist] )
24         udns? ( >=net-libs/udns-0.1 )
25 "
26
27 DEPEND="${RDEPEND}"
28
29 pkg_setup() {
30         enewgroup postgres 70
31         enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
32
33         enewuser pgbouncer -1 -1 -1 postgres
34 }
35
36 src_prepare() {
37         eapply "${FILESDIR}/pgbouncer-1.11-dirs.patch"
38
39         default
40 }
41
42 src_configure() {
43         # --enable-debug is only used to disable stripping
44         econf \
45                 --enable-debug \
46                 $(use_with c-ares cares) \
47                 $(use_enable debug cassert) \
48                 $(use_with pam) \
49                 $(use_with ssl openssl) \
50                 $(use_with udns)
51 }
52
53 src_test() {
54         cd "${S}/test"
55         emake
56 }
57
58 src_install() {
59         emake DESTDIR="${D}" install
60
61         dodoc AUTHORS
62         use doc && dodoc doc/*.rst
63
64         newconfd "${FILESDIR}/${PN}.confd-r1" "${PN}"
65         newinitd "${FILESDIR}/${PN}.initd-r2" "${PN}"
66
67         insinto /etc
68         doins etc/pgbouncer.ini
69
70         insinto /etc/logrotate.d
71         newins "${FILESDIR}/logrotate" pgbouncer
72 }
73
74 pkg_postinst() {
75         if [[ -z ${REPLACING_VERSIONS} ]] ; then
76                 einfo "Please read the config.txt for Configuration Directives"
77                 einfo
78                 einfo "For Administration Commands, see:"
79                 einfo "    man pgbouncer"
80                 einfo
81                 einfo "By default, PgBouncer does not have access to any database."
82                 einfo "GRANT the permissions needed for your application and make sure that it"
83                 einfo "exists in PgBouncer's auth_file."
84         fi
85 }