summaryrefslogtreecommitdiff
blob: 35df01ca84a5911b6067ac623243d31fe66c2e58 (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
90
91
92
93
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit vdr-plugin-2

MY_P="vdr-plugin-dvbapi-${PV}"

DESCRIPTION="VDR Plugin: allows connect VDR to OScam"
HOMEPAGE="https://github.com/manio/vdr-plugin-dvbapi"
SRC_URI="https://github.com/manio/vdr-plugin-dvbapi/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"

KEYWORDS="amd64 x86"
SLOT="0"
LICENSE="GPL-2+"
IUSE="cpu_flags_x86_3dnow cpu_flags_x86_mmx cpu_flags_x86_sse cpu_flags_x86_sse2 dvbcsa"

DEPEND=">=media-video/vdr-2.1.4
	dvbcsa? ( media-libs/libdvbcsa )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

DOCS=( "FAQ" "HISTORY" "INSTALL" "README" "FFdecsa/docs" )

src_prepare() {
	vdr-plugin-2_src_prepare

	if use dvbcsa; then
		sed -e "/PLUGIN = dvbapi/a LIBDVBCSA = 1" -i Makefile || die "modifying Makefile"
	fi

	# respect the system CXXFLAGS
	sed -e "s:FLAGS:CXXFLAGS:" -i FFdecsa/Makefile || die "modifying FFdecsa/Makefile"

	# Prepare flags for FFdeCSA
	if [[ -n "${VDR_DVBAPI_PARALLEL}" ]]; then
		PARALLEL="${VDR_DVBAPI_PARALLEL}"
	else
		# [32/64] Core2 (SSSE3) achieves best results with SSE2 & SSE
		# [64] Athlon64 (SSE2) does much better with 64_LONG
		# [32] Athlon64 (SSE2) does best with MMX
		# [32] Pentium4 & Atom (SSE2) work best with SSE2 & SSE
		# [32] AthlonXP (SSE) has MMX faster

		# To avoid parsing -march=, we use ugly assumption that Intels don't
		# have 3dnow and AMDs do. SSE achieves good results only on Intel CPUs,
		# and LONG is best on 64-bit AMD CPUs.

		if ! use cpu_flags_x86_3dnow && use cpu_flags_x86_sse2; then
			PARALLEL=PARALLEL_128_SSE2
		elif ! use cpu_flags_x86_3dnow && use cpu_flags_x86_sse; then
			PARALLEL=PARALLEL_128_SSE
		elif use amd64; then
			PARALLEL=PARALLEL_64_LONG
		elif use cpu_flags_x86_mmx; then
			PARALLEL=PARALLEL_64_MMX
		else
			# fallback values:
			# PARALLEL_32_INT fails with gcc4.4 on x86&amd64
			# PARALLEL_64_2INT fails with gcc4.4 on x86
			# PARALLEL_128_4INT seems to be the fastest non-failing fallback
			PARALLEL=PARALLEL_128_4INT
		fi

		ewarn "VDR_DVBAPI_PARALLEL in your system make.conf is not set, guessing"
		ewarn "value from CPU_FLAGS_X86 USEflags, result: ${PARALLEL}"
		ewarn "This setting may be suboptimal, so you'll probably want to tweak"
		ewarn "it yourself."
		ewarn
		ewarn "To do this, unpack the source and run the script in"
		ewarn "\t<unpackdir>/${MY_P}/extra/FFdecsa-benchmark.sh"
		ewarn "and add the output value from  PARALLEL_MODE= to your system make.conf as"
		ewarn "\tVDR_DVBAPI_PARALLEL=<your parameter>"
		ewarn
	fi

	export PARALLEL

	eapply "${FILESDIR}/kernel-4.14-fix.diff"
}

pkg_postinst() {
	vdr-plugin-2_pkg_postinst

	elog "This software might be illegal in some countries or violate"
	elog "rules of your DVB provider. Please respect these rules."
	elog
	elog "We do not offer support of any kind."
	elog "Asking for keys or for installation help will be ignored by gentoo developers!"
	elog
}