summaryrefslogtreecommitdiff
blob: 8cdda9dec39a390aa0653e12ac37c8f3d5cd1380 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/myth.eclass,v 1.14 2005/06/07 05:48:54 mr_bones_ Exp $
#
# Author: Daniel Ahlberg <aliz@gentoo.org>
#

#########################
########################
# DO NOT USE THIS FOR MYTHTV STUFF. Use mythtv-plugins.eclass
#####################
#####################

inherit multilib versionator toolchain-funcs

ECLASS=myth
INHERITED="${INHERITED} ${ECLASS}"
IUSE="${IUSE} nls debug"

EXPORT_FUNCTIONS src_unpack src_compile src_install

MYTHPLUGINS="mythbrowser mythdvd mythgallery mythgame mythmusic mythnews mythphone mythvideo mythweather mythweb"

atleast_0.18() {
	[[ $(get_version_component_range 1) > 0 || $(get_version_component_range 2) > 17 ]]
}

if atleast_0.18 && hasq ${PN} ${MYTHPLUGINS} ; then
	S="${WORKDIR}/mythplugins-${PV}"
fi

myth_src_unpack() {
	if atleast_0.18 && hasq ${PN} ${MYTHPLUGINS} ; then
		pkg_pro="mythplugins.pro"
	elif [ "${PN}" == "mythfrontend" ]; then
		pkg_pro="mythtv.pro"
	else
		pkg_pro="${PN}.pro"
	fi

	unpack ${A} ; cd ${S}

	sed -e "s:PREFIX = .*:PREFIX = /usr:" \
		-e "s:QMAKE_CXXFLAGS_RELEASE = .*:QMAKE_CXXFLAGS_RELEASE = ${CXXFLAGS}:" \
		-e "s:QMAKE_CFLAGS_RELEASE = .*:QMAKE_CFLAGS_RELEASE = ${CFLAGS}:" \
		-i 'settings.pro' || die "Initial setup failed"

	if ! use nls ; then
		sed -e "s:i18n::" \
		    -i ${pkg_pro} || die "Disable i18n failed"
	fi

        if use debug ; then
		FEATURES="${FEATURES} nostrip"
                sed -e 's:#CONFIG += debug:CONFIG += debug:' \
                    -e 's:CONFIG += release:#CONFIG += release:' \
                    -i 'settings.pro' || die "enable debug failed"
	fi

	setup_pro

	find ${S} -name '*.pro' -exec sed -i \
		-e "s:\$\${PREFIX}/lib/:\$\${PREFIX}/$(get_libdir)/:g" \
		-e "s:\$\${PREFIX}/lib$:\$\${PREFIX}/$(get_libdir):g" \
		{} \;
}

myth_src_compile() {
	export QMAKESPEC="linux-g++"

	if atleast_0.18 ; then
		if hasq ${PN} ${MYTHPLUGINS} ; then
			for x in ${MYTHPLUGINS} ; do
				if [[ ${PN} == ${x} ]] ; then
					myconf="${myconf} --enable-${x}"
				else
					myconf="${myconf} --disable-${x}"
				fi
			done
		fi 

		econf ${myconf}
	fi

	qmake -o "Makefile" "${S}/${pkg_pro}"
	emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" "${@}" || die
}

myth_src_install() {
	if atleast_0.18 && hasq ${PN} ${MYTHPLUGINS} ; then
		cd ${S}/${PN}
	fi

	einstall INSTALL_ROOT="${D}"
	for doc in AUTHORS COPYING FAQ UPGRADING ChangeLog README; do
		test -e "${doc}" && dodoc ${doc}
	done
}