summaryrefslogtreecommitdiff
blob: e2d7462cf76d8e9b3d990bd5a4985d4fd2578bce (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/gnugk/gnugk-2.0.6.ebuild,v 1.1 2003/10/26 19:45:46 stkn Exp $

inherit eutils

IUSE="mysql ldap radius accounting"

DESCRIPTION="Advanced H.323 gatekeeper"
HOMEPAGE="http://www.gnugk.org/"
SRC_URI="mirror://sourceforge/openh323gk/gnugk-${PV}.tgz"

S=${WORKDIR}/openh323gk

# avoid problems when using portage on e.g. freebsd
MY_OS="`uname -s | tr [:upper:] [:lower:]`"

SLOT="0"
KEYWORDS="~x86"
LICENSE="GPL-2"

DEPEND=">=net-libs/openh323-1.12.2-r1
	mysql? ( >=dev-db/mysql++-1.7.9-r2 )
	ldap?  ( net-nds/openldap )"

pkg_setup() {
	# check if under_short does exist
	if [ -n "`use mysql`" -a ! -f /usr/include/mysql++/undef_short ]
	then
		ewarn "mysql USE flag is set, but mysql++ is missing an"
		ewarn "include file (\"/usr/include/mysql++/undef_short\")"
		ewarn "if emerge fails, please try again with"
		ewarn "    USE="-mysql" emerge ${PN}"
		echo -en "\a"; sleep 0.2 &>/dev/null; sleep 0,2 &>/dev/null
		echo -en "\a"; sleep 1
		echo -en "\a"; sleep 0.2 &>/dev/null; sleep 0,2 &>/dev/null
		echo -en "\a"; sleep 1
		echo -en "\a"; sleep 0.2 &>/dev/null; sleep 0,2 &>/dev/null
		echo -en "\a"; sleep 1
		echo -en "\a"; sleep 0.2 &>/dev/null; sleep 0,2 &>/dev/null
		echo -en "\a"; sleep 1
		echo -en "\a"; sleep 0.2 &>/dev/null; sleep 0,2 &>/dev/null
		sleep 8
	fi
}

src_unpack() {
	unpack ${A}

	cd ${S}
	# change include path for mysql++
	epatch ${FILESDIR}/gnugk-${PV}-gentoo.diff
}

src_compile() {
	local myconf

	use ldap && \
		myconf="${myconf} HAS_LDAP=1"

	use mysql || \
		myconf="${myconf} NO_MYSQL=1"

	use radius || \
		myconf="${myconf} NO_RADIUS=1"

	use accounting && \
		myconf="${myconf} HAS_ACCT=1"

	PWLIBDIR=/usr/share/pwlib \
	OPENH323DIR=/usr/share/openh323 \
	emake ${myconf} opt || die
}

src_install() {
	dodir /usr/sbin /etc/gnugk
	dosbin obj_${MY_OS}_${ARCH}_r/gnugk

	insinto /etc/gnugk
	doins etc/*

	# install ldap schema file
	if [ -n "`use ldap`" ] && [ -d /etc/openldap/schema ]; then
		insinto /etc/openldap/schema
		doins etc/voip.schema
		rm -f ${D}/etc/gnugk/voip.schema
	fi

	dodoc changes.txt readme.txt copying docs/*
	mv ${D}/etc/gnugk/*.pl ${D}/usr/share/doc/${PF}

	# install old documentation files,
	# they may be useful...
	docinto old
	dodoc docs/old/*

	exeinto /etc/init.d/
	newexe ${FILESDIR}/gnugk.rc6 gnugk

	insinto /etc/conf.d/
	newins ${FILESDIR}/gnugk.confd gnugk
}