summaryrefslogtreecommitdiff
blob: 90caef48feda737f67bb18870156a9cb7149101e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 2020-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

MY_PV="${PV/_/-}"

DESCRIPTION="XMPP gateway to IRC"
HOMEPAGE="https://biboumi.louiz.org/"
SRC_URI="https://git.louiz.org/biboumi/snapshot/biboumi-${MY_PV}.tar.xz"

LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+idn postgres +sqlite +ssl systemd udns"

DEPEND="
	dev-libs/expat
	virtual/libiconv
	sys-apps/util-linux
	sqlite? ( dev-db/sqlite:3 )
	postgres? ( dev-db/postgresql:* )
	idn? ( net-dns/libidn:= )
	udns? ( net-libs/udns )
	ssl? ( dev-libs/botan:2= )
	!ssl? ( dev-libs/libgcrypt )
	systemd? ( sys-apps/systemd:= )
"
BDEPEND="dev-python/sphinx"
RDEPEND="
	${DEPEND}
	acct-user/biboumi
"

S="${WORKDIR}/${PN}-${MY_PV}"

DOCS=( README.rst CHANGELOG.rst doc/user.rst )

PATCHES=(
	"${FILESDIR}/${PN}-9.0-fix-namespace-separator.patch"
)

src_configure() {
	local mycmakeargs=(
		-DSERVICE_USER="${PN}"
		-DSERVICE_GROUP="${PN}"
	)

	# Account for biboumi's atypical configuration system.
	if use systemd; then
		mycmakeargs+=(-DWITH_SYSTEMD=yes)
	else
		mycmakeargs+=(-DWITHOUT_SYSTEMD=yes)
	fi

	if use idn; then
		mycmakeargs+=(-DWITH_LIBIDN=yes)
	else
		mycmakeargs+=(-DWITHOUT_LIBIDN=yes)
	fi

	if use ssl; then
		mycmakeargs+=(-DWITH_BOTAN=yes)
	else
		mycmakeargs+=(-DWITHOUT_BOTAN=yes)
	fi

	if use udns; then
		mycmakeargs+=(-DWITH_UDNS=yes)
	else
		mycmakeargs+=(-DWITHOUT_UDNS=yes)
	fi

	if use sqlite; then
		mycmakeargs+=(-DWITH_SQLITE3=yes)
	else
		mycmakeargs+=(-DWITHOUT_SQLITE3=yes)
	fi

	if use postgres; then
		mycmakeargs+=(-DWITH_POSTGRESQL=yes)
	else
		mycmakeargs+=(-DWITHOUT_POSTGRESQL=yes)
	fi

	cmake_src_configure
}

src_compile() {
	cmake_src_compile

	cmake_build man
}

src_install() {
	cmake_src_install

	newinitd "${FILESDIR}/${PN}.initd" "${PN}"

	insinto /etc/logrotate.d
	newins "${FILESDIR}/${PN}.logrotate" "${PN}"

	diropts --owner=biboumi --group=biboumi --mode=750
	if use sqlite; then
		keepdir /var/lib/biboumi
	fi
	keepdir /var/log/biboumi

	insinto /etc/biboumi
	insopts --group=biboumi --mode=640
	newins conf/biboumi.cfg biboumi.cfg.example
}