summaryrefslogtreecommitdiff
blob: e8ddeeab7a59c26d3b3672fbba0bf2ff34ebe73c (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit asterisk-mod

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

LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc ~x86"

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

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

	# patch locations and compile flags
	sed -i -e "s:^\(CFLAGS.*-march=.*\):# \1:g" -e "s:^\(CFLAGS.*-O6.*\):# \1:g" \
		-e "s:^\(ASTERISK_HEADER_DIR=[^/]*\).*:\1/usr/include:g" \
		-e "s:^\(MODULES_DIR=[^/]*\).*:\1${AST_MODULES_DIR}:g" \
		-e "s:^\(CONFIG_DIR=[^/]*\).*:\1${AST_CONFIG_DIR}:g" \
		-e "s:\(-shared.*-x\):${AST_LDFLAGS} \$(LDFLAGS):g" Makefile
}

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

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

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