dev-ruby/rspec-core: add 3.8.2
[gentoo.git] / dev-python / PyQt5 / PyQt5-5.10.1-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
7 inherit multibuild python-r1 qmake-utils
8
9 DESCRIPTION="Python bindings for the Qt framework"
10 HOMEPAGE="https://www.riverbankcomputing.com/software/pyqt/intro"
11
12 MY_PN=PyQt5
13 MY_P=${MY_PN}_gpl-${PV/_pre/.dev}
14 if [[ ${PV} == *_pre* ]]; then
15         SRC_URI="https://dev.gentoo.org/~pesa/distfiles/${MY_P}.tar.gz"
16 else
17         SRC_URI="https://www.riverbankcomputing.com/static/Downloads/${MY_PN}/${PV}/${MY_P}.tar.gz"
18 fi
19
20 LICENSE="GPL-3"
21 SLOT="0"
22 KEYWORDS="amd64 arm arm64 ~ppc ~ppc64 x86"
23
24 # TODO: QtNetworkAuth, QtNfc
25 IUSE="bluetooth dbus debug declarative designer examples gles2 gui help location
26         multimedia network opengl positioning printsupport sensors serialport sql svg
27         testlib webchannel webengine webkit websockets widgets x11extras xmlpatterns"
28
29 # The requirements below were extracted from configure.py
30 # and from the output of 'grep -r "%Import " "${S}"/sip'
31 REQUIRED_USE="
32         ${PYTHON_REQUIRED_USE}
33         bluetooth? ( gui )
34         declarative? ( gui network )
35         designer? ( widgets )
36         help? ( gui widgets )
37         location? ( positioning )
38         multimedia? ( gui network )
39         opengl? ( gui widgets )
40         positioning? ( gui )
41         printsupport? ( gui widgets )
42         sensors? ( gui )
43         serialport? ( gui )
44         sql? ( widgets )
45         svg? ( gui widgets )
46         testlib? ( widgets )
47         webchannel? ( network )
48         webengine? ( network widgets? ( printsupport webchannel ) )
49         webkit? ( gui network printsupport widgets )
50         websockets? ( network )
51         widgets? ( gui )
52         xmlpatterns? ( network )
53 "
54
55 # Minimal supported version of Qt.
56 QT_PV="5.9.4:5"
57
58 RDEPEND="
59         ${PYTHON_DEPS}
60         >=dev-python/sip-4.19.6:=[${PYTHON_USEDEP}]
61         >=dev-qt/qtcore-${QT_PV}
62         >=dev-qt/qtxml-${QT_PV}
63         bluetooth? ( >=dev-qt/qtbluetooth-${QT_PV} )
64         dbus? (
65                 dev-python/dbus-python[${PYTHON_USEDEP}]
66                 >=dev-qt/qtdbus-${QT_PV}
67         )
68         declarative? ( >=dev-qt/qtdeclarative-${QT_PV}[widgets?] )
69         designer? ( >=dev-qt/designer-${QT_PV} )
70         gui? ( >=dev-qt/qtgui-${QT_PV}[gles2=] )
71         help? ( >=dev-qt/qthelp-${QT_PV} )
72         location? ( >=dev-qt/qtlocation-${QT_PV} )
73         multimedia? ( >=dev-qt/qtmultimedia-${QT_PV}[widgets?] )
74         network? ( >=dev-qt/qtnetwork-${QT_PV} )
75         opengl? ( >=dev-qt/qtopengl-${QT_PV} )
76         positioning? ( >=dev-qt/qtpositioning-${QT_PV} )
77         printsupport? ( >=dev-qt/qtprintsupport-${QT_PV} )
78         sensors? ( >=dev-qt/qtsensors-${QT_PV} )
79         serialport? ( >=dev-qt/qtserialport-${QT_PV} )
80         sql? ( >=dev-qt/qtsql-${QT_PV} )
81         svg? ( >=dev-qt/qtsvg-${QT_PV} )
82         testlib? ( >=dev-qt/qttest-${QT_PV} )
83         webchannel? ( >=dev-qt/qtwebchannel-${QT_PV} )
84         webengine? ( >=dev-qt/qtwebengine-${QT_PV}[widgets?] )
85         webkit? ( >=dev-qt/qtwebkit-5.9:5[printsupport] )
86         websockets? ( >=dev-qt/qtwebsockets-${QT_PV} )
87         widgets? ( >=dev-qt/qtwidgets-${QT_PV} )
88         x11extras? ( >=dev-qt/qtx11extras-${QT_PV} )
89         xmlpatterns? ( >=dev-qt/qtxmlpatterns-${QT_PV} )
90 "
91 DEPEND="${RDEPEND}
92         dbus? ( virtual/pkgconfig )
93 "
94
95 S=${WORKDIR}/${MY_P}
96
97 DOCS=( "${S}"/{ChangeLog,NEWS} )
98
99 PATCHES=(
100         "${FILESDIR}/${P}-timeline.patch"
101         "${FILESDIR}/${P}-fix-testlib.patch"
102 )
103
104 pyqt_use_enable() {
105         use "$1" || return
106
107         if [[ $# -eq 1 ]]; then
108                 echo --enable=Qt$(tr 'a-z' 'A-Z' <<< ${1:0:1})${1:1}
109         else
110                 shift
111                 echo ${@/#/--enable=}
112         fi
113 }
114
115 src_configure() {
116         configuration() {
117                 local myconf=(
118                         "${PYTHON}"
119                         "${S}"/configure.py
120                         $(usex debug '--debug --qml-debug --trace' '')
121                         --verbose
122                         --confirm-license
123                         --qmake="$(qt5_get_bindir)"/qmake
124                         --bindir="${EPREFIX}/usr/bin"
125                         --destdir="$(python_get_sitedir)"
126                         --sip-incdir="$(python_get_includedir)"
127                         --qsci-api
128                         --enable=QtCore
129                         --enable=QtXml
130                         $(pyqt_use_enable bluetooth)
131                         $(pyqt_use_enable dbus QtDBus)
132                         $(usex dbus '' --no-python-dbus)
133                         $(pyqt_use_enable declarative QtQml QtQuick $(usex widgets QtQuickWidgets ''))
134                         $(usex declarative '' --no-qml-plugin)
135                         $(pyqt_use_enable designer)
136                         $(usex designer '' --no-designer-plugin)
137                         $(pyqt_use_enable gui)
138                         $(pyqt_use_enable gui $(use gles2 && echo _QOpenGLFunctions_ES2 || echo _QOpenGLFunctions_{2_0,2_1,4_1_Core}))
139                         $(pyqt_use_enable help)
140                         $(pyqt_use_enable location)
141                         $(pyqt_use_enable multimedia QtMultimedia $(usex widgets QtMultimediaWidgets ''))
142                         $(pyqt_use_enable network)
143                         $(pyqt_use_enable opengl QtOpenGL)
144                         $(pyqt_use_enable positioning)
145                         $(pyqt_use_enable printsupport QtPrintSupport)
146                         $(pyqt_use_enable sensors)
147                         $(pyqt_use_enable serialport QtSerialPort)
148                         $(pyqt_use_enable sql)
149                         $(pyqt_use_enable svg)
150                         $(pyqt_use_enable testlib QtTest)
151                         $(pyqt_use_enable webchannel QtWebChannel)
152                         $(pyqt_use_enable webengine QtWebEngine QtWebEngineCore $(usex widgets QtWebEngineWidgets ''))
153                         $(pyqt_use_enable webkit QtWebKit QtWebKitWidgets)
154                         $(pyqt_use_enable websockets QtWebSockets)
155                         $(pyqt_use_enable widgets)
156                         $(pyqt_use_enable x11extras QtX11Extras)
157                         $(pyqt_use_enable xmlpatterns QtXmlPatterns)
158                 )
159                 echo "${myconf[@]}"
160                 "${myconf[@]}" || die
161
162                 eqmake5 -recursive ${MY_PN}.pro
163         }
164         python_foreach_impl run_in_build_dir configuration
165 }
166
167 src_compile() {
168         python_foreach_impl run_in_build_dir default
169 }
170
171 src_install() {
172         installation() {
173                 local tmp_root=${D%/}/${PN}_tmp_root
174                 emake INSTALL_ROOT="${tmp_root}" install
175
176                 local bin_dir=${tmp_root}${EPREFIX}/usr/bin
177                 local exe
178                 for exe in pylupdate5 pyrcc5 pyuic5; do
179                         python_doexe "${bin_dir}/${exe}"
180                         rm "${bin_dir}/${exe}" || die
181                 done
182
183                 local uic_dir=${tmp_root}$(python_get_sitedir)/${PN}/uic
184                 if python_is_python3; then
185                         rm -r "${uic_dir}"/port_v2 || die
186                 else
187                         rm -r "${uic_dir}"/port_v3 || die
188                 fi
189
190                 multibuild_merge_root "${tmp_root}" "${D}"
191                 python_optimize
192         }
193         python_foreach_impl run_in_build_dir installation
194
195         einstalldocs
196
197         if use examples; then
198                 insinto /usr/share/doc/${PF}
199                 doins -r examples
200         fi
201 }