summaryrefslogtreecommitdiff
blob: 5cf3dcf934ff54df944602b7dc69640c48bb421f (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
# Copyright 1999-2009 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-1.1.4.ebuild,v 1.1 2009/12/31 18:59:28 tgurr Exp $

inherit eutils

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

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""

RDEPEND=">=net-misc/asterisk-1.2.0
	net-dialup/capi4k-utils"

DEPEND="${RDEPEND}
	sys-apps/sed"

S="${WORKDIR}/${P/asterisk-}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# patch locations and compile flags
	sed -i \
		-e "s:^\(CFLAGS.*-O6.*\):# \1:g" \
		-e "s:^\(CFLAGS.*-march=.*\):# \1:g" \
		-e "s:/usr/lib/:/usr/$(get_libdir)/:g" \
		-e "s:\(-shared\):\$(LDFLAGS) \1:g" Makefile || die "sed failed"
}

src_compile() {
	emake V="1" CC="$(tc-getCC)" OPTIMIZE="${CFLAGS}" || die "emake failed"
}

src_install() {
	emake AVERSION="" INSTALL_PREFIX="${D}" install install_config || die "emake install failed"
	newdoc libcapi20/README README.capi20 || die "newdoc failed"
	dodoc CHANGES README* capi.conf || die "dodoc failed"

	# 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() {
	elog
	elog "Please don't forget to enable chan_capi in"
	elog "your /etc/asterisk/modules.conf:"
	elog
	elog "  load => chan_capi.so"
	elog
	elog "and in the [global] section:"
	elog
	elog "  chan_capi.so=yes"
	elog
	elog "Don't forget a trailing newline at the end of modules.conf!"
	elog "See /usr/share/doc/${PF} for more information."
	elog
}