summaryrefslogtreecommitdiff
blob: 3c5a8f89f5b5f700634c42c12460390261659512 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/mythfrontend/mythfrontend-0.13.ebuild,v 1.4 2004/06/08 02:02:04 agriffis Exp $

inherit flag-o-matic

DESCRIPTION="Homebrew PVR project frontend."
HOMEPAGE="http://www.mythtv.org/"
SRC_URI="http://www.mythtv.org/mc/mythtv-${PV}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="alsa lcd lirc nvidia"

DEPEND="virtual/x11
	>=x11-libs/qt-3.1
	>=media-sound/lame-3.93.1
	>=media-libs/freetype-2.0
	>=sys-apps/sed-4
	alsa? ( media-libs/alsa-lib )
	lcd? ( app-misc/lcdproc )
	lirc? ( app-misc/lirc )
	nvidia? ( media-video/nvidia-glx )"

RDEPEND="${DEPEND}
	!media-tv/mythtv"

S="${WORKDIR}/mythtv-${PV}"

pkg_setup() {
	local qt_use="$(</var/db/pkg/`best_version x11-libs/qt`/USE)"
	if [ ! "`has mysql ${qt_use}`" ] ; then
		eerror "Qt is missing MySQL support. Please add"
		eerror "'mysql' to your USE flags, and re-emerge Qt."
		die "Qt needs mysql support"
	fi

	return 0
}

src_unpack() {
	unpack ${A}

	for i in `grep -lr "usr/local" "${S}"` ; do
		sed -e "s:usr/local:usr:g" -i "${i}" || die "sed failed"
	done
}

src_compile() {
	local cpu="`get-flag march || get-flag mcpu`"
	if [ "${cpu}" ] ; then
		sed -e "s:pentiumpro:${cpu}:g" -i "settings.pro" || die "sed failed"
	fi

	if use alsa ; then
		sed -e "s:#CONFIG += using_alsa:CONFIG += using_alsa:" \
			-e "s:#ALSA_LIBS = -lasound:ALSA_LIBS = -lasound:" \
			-i "settings.pro" || die "enable alsa sed failed"
	fi
	if use lcd ; then
		sed -e "s:#DEFINES += LCD_DEVICE:DEFINES += LCD_DEVICE:" \
			-i "settings.pro" || die "enable lcd sed failed"
	fi
	if use lirc ; then
		sed -e "s:#CONFIG += using_lirc:CONFIG += using_lirc:" \
			-e "s:#LIRC_LIBS = -llirc_client:LIRC_LIBS = -llirc_client:" \
			-i "settings.pro" || die "enable lirc sed failed"
	fi
	if use nvidia ; then
		sed -e "s:#CONFIG += using_xvmc:CONFIG += using_xvmc:" \
			-e "s:#EXTRA_LIBS += -lXvMCNVIDIA:EXTRA_LIBS += -lXvMCNVIDIA:" \
			-i "settings.pro" || die "enable xvmc sed failed"
	fi
	# Needs a VIA supported kernel driver.
	#if use via ; then
	#	sed -e "s:#CONFIG += using_via:CONFIG += using_via:"
	#		-e "s:#EXTRA_LIBS += -lddmpeg:EXTRA_LIBS += -lddmpeg:"
	#		-i "settings.pro" || die "enable lirc sed failed"
	#fi

	qmake -o "Makefile" "mythtv.pro"

	econf || die "econf failed"
	make || die "compile problem"
}

src_install() {
	einstall INSTALL_ROOT="${D}"

	dodir /etc/mythtv
	mv "${D}/usr/share/mythtv/mysql.txt" "${D}/etc/mythtv"
	dosym /etc/mythtv/mysql.txt /usr/share/mythtv/mysql.txt

	rm -rf "${D}"/usr/bin/myth{backend,commflag,filldatabase,transcode} \
		"${D}/usr/share/mythtv/setup.xml"

	dodoc AUTHORS COPYING FAQ README UPGRADING keys.txt docs/*.{txt,pdf}
	dohtml docs/*.html
}