1 |
# Copyright 1999-2006 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mythtv-plugins.eclass,v 1.12 2006/02/27 07:59:57 cardoe Exp $ |
4 |
# |
5 |
# Author: Doug Goldstein <cardoe@gentoo.org> |
6 |
# |
7 |
# Installs MythTV plugins along with patches from the release-${PV}-fixes branch |
8 |
# |
9 |
inherit eutils multilib qt3 versionator |
10 |
|
11 |
# Extra configure options to pass to econf |
12 |
MTVCONF=${MTVCONF:=""} |
13 |
|
14 |
# Release version |
15 |
MY_PV="${PV%_*}" |
16 |
|
17 |
# SVN revision number to increment from the released version |
18 |
if [ "x${MY_PV}" != "x${PV}" ]; then |
19 |
PATCHREV="${PV##*_p}" |
20 |
fi |
21 |
|
22 |
DESCRIPTION=${DESCRIPTION:="MythTV plugin"} |
23 |
HOMEPAGE="http://www.mythtv.org" |
24 |
SRC_URI="http://ftp-osl.osuosl.org/pub/mythtv/mythplugins-${MY_PV}.tar.bz2" |
25 |
if [ -n "${PATCHREV}" ] ; then |
26 |
SRC_URI="${SRC_URI} http://dev.gentoo.org/~cardoe/files/mythtv/mythplugins-${MY_PV}_svn${PATCHREV}.patch.bz2" |
27 |
fi |
28 |
|
29 |
|
30 |
LICENSE="GPL-2" |
31 |
SLOT="0" |
32 |
IUSE="debug mmx" |
33 |
|
34 |
RDEPEND="${RDEPEND} |
35 |
=media-tv/mythtv-${MY_PV}*" |
36 |
DEPEND="${DEPEND} |
37 |
=media-tv/mythtv-${MY_PV}* |
38 |
>=sys-apps/sed-4" |
39 |
|
40 |
S="${WORKDIR}/mythplugins-${MY_PV}" |
41 |
|
42 |
mythtv-plugins_pkg_setup() { |
43 |
# List of available plugins (needs to include ALL of them in the tarball) |
44 |
MYTHPLUGINS="mythbrowser mythcontrols mythdvd mythflix mythgallery" |
45 |
MYTHPLUGINS="${MYTHPLUGINS} mythgame mythmusic mythnews mythphone" |
46 |
MYTHPLUGINS="${MYTHPLUGINS} mythvideo mythweather mythweb" |
47 |
|
48 |
if version_is_at_least "0.20" ; then |
49 |
MYTHPLUGINS="${MYTHPLUGINS} mytharchive" |
50 |
fi |
51 |
} |
52 |
|
53 |
mythtv-plugins_src_unpack() { |
54 |
unpack ${A} |
55 |
cd "${S}" |
56 |
|
57 |
sed -e 's!PREFIX = /usr/local!PREFIX = /usr!' \ |
58 |
-i 'settings.pro' || die "fixing PREFIX to /usr failed" |
59 |
|
60 |
sed -e "s!QMAKE_CXXFLAGS_RELEASE = -O3 -march=pentiumpro -fomit-frame-pointer!QMAKE_CXXFLAGS_RELEASE = ${CXXFLAGS}!" \ |
61 |
-i 'settings.pro' || die "Fixing QMake's CXXFLAGS failed" |
62 |
|
63 |
sed -e "s!QMAKE_CFLAGS_RELEASE = \$\${QMAKE_CXXFLAGS_RELEASE}!QMAKE_CFLAGS_RELEASE = ${CFLAGS}!" \ |
64 |
-i 'settings.pro' || die "Fixing Qmake's CFLAGS failed" |
65 |
|
66 |
find "${S}" -name '*.pro' -exec sed -i \ |
67 |
-e "s:\$\${PREFIX}/lib/:\$\${PREFIX}/$(get_libdir)/:g" \ |
68 |
-e "s:\$\${PREFIX}/lib$:\$\${PREFIX}/$(get_libdir):g" \ |
69 |
{} \; |
70 |
|
71 |
if [ -n "$PATCHREV" ]; then |
72 |
patch -p0 < ${WORKDIR}/mythplugins-${MY_PV}_svn${PATCHREV}.patch |
73 |
fi |
74 |
} |
75 |
|
76 |
mythtv-plugins_src_compile() { |
77 |
cd "${S}" |
78 |
|
79 |
if use debug; then |
80 |
sed -e 's!CONFIG += release!CONFIG += debug!' \ |
81 |
-i 'settings.pro' || die "switching to debug build failed" |
82 |
fi |
83 |
|
84 |
# if ( use x86 && ! use mmx ) || ! use amd64 ; then |
85 |
if ( ! use mmx ); then |
86 |
sed -e 's!DEFINES += HAVE_MMX!DEFINES -= HAVE_MMX!' \ |
87 |
-i 'settings.pro' || die "disabling MMX failed" |
88 |
fi |
89 |
|
90 |
local myconf="" |
91 |
|
92 |
if hasq ${PN} ${MYTHPLUGINS} ; then |
93 |
for x in ${MYTHPLUGINS} ; do |
94 |
if [[ ${PN} == ${x} ]] ; then |
95 |
myconf="${myconf} --enable-${x}" |
96 |
else |
97 |
myconf="${myconf} --disable-${x}" |
98 |
fi |
99 |
done |
100 |
else |
101 |
die "Package ${PN} is unsupported" |
102 |
fi |
103 |
|
104 |
econf ${myconf} ${MTVCONF} |
105 |
|
106 |
${QTDIR}/bin/qmake QMAKE="${QTDIR}/bin/qmake" -o "Makefile" mythplugins.pro || die "qmake failed to run" |
107 |
emake || die "make failed to compile" |
108 |
} |
109 |
|
110 |
mythtv-plugins_src_install() { |
111 |
debug-print ${MYTHPLUGINS} |
112 |
if hasq ${PN} ${MYTHPLUGINS} ; then |
113 |
cd "${S}"/${PN} |
114 |
else |
115 |
die "Package ${PN} is unsupported" |
116 |
fi |
117 |
|
118 |
einstall INSTALL_ROOT="${D}" |
119 |
for doc in AUTHORS COPYING FAQ UPGRADING ChangeLog README; do |
120 |
test -e "${doc}" && dodoc ${doc} |
121 |
done |
122 |
} |
123 |
|
124 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install |