summaryrefslogtreecommitdiff
path: root/dev-db/repmgr/repmgr-5.4.1.ebuild
blob: 1c1c4a972f53d01a2b56ca57c9226be334f34971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2021-2023 Liguros Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8

DESCRIPTION="PostgreSQL Replication Manager"
HOMEPAGE="http://www.repmgr.org/"
SRC_URI="https://github.com/EnterpriseDB/repmgr/archive/refs/tags/v${PV}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"

DEPEND="
	dev-db/postgresql:*[server,static-libs]
	dev-libs/libbsd
	dev-libs/json-c
"
RDEPEND="
	${DEPEND}
	net-misc/rsync
"

PATCHES=( "${FILESDIR}"/strlcpy.patch )

src_prepare() {
	# add bsd library
	sed -i -E -e "s/\(LDFLAGS\)/\(LDFLAGS\) -lbsd/g;" "${S}/Makefile.in" || die
	default
}

src_compile() {
	emake USE_PGXS=1
}

src_install() {
	emake DESTDIR="${D}" USE_PGXS=1 install
	dodoc CREDITS HISTORY COPYRIGHT *.md

	local PGSLOT="$(postgresql-config show)"
	einfo "PGSLOT: ${PGSLOT}"

	dodir /usr/share/postgresql-${PGSLOT}/contrib
	dodir /usr/$(get_libdir)/postgresql-${PGSLOT}

	local repmgr="/usr/bin/repmgr${PGSLOT//.}"
	local repmgrd="/usr/bin/repmgrd${PGSLOT//.}"
	dosym ../$(get_libdir)/postgresql-${PGSLOT}/bin/repmgr ${repmgr}
	dosym ../$(get_libdir)/postgresql-${PGSLOT}/bin/repmgrd ${repmgrd}

	insinto /etc
	newins repmgr.conf.sample repmgr.conf

	fowners postgres:postgres /etc/repmgr.conf
	ewarn "Remember to modify /etc/repmgr.conf"
}