summaryrefslogtreecommitdiff
blob: 4d979a32f9f945b998a2817d5872d2a670add3ea (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
# Copyright 1999-2008 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.1.ebuild,v 1.1 2008/10/26 22:42:29 sbriesen 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"

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
}

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
	dodoc CHANGES 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() {
	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
}