summaryrefslogtreecommitdiff
blob: fe2a0e8dc961486221827a312a5ab3ed40c763c0 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Copyright 2022-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs vdr-plugin-2

GENTOO_VDR_CONDITIONAL=yes

DESCRIPTION="VDR Plugin: Xinelib PlugIn"
HOMEPAGE="https://sourceforge.net/projects/xineliboutput/"
SRC_URI="https://downloads.sourceforge.net/${PN#vdr-}/${P}.tgz
		http://vdr.websitec.de/download/${PN}/${P}_clang.patch.bz2"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="bluray caps cec dbus fbcon jpeg nls opengl +vdr vaapi vdpau +X +xine xinerama"

COMMON_DEPEND="
	vdr? (
		media-video/vdr
		caps? ( sys-libs/libcap )
	)

	xine? (
		( >=media-libs/xine-lib-1.2
			media-video/ffmpeg )
		fbcon? ( jpeg? ( virtual/jpeg:* ) )
		X? (
			x11-libs/libX11
			x11-libs/libXext
			x11-libs/libXrender
			bluray? ( media-libs/libbluray )
			dbus? ( dev-libs/dbus-glib dev-libs/glib:2 )
			jpeg? ( virtual/jpeg:* )
			opengl? ( virtual/opengl )
			vaapi? ( media-libs/libva >=media-libs/xine-lib-1.2[vaapi] )
			vdpau? ( x11-libs/libvdpau >=media-libs/xine-lib-1.2[vdpau] )
			xinerama? ( x11-libs/libXinerama )
		)
	)"

DEPEND="${COMMON_DEPEND}
	sys-kernel/linux-headers
	nls? ( sys-devel/gettext )
	xine? (
		X? (
			x11-base/xorg-proto
			x11-libs/libXxf86vm
		)
	)"
RDEPEND="${COMMON_DEPEND}"
BDEPEND="virtual/pkgconfig"

REQUIRED_USE=" || ( vdr xine )"

VDR_CONFD_FILE="${FILESDIR}/confd-2.0.0"

pkg_setup() {
	vdr-plugin-2_pkg_setup

	if use xine; then
		XINE_PLUGIN_DIR=$($(tc-getPKG_CONFIG) --variable=plugindir libxine)
		[ -z "${XINE_PLUGIN_DIR}" ] && die "Could not find xine plugin dir"
	fi
}

src_prepare() {
	vdr-plugin-2_src_prepare

	# bug 711978
	sed -e "s:X11  opengl:X11  OpenGl:" -i configure || die

	# bug 771036,780462 do not call cc directly
	eapply "${FILESDIR}/${P}_no-gcc.patch"
	eapply "${WORKDIR}/${P}_clang.patch"
}

src_configure() {
	local myconf

	if has_version ">=media-libs/xine-lib-1.2"; then
		myconf="${myconf} --enable-libavutil"
	else
		myconf="${myconf} --disable-libavutil"
	fi

	# No autotools based configure script
	./configure \
		--cc="$(tc-getCC)" \
		--cxx="$(tc-getCXX)" \
		$(use_enable X x11) \
		$(use_enable X xshm) \
		$(use_enable X xdpms) \
		$(use_enable X xshape) \
		$(use_enable X xrandr) \
		$(use_enable X xrender) \
		$(use_enable fbcon fb) \
		$(use_enable vdr) \
		$(use_enable xine libxine) \
		--disable-libextractor \
		$(use_enable caps libcap) \
		$(use_enable cec libcec) \
		$(use_enable jpeg libjpeg) \
		$(use_enable xinerama) \
		$(use_enable dbus dbus-glib-1) \
		$(use_enable nls i18n) \
		$(use_enable bluray libbluray) \
		$(use_enable opengl) \
		${myconf} \
		|| die

	# UINT64_C is needed by ffmpeg headers
	append-cxxflags -D__STDC_CONSTANT_MACROS
}

src_install() {
	if use vdr; then
		vdr-plugin-2_src_install

		# bug 346989
		insinto /etc/vdr/plugins/xineliboutput/
		doins examples/allowed_hosts.conf
		fowners -R vdr:vdr /etc/vdr/

		if use nls; then
			emake DESTDIR="${D}" i18n
		fi

		if use xine; then
			doinitd "${FILESDIR}"/vdr-frontend

			insinto $XINE_PLUGIN_DIR
			doins xineplug_inp_xvdr.so

			insinto $XINE_PLUGIN_DIR/post
			doins xineplug_post_*.so

			if use fbcon; then
				dobin vdr-fbfe

				insinto $VDR_PLUGIN_DIR
				doins libxineliboutput-fbfe.so.*
			fi

			if use X; then
				dobin vdr-sxfe

				insinto $VDR_PLUGIN_DIR
				doins libxineliboutput-sxfe.so.*
			fi
		fi
	else
		emake DESTDIR="${D}" install

		dodoc HISTORY README
	fi
}