summaryrefslogtreecommitdiff
blob: 1cb348724186ffe7c180d3f7981edc0e6a1d47ab (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit eutils multilib toolchain-funcs vcs-snapshot

HOMEPAGE="https://www.linuxtv.org/"
DESCRIPTION="Small utils for DVB to scan, zap, view signal strength, ..."
SRC_URI="mirror://gentoo/${P}.tar.bz2"

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

RDEPEND="
	alevt? (
		!media-video/alevt
		media-libs/libpng:0=
		media-libs/zvbi[v4l]
		sys-libs/zlib
		x11-libs/libX11
	)
	usb? ( virtual/libusb:0 )
"
DEPEND="${RDEPEND}
	dev-lang/perl
	virtual/linuxtv-dvb-headers
"

src_prepare() {
	epatch \
		"${FILESDIR}"/${P}-ldflags.patch \
		"${FILESDIR}"/${P}-alevt.patch \
		"${FILESDIR}"/${P}-perl526.patch

	# do not compile test-progs, incompatible with videodev2.h
	sed -e '/-C test/d' \
		-i Makefile || die

	# remove copy of header-files
	rm -rf "${S}"/include || die
}

src_compile() {
	emake V=1 CC=$(tc-getCC) $(usex usb "ttusb_dec_reset=1" "")
	if use alevt ; then
		emake -C util/alevt CC=$(tc-getCC) OPT="${CFLAGS}"
	fi
}

src_install() {
	insinto /usr/bin
	emake V=1 prefix="${EROOT}usr" libdir="${EROOT}usr/$(get_libdir)" \
		$(usex usb "ttusb_dec_reset=1" "") \
		DESTDIR="${D}" INSTDIR="${T}" install
	if use alevt ; then
		dodir /usr/share/applications
		dodir /usr/share/man/man1
		emake -C util/alevt DESTDIR="${D}" install
	fi

	# rename scan to scan-dvb
	mv "${D}"/usr/bin/scan{,-dvb} || die

	# install zap-files
	local dir=""
	for dir in dvb-{s,c,t} atsc ; do
		insinto /usr/share/dvb/zap/${dir}
		doins "${S}"/util/szap/channels-conf/${dir}/*
	done

	# install remote-key files
	insinto /usr/share/dvb/av7110_loadkeys
	doins util/av7110_loadkeys/*.rc*

	# install Documentation
	dodoc README
	newdoc util/scan/README README.scan-dvb
	newdoc util/szap/README README.zap
	newdoc util/av7110_loadkeys/README README.av7110_loadkeys

	use usb && newdoc util/ttusb_dec_reset/README README.ttusb_dec_reset
}

pkg_postinst() {
	elog "/usr/bin/scan has been installed as scan-dvb."
}