summaryrefslogtreecommitdiff
blob: f7f95a98a7694f9108d6848fc80a1046232c76cf (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-demo/qt-demo-4.8.2.ebuild,v 1.4 2012/07/09 04:26:13 josejx Exp $

EAPI=4

inherit qt4-build

DESCRIPTION="Demonstration module and examples for the Qt toolkit"
SLOT="4"
if [[ ${QT4_BUILD_TYPE} == live ]]; then
	KEYWORDS=""
else
	KEYWORDS="amd64 ppc ppc64 ~x86 ~x64-macos"
fi
IUSE="dbus declarative kde multimedia opengl openvg qt3support webkit xmlpatterns"

DEPEND="
	~x11-libs/qt-assistant-${PV}:4[aqua=,c++0x=,debug=,qpa=]
	~x11-libs/qt-core-${PV}:4[aqua=,c++0x=,debug=,qpa=,qt3support?]
	~x11-libs/qt-gui-${PV}:4[aqua=,c++0x=,debug=,qpa=,qt3support?]
	~x11-libs/qt-script-${PV}:4[aqua=,c++0x=,debug=,qpa=]
	~x11-libs/qt-sql-${PV}:4[aqua=,c++0x=,debug=,qpa=,qt3support?]
	~x11-libs/qt-svg-${PV}:4[aqua=,c++0x=,debug=,qpa=]
	~x11-libs/qt-test-${PV}:4[aqua=,c++0x=,debug=,qpa=]
	dbus? ( ~x11-libs/qt-dbus-${PV}:4[aqua=,c++0x=,debug=,qpa=] )
	declarative? ( ~x11-libs/qt-declarative-${PV}:4[aqua=,c++0x=,debug=,qpa=,webkit?] )
	kde? ( media-libs/phonon[aqua=] )
	!kde? ( || (
		~x11-libs/qt-phonon-${PV}:4[aqua=,c++0x=,debug=,qpa=]
		media-libs/phonon[aqua=]
	) )
	multimedia? ( ~x11-libs/qt-multimedia-${PV}:4[aqua=,c++0x=,debug=,qpa=] )
	opengl? ( ~x11-libs/qt-opengl-${PV}:4[aqua=,c++0x=,debug=,qpa=,qt3support?] )
	openvg? ( ~x11-libs/qt-openvg-${PV}:4[aqua=,c++0x=,debug=,qpa=,qt3support?] )
	qt3support? ( ~x11-libs/qt-qt3support-${PV}:4[aqua=,c++0x=,debug=,qpa=] )
	webkit? ( ~x11-libs/qt-webkit-${PV}:4[aqua=,debug=,qpa=] )
	xmlpatterns? ( ~x11-libs/qt-xmlpatterns-${PV}:4[aqua=,c++0x=,debug=,qpa=] )
"
RDEPEND="${DEPEND}"

PATCHES=(
	"${FILESDIR}/${PN}-4.6-plugandpaint.patch"
)

pkg_setup() {
	QT4_TARGET_DIRECTORIES="
		demos
		examples"
	QT4_EXTRACT_DIRECTORIES="${QT4_TARGET_DIRECTORIES}
		doc/src/images
		src
		include
		tools"

	qt4-build_pkg_setup
}

src_prepare() {
	qt4-build_src_prepare

	# Array mapping USE flags to subdirs
	local flags_subdirs_map=(
		'dbus'
		'declarative:declarative'
		'multimedia:spectrum'
		'opengl:boxes|glhypnotizer'
		'openvg'
		'webkit:browser'
		'xmlpatterns'
	)

	# Disable unwanted examples/demos
	for flag in "${flags_subdirs_map[@]}"; do
		if ! use ${flag%:*}; then
			einfo "Disabling ${flag%:*} examples"
			sed -i -e "/SUBDIRS += ${flag%:*}/d" \
				examples/examples.pro || die

			if [[ ${flag} == *:* ]]; then
				einfo "Disabling ${flag%:*} demos"
				sed -i -re "/SUBDIRS \+= demos_(${flag#*:})/d" \
					demos/demos.pro || die
			fi
		fi
	done

	if ! use qt3support; then
		einfo "Disabling qt3support examples"
		sed -i -e '/QT_CONFIG, qt3support/d' \
			examples/graphicsview/graphicsview.pro || die
	fi
}

src_configure() {
	myconf+="
		$(qt_use dbus)
		$(qt_use declarative)
		$(qt_use multimedia)
		$(qt_use opengl)
		$(qt_use openvg)
		$(qt_use qt3support)
		$(qt_use webkit)
		$(qt_use xmlpatterns)"

	qt4-build_src_configure
}

src_install() {
	insinto "${QTDOCDIR#${EPREFIX}}"/src
	doins -r doc/src/images

	qt4-build_src_install
}