summaryrefslogtreecommitdiff
blob: eb1951f384c19ab4c2a8c4c0307fef09c12f161d (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools bash-completion-r1 perl-functions

DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi"
HOMEPAGE="https://www.asterisk.org"
SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
IUSE="ppp"
PATCHES=(
	"${FILESDIR}/dahdi-nondigium-blacklist.patch"
	"${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch"
	"${FILESDIR}/dahdi-tools-3.1.0-fno-common.patch"
)

DEPEND="dev-libs/newt
	net-misc/dahdi
	sys-kernel/linux-headers
	virtual/libusb:0
	ppp? ( net-dialup/ppp )"
RDEPEND="${DEPEND}"

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)"
}

src_install() {
	local bashcompdir="$(get_bashcompdir)"
	local bashcmd bashcmdtarget

	emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir=/lib/udev/rules.d install
	emake DESTDIR="${ED}" install-config

	dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest

	# install init scripts
	newinitd "${FILESDIR}"/dahdi.init2 dahdi
	newinitd "${FILESDIR}"/dahdi-autoconf.init2 dahdi-autoconf
	newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf

	bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" ||
		die "Error parsing dahdi bash completion file for commands")
}