aboutsummaryrefslogtreecommitdiff
blob: f09cd6105f43f137b59f998174d8d659b1d43ab9 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 python3_{4,5,6} )

inherit cmake-utils python-r1 virtualx git-r3

DESCRIPTION="Python bindings for the Qt framework"
HOMEPAGE="https://wiki.qt.io/PySide2"
EGIT_REPO_URI=(
	"git://code.qt.io/pyside/${PN}.git"
	"https://code.qt.io/git/pyside/${PN}.git"
)
#FIXME: Switch to the clang-enabled "dev" branch once stable.
EGIT_BRANCH="5.6"

LICENSE="|| ( GPL-2+ LGPL-3 )"
SLOT="2"
KEYWORDS=""

IUSE="concurrent declarative designer gui help multimedia network opengl
	printsupport script scripttools sql svg test testlib webchannel
	webengine webkit websockets widgets x11extras xmlpatterns"

# The requirements below were strongly inspired by their PyQt5 equivalents.
REQUIRED_USE="
	${PYTHON_REQUIRED_USE}
	declarative? ( gui network )
	designer? ( widgets )
	help? ( widgets )
	multimedia? ( gui network )
	opengl? ( widgets )
	printsupport? ( widgets )
	scripttools? ( gui script )
	sql? ( widgets )
	svg? ( widgets )
	test? ( widgets )
	testlib? ( widgets )
	webchannel? ( network )
	webengine? ( network webchannel widgets )
	webkit? ( gui network printsupport widgets )
	websockets? ( network )
	widgets? ( gui )
	xmlpatterns? ( network )
"

# Minimum version of Qt required, derived from the CMakeLists.txt line:
#   find_package(Qt5 ${QT_PV} REQUIRED COMPONENTS Core)
QT_PV="5.6*:5"

RDEPEND="
	${PYTHON_DEPS}
	>=dev-python/shiboken-${PV}:${SLOT}[${PYTHON_USEDEP}]
	=dev-qt/qtcore-${QT_PV}
	=dev-qt/qtxml-${QT_PV}
	declarative? ( =dev-qt/qtdeclarative-${QT_PV}[widgets?] )
	designer? ( =dev-qt/designer-${QT_PV} )
	help? ( =dev-qt/qthelp-${QT_PV} )
	multimedia? ( =dev-qt/qtmultimedia-${QT_PV}[widgets?] )
	opengl? ( =dev-qt/qtopengl-${QT_PV} )
	printsupport? ( =dev-qt/qtprintsupport-${QT_PV} )
	script? ( =dev-qt/qtscript-${QT_PV} )
	sql? ( =dev-qt/qtsql-${QT_PV} )
	svg? ( =dev-qt/qtsvg-${QT_PV} )
	testlib? ( =dev-qt/qttest-${QT_PV} )
	webchannel? ( =dev-qt/qtwebchannel-${QT_PV} )
	webengine? ( =dev-qt/qtwebengine-${QT_PV}[widgets?] )
	webkit? ( =dev-qt/qtwebkit-${QT_PV}[printsupport] )
	websockets? ( =dev-qt/qtwebsockets-${QT_PV} )
	x11extras? ( =dev-qt/qtx11extras-${QT_PV} )
	xmlpatterns? ( =dev-qt/qtxmlpatterns-${QT_PV} )
	concurrent? ( =dev-qt/qtconcurrent-${QT_PV} )
	gui? ( =dev-qt/qtgui-${QT_PV} )
	network? ( =dev-qt/qtnetwork-${QT_PV} )
	printsupport? ( =dev-qt/qtprintsupport-${QT_PV} )
	sql? ( =dev-qt/qtsql-${QT_PV} )
	testlib? ( =dev-qt/qttest-${QT_PV} )
	widgets? ( =dev-qt/qtwidgets-${QT_PV} )
"
DEPEND="${RDEPEND}"

src_prepare() {
	#FIXME: Remove the following "sed" patch after this upstream issue is closed:
	#    https://bugreports.qt.io/browse/PYSIDE-502
	# Force the optional "Qt5Concurrent", "Qt5Gui", "Qt5Network",
	# "Qt5PrintSupport", "Qt5Sql", "Qt5Test", and "Qt5Widgets" packages
	# erroneously marked as mandatory to be optional.
	sed -i -e 's/^\(CHECK_PACKAGE_FOUND(Qt5\(Concurrent\|Gui\|Network\|PrintSupport\|Sql\|Test\|Widgets\)\))$/\1 opt)/' \
		PySide2/CMakeLists.txt || die

	if use prefix; then
		cp "${FILESDIR}"/rpath.cmake . || die
		sed -i -e '1iinclude(rpath.cmake)' CMakeLists.txt || die
	fi

	cmake-utils_src_prepare
}

src_configure() {
	# For each line of the form "CHECK_PACKAGE_FOUND(${PACKAGE_NAME} opt)" in
	# PySide2/CMakeLists.txt defining an optional dependency, an option of the
	# form "-DCMAKE_DISABLE_FIND_PACKAGE_${PACKAGE_NAME}=$(usex !${USE_FLAG})"
	# is passed to "cmake" here conditionally disabling this dependency.
	local mycmakeargs=(
		-DBUILD_TESTS=$(usex test)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Concurrent=$(usex !concurrent)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Gui=$(usex !gui)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Designer=$(usex !designer)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5UiTools=$(usex !designer)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Help=$(usex !help)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Multimedia=$(usex !multimedia)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Network=$(usex !network)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5OpenGL=$(usex !opengl)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Qml=$(usex !declarative)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Quick=$(usex !declarative)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5QuickWidgets=$(usex !declarative)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5PrintSupport=$(usex !printsupport)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Script=$(usex !script)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5ScriptTools=$(usex !scripttools)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Sql=$(usex !sql)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Svg=$(usex !svg)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=$(usex !testlib)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebChannel=$(usex !webchannel)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebEngine=$(usex !webengine)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebEngineWidgets=$(usex !webengine)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebKit=$(usex !webkit)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebKitWidgets=$(usex !webkit)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5WebSockets=$(usex !websockets)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=$(usex !widgets)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5X11Extras=$(usex !x11extras)
		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5XmlPatterns=$(usex !xmlpatterns)
	)

	configuration() {
		local mycmakeargs=(
			"${mycmakeargs[@]}"
		)
		cmake-utils_src_configure
	}
	python_foreach_impl configuration
}

src_compile() {
	python_foreach_impl cmake-utils_src_compile
}

src_test() {
	local -x PYTHONDONTWRITEBYTECODE
	python_foreach_impl virtx cmake-utils_src_test
}

src_install() {
	installation() {
		cmake-utils_src_install
		mv "${ED}"usr/$(get_libdir)/pkgconfig/${PN}2{,-${EPYTHON}}.pc || die
	}
	python_foreach_impl installation
}