Use https by default
[gentoo.git] / dev-python / PyQt5 / PyQt5-5.4.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7
8 inherit eutils multibuild multilib python-r1 qmake-utils
9
10 DESCRIPTION="Python bindings for the Qt framework"
11 HOMEPAGE="http://www.riverbankcomputing.com/software/pyqt/intro
12         https://pypi.python.org/pypi/PyQt5"
13
14 MY_PN="PyQt-gpl"
15 if [[ ${PV} == *_pre* ]]; then
16         MY_P=${MY_PN}-${PV%_pre*}-snapshot-${REVISION}
17         SRC_URI="https://dev.gentoo.org/~pesa/distfiles/${MY_P}.tar.xz"
18 else
19         MY_P=${MY_PN}-${PV}
20         SRC_URI="mirror://sourceforge/pyqt/${MY_P}.tar.gz"
21 fi
22
23 LICENSE="GPL-3"
24 SLOT="0"
25 KEYWORDS="~amd64 ~arm ~x86"
26
27 # TODO: QtBluetooth, QtWebEngineWidgets
28 IUSE="dbus debug declarative designer doc examples gles2 gui help multimedia
29         network opengl positioning printsupport sensors serialport sql svg
30         testlib webchannel webkit websockets widgets x11extras xmlpatterns"
31 REQUIRED_USE="
32         ${PYTHON_REQUIRED_USE}
33         positioning? ( gui )
34         sensors? ( gui )
35         serialport? ( gui )
36         sql? ( widgets )
37         testlib? ( widgets )
38         webchannel? ( network )
39 "
40
41 # Minimal supported version of Qt.
42 QT_PV="5.4.2:5"
43
44 RDEPEND="
45         ${PYTHON_DEPS}
46         >=dev-python/sip-4.16.6:=[${PYTHON_USEDEP}]
47         >=dev-qt/qtcore-${QT_PV}
48         >=dev-qt/qtxml-${QT_PV}
49         dbus? (
50                 dev-python/dbus-python[${PYTHON_USEDEP}]
51                 >=dev-qt/qtdbus-${QT_PV}
52         )
53         declarative? ( >=dev-qt/qtdeclarative-${QT_PV}[widgets?] )
54         designer? ( >=dev-qt/designer-${QT_PV} )
55         gui? ( >=dev-qt/qtgui-${QT_PV}[gles2=] )
56         help? ( >=dev-qt/qthelp-${QT_PV} )
57         multimedia? ( >=dev-qt/qtmultimedia-${QT_PV}[widgets?] )
58         network? ( >=dev-qt/qtnetwork-${QT_PV} )
59         opengl? ( >=dev-qt/qtopengl-${QT_PV} )
60         positioning? ( >=dev-qt/qtpositioning-${QT_PV} )
61         printsupport? ( >=dev-qt/qtprintsupport-${QT_PV} )
62         sensors? ( >=dev-qt/qtsensors-${QT_PV} )
63         serialport? ( >=dev-qt/qtserialport-${QT_PV} )
64         sql? ( >=dev-qt/qtsql-${QT_PV} )
65         svg? ( >=dev-qt/qtsvg-${QT_PV} )
66         testlib? ( >=dev-qt/qttest-${QT_PV} )
67         webchannel? ( >=dev-qt/qtwebchannel-${QT_PV} )
68         webkit? ( >=dev-qt/qtwebkit-${QT_PV}[printsupport] )
69         websockets? ( >=dev-qt/qtwebsockets-${QT_PV} )
70         widgets? ( >=dev-qt/qtwidgets-${QT_PV} )
71         x11extras? ( >=dev-qt/qtx11extras-${QT_PV} )
72         xmlpatterns? ( >=dev-qt/qtxmlpatterns-${QT_PV} )
73 "
74 DEPEND="${RDEPEND}
75         dbus? ( virtual/pkgconfig )
76 "
77
78 S=${WORKDIR}/${MY_P}
79
80 src_prepare() {
81         # Avoid automagic dependency.
82         use dbus || rm -fr dbus
83 }
84
85 pyqt_use_enable() {
86         use "$1" || return
87
88         if [[ $# -eq 1 ]]; then
89                 echo --enable=Qt$(tr 'a-z' 'A-Z' <<< ${1:0:1})${1:1}
90         else
91                 shift
92                 echo ${@/#/--enable=}
93         fi
94 }
95
96 src_configure() {
97         configuration() {
98                 local myconf=(
99                         "${PYTHON}"
100                         "${S}"/configure.py
101                         $(use debug && echo --debug --trace)
102                         --verbose
103                         --confirm-license
104                         --qmake="$(qt5_get_bindir)"/qmake
105                         --destdir="$(python_get_sitedir)"
106                         --qsci-api
107                         --enable=QtCore
108                         --enable=QtXml
109                         $(pyqt_use_enable dbus QtDBus)
110                         $(pyqt_use_enable declarative QtQml QtQuick $(usex widgets QtQuickWidgets ''))
111                         $(usex declarative '' --no-qml-plugin)
112                         $(pyqt_use_enable designer)
113                         $(usex designer '' --no-designer-plugin)
114                         $(pyqt_use_enable gui)
115                         $(pyqt_use_enable gui $(use gles2 && echo _QOpenGLFunctions_ES2 || echo _QOpenGLFunctions_{2_0,2_1,4_1_Core}))
116                         $(pyqt_use_enable help)
117                         $(pyqt_use_enable multimedia QtMultimedia $(usex widgets QtMultimediaWidgets ''))
118                         $(pyqt_use_enable network)
119                         $(pyqt_use_enable opengl QtOpenGL)
120                         $(pyqt_use_enable positioning)
121                         $(pyqt_use_enable printsupport QtPrintSupport)
122                         $(pyqt_use_enable sensors)
123                         $(pyqt_use_enable serialport QtSerialPort)
124                         $(pyqt_use_enable sql)
125                         $(pyqt_use_enable svg)
126                         $(pyqt_use_enable testlib QtTest)
127                         $(pyqt_use_enable webchannel QtWebChannel)
128                         $(pyqt_use_enable webkit QtWebKit QtWebKitWidgets)
129                         $(pyqt_use_enable websockets QtWebSockets)
130                         $(pyqt_use_enable widgets)
131                         $(pyqt_use_enable x11extras QtX11Extras)
132                         $(pyqt_use_enable xmlpatterns QtXmlPatterns)
133                 )
134                 echo "${myconf[@]}"
135                 "${myconf[@]}" || die
136
137                 eqmake5 -recursive ${PN}.pro
138         }
139         python_foreach_impl run_in_build_dir configuration
140 }
141
142 src_compile() {
143         python_foreach_impl run_in_build_dir default
144 }
145
146 src_install() {
147         installation() {
148                 local tmp_root=${D%/}/tmp
149                 emake INSTALL_ROOT="${tmp_root}" install
150
151                 local uic_dir=${tmp_root}$(python_get_sitedir)/${PN}/uic
152                 if python_is_python3; then
153                         rm -r "${uic_dir}"/port_v2 || die
154                 else
155                         rm -r "${uic_dir}"/port_v3 || die
156                 fi
157
158                 python_doexe "${tmp_root}${EPREFIX}"/usr/bin/pyuic5
159                 rm "${tmp_root}${EPREFIX}"/usr/bin/pyuic5 || die
160
161                 multibuild_merge_root "${tmp_root}" "${D}"
162                 python_optimize
163         }
164         python_foreach_impl run_in_build_dir installation
165
166         dodoc ChangeLog NEWS
167
168         if use doc; then
169                 dodoc -r doc/html
170         fi
171
172         if use examples; then
173                 insinto /usr/share/doc/${PF}
174                 doins -r examples
175         fi
176 }