summaryrefslogtreecommitdiff
blob: 68b48b97e64b23098b45d56f2dfdce4ed2eaf9ba (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
115
116
117
118
119
120
121
122
123
124
125
126
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

inherit versionator

MY_P1=${PN}-$(replace_version_separator 2 -)
MY_P2=${PN}-$(get_version_component_range 1-2)

DESCRIPTION="GNU H.323 gatekeeper"
HOMEPAGE="http://www.gnugk.org/"
SRC_URI="mirror://sourceforge/openh323gk/${MY_P1}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
# dev-db/firebird isn't keyworded for ppc but firebird IUSE is masked for ppc
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc firebird lua mysql odbc postgres radius snmp sqlite ssh linguas_en linguas_es linguas_fr"
REQUIRED_USE="doc? (
	|| ( linguas_en linguas_es linguas_fr )
	)
"

RDEPEND="net-libs/ptlib:=
	net-libs/h323plus:=
	dev-libs/openssl
	firebird? ( dev-db/firebird )
	lua? ( dev-lang/lua )
	mysql? ( virtual/mysql )
	odbc? ( dev-db/unixODBC )
	postgres? ( dev-db/postgresql )
	snmp? ( net-analyzer/net-snmp )
	ssh? ( net-libs/libssh )
	sqlite? ( dev-db/sqlite:3 )"
DEPEND="${RDEPEND}
	doc? ( app-text/linuxdoc-tools )"

S=${WORKDIR}/${MY_P2}

src_prepare() {
	eapply -p1 "${FILESDIR}"/${PN}-3.4-ptrace.patch
	eapply "${FILESDIR}"/${PN}-3.2.2-h323plus-buildopts.patch
	eapply "${FILESDIR}"/${PN}-3.2.2-lua.cxx-toolkit_h.patch

	default
}

# TODO: investigate possible ebuild conversion to use cmake
src_configure() {
	# --with-large-fdset=4096 is added because of bug #128102
	# and it is recommended in the online manual
	econf \
		$(use_enable firebird) \
		$(use_enable lua) \
		$(use_enable mysql) \
		$(use_enable postgres pgsql) \
		$(use_enable odbc unixodbc) \
		$(use_enable radius) \
		$(use_enable snmp netsnmp) \
		$(use_enable sqlite) \
		$(use_enable ssh libssh) \
		--with-large-fdset=4096
}

src_compile() {
	# PASN_NOPRINT should be set for -debug but it's buggy
	# better to prevent issues and keep default settings
	# `make debugdepend debugshared` and `make debug` failed (so no debug)
	# `make optdepend optnoshared` also failed (so no static)

	# splitting emake calls fixes parallel build issue
	emake optdepend
	emake \
		PT_LIBDIR="$(ptlib-config --libdir)" \
		OH323_LIBDIR="${EPREFIX}"/usr/lib \
		optshared
	# build tool addpasswd
	emake -C addpasswd PTLIBDIR="$(ptlib-config --ptlibdir)"

	if use doc; then
		cd docs/manual

		if use linguas_en; then
			emake html
		fi

		if use linguas_es; then
			emake html-es
		fi

		if use linguas_fr; then
			emake html-fr
		fi
		cd ../..
	fi
}

src_install() {
	dosbin obj_*_*_*/${PN}
	dosbin addpasswd/obj_*_*_*/addpasswd

	dodir /etc/${PN}
	insinto /etc/${PN}
	doins etc/*

	dodoc changes.txt readme.txt
	dodoc docs/*.txt docs/*.pdf

	if use doc; then
		if use linguas_en; then
			dohtml docs/manual/manual*.html
		fi
		if use linguas_fr; then
			dohtml docs/manual/fr/manual-fr*.html
		fi
		if use linguas_es; then
			dohtml docs/manual/es/manual-es*.html
		fi
	fi

	doman docs/${PN}.1 docs/addpasswd.1

	newinitd "${FILESDIR}"/${PN}.rc6 ${PN}
	newconfd "${FILESDIR}"/${PN}.confd ${PN}
}