summaryrefslogtreecommitdiff
blob: 481b07218984b66095a1ca0bf5e6e208b5605c33 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk-chan_capi/asterisk-chan_capi-0.7.1.ebuild,v 1.2 2007/01/06 16:50:51 drizzt Exp $

inherit eutils toolchain-funcs subversion

MY_P="${P/asterisk-}"

DESCRIPTION="CAPI 2.0 channel module for Asterisk"
HOMEPAGE="http://www.melware.org/ChanCapi"
#SRC_URI="ftp://ftp.chan-capi.org/chan-capi/${MY_P}.tar.gz"
ESVN_REPO_URI="svn://svn.chan-capi.org/chan-capi/trunk"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE=""

DEPEND="!net-misc/asterisk-chan_capi-cm
	>=net-misc/asterisk-1.2.0
	net-dialup/capi4k-utils"

src_unpack() {
	subversion_src_unpack
	cd "${S}"

	cp Makefile Makefile.orig
	# patch locations and compile flags
	sed -i -e "s:^\(CFLAGS.*-march=.*\):# \1:g" -e "s:^\(CFLAGS.*-O6.*\):# \1:g" \
		-e "s:^\(MODULES_DIR=[^/]*\).*:\1/usr/$(get_libdir)/asterisk/modules:g" \
		-e "s:^\(ASTERISK_HEADER_DIR=[^/]*\).*:\1/usr/include:g" \
		-e "s:^\(CONFIG_DIR=[^/]*\).*:\1/etc/asterisk:g" \
		-e "s:\(-shared\):\$(LDFLAGS) \1:g" Makefile
	diff -u Makefile.orig Makefile
}

src_compile() {
	emake OPTIMIZE="${CFLAGS}" || die "emake failed"
}

src_install() {
	make INSTALL_PREFIX="${D}" install install_config || die "make install failed"
	dodoc CHANGES INSTALL README capi.conf

	# fix permissions
	if [[ -n "$(egetent group asterisk)" ]]; then
		chown -R root:asterisk "${D}"/etc/asterisk/capi.conf
		chmod -R u=rwX,g=rX,o= "${D}"/etc/asterisk/capi.conf
	fi
}

pkg_postinst() {
	echo
	elog "Please don't forget to enable chan_capi in"
	elog "your /etc/asterisk/modules.conf:"
	echo
	elog "load => chan_capi.so"
	echo
	elog "and in the [global] section:"
	elog "chan_capi.so=yes"
	echo
	elog "(see /usr/share/doc/${PF} for more information)"
	echo
}