summaryrefslogtreecommitdiff
blob: 21ed0b6b21b9dc1088d22b45239794b53808517e (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
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit qt4-build-multilib

DESCRIPTION="Demonstration module and examples for the Qt toolkit"

if [[ ${QT4_BUILD_TYPE} == release ]]; then
	KEYWORDS="amd64 ~arm ~ppc ~ppc64 x86"
fi

IUSE="dbus declarative multimedia opengl phonon webkit xmlpatterns"

DEPEND="
	~dev-qt/designer-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qtcore-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qtgui-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qthelp-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qtscript-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qtsql-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qtsvg-${PV}[debug=,${MULTILIB_USEDEP}]
	~dev-qt/qttest-${PV}[debug=,${MULTILIB_USEDEP}]
	dbus? ( ~dev-qt/qtdbus-${PV}[debug=,${MULTILIB_USEDEP}] )
	declarative? ( ~dev-qt/qtdeclarative-${PV}[debug=,webkit?,${MULTILIB_USEDEP}] )
	multimedia? ( ~dev-qt/qtmultimedia-${PV}[debug=,${MULTILIB_USEDEP}] )
	opengl? ( ~dev-qt/qtopengl-${PV}[debug=,${MULTILIB_USEDEP}] )
	phonon? ( >=media-libs/phonon-4.8.3-r1[qt4,${MULTILIB_USEDEP}] )
	webkit? ( >=dev-qt/qtwebkit-${PV}:4[debug=,${MULTILIB_USEDEP}] )
	xmlpatterns? ( ~dev-qt/qtxmlpatterns-${PV}[debug=,${MULTILIB_USEDEP}] )
"
RDEPEND="${DEPEND}"

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

QT4_TARGET_DIRECTORIES="
	demos
	examples"

src_prepare() {
	qt4-build-multilib_src_prepare

	# Array mapping USE flags to subdirs
	local flags_subdirs_map=(
		'dbus'
		'declarative:declarative'
		'multimedia:spectrum'
		'opengl:boxes|glhypnotizer'
		'phonon:mediaplayer'
		'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

	# Remove bogus dependency on qt3support (bug 510042)
	sed -i -e 's/contains(QT_CONFIG, qt3support)://' \
		examples/graphicsview/graphicsview.pro || die
}

multilib_src_configure() {
	local myconf=(
		$(qt_use dbus)
		$(qt_use declarative)
		$(qt_use multimedia) -no-audio-backend
		$(qt_use opengl)
		-no-openvg
		$(qt_use phonon) -no-phonon-backend
		$(qt_use webkit)
		$(qt_use xmlpatterns)
	)
	qt4_multilib_src_configure
}