From aaa8feb151f0b5cd415ab4bdf052b11f9d71fb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= Date: Sat, 22 Nov 2014 13:29:38 +0100 Subject: [PATCH] [dev-python/PyQt4-pyqtconfig] new package To be able to compile app-text/calibre, see Gentoo bug 526524. It is not intended to be distributed as a package. It can be removed if at least one of the following conditions is met: - we use PyQt5 and app-text/calibre-2.*, - someone patches Calibre, - someone patches PyQt4. --- dev-python/PyQt4-pyqtconfig/Manifest | 1 + .../PyQt4-pyqtconfig-4.11.3.ebuild | 192 ++++++++++++++ .../PyQt4-4.7.3-qreal_float_support.patch | 239 ++++++++++++++++++ dev-python/PyQt4-pyqtconfig/metadata.xml | 30 +++ 4 files changed, 462 insertions(+) create mode 100644 dev-python/PyQt4-pyqtconfig/Manifest create mode 100644 dev-python/PyQt4-pyqtconfig/PyQt4-pyqtconfig-4.11.3.ebuild create mode 100644 dev-python/PyQt4-pyqtconfig/files/PyQt4-4.7.3-qreal_float_support.patch create mode 100644 dev-python/PyQt4-pyqtconfig/metadata.xml diff --git a/dev-python/PyQt4-pyqtconfig/Manifest b/dev-python/PyQt4-pyqtconfig/Manifest new file mode 100644 index 000000000..5e52ed92c --- /dev/null +++ b/dev-python/PyQt4-pyqtconfig/Manifest @@ -0,0 +1 @@ +DIST PyQt-x11-gpl-4.11.3.tar.gz 11120237 SHA256 853780dcdbe2e6ba785d703d059b096e1fc49369d3e8d41a060be874b8745686 SHA512 48264bed71a0c9662c2903a7cf1ed0263f18b3b69e5b9639b6a006f3cf72bc9766e786788c46046546d1676b221ed2ab29d2ec7fe57057ea9b84cede5ee7622c WHIRLPOOL 1c0f7ecd9f845ec1887ebd0c5b4473bc9be19c074aa8d0c3203c7ccdc0fbd16c4f247f80ba81ab491ef06cefaae704adb1da5da99d658826e941db398c920570 diff --git a/dev-python/PyQt4-pyqtconfig/PyQt4-pyqtconfig-4.11.3.ebuild b/dev-python/PyQt4-pyqtconfig/PyQt4-pyqtconfig-4.11.3.ebuild new file mode 100644 index 000000000..1b7486ce9 --- /dev/null +++ b/dev-python/PyQt4-pyqtconfig/PyQt4-pyqtconfig-4.11.3.ebuild @@ -0,0 +1,192 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# based on PyQt4-4.11.2.ebuild which uses configure.py + +EAPI=5 +PYTHON_COMPAT=( python{2_7,3_3,3_4} ) + +inherit eutils multibuild python-r1 qmake-utils toolchain-funcs + +DESCRIPTION="Hack to provide pyqtconfig.py" +HOMEPAGE="http://www.riverbankcomputing.co.uk/software/pyqt/intro/ https://pypi.python.org/pypi/PyQt4" + +if [[ ${PV} == *_pre* ]]; then + MY_P="PyQt-x11-gpl-snapshot-${PV%_pre*}-${REVISION}" + SRC_URI="http://dev.gentoo.org/~hwoarang/distfiles/${MY_P}.tar.gz" +else + MY_P="PyQt-x11-gpl-${PV}" + SRC_URI="mirror://sourceforge/pyqt/${MY_P}.tar.gz" +fi + +LICENSE="|| ( GPL-2 GPL-3 )" +SLOT="0" +KEYWORDS="" + +IUSE="X dbus debug declarative designer doc examples help kde multimedia opengl phonon script scripttools sql svg webkit xmlpatterns" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + declarative? ( X ) + designer? ( X ) + help? ( X ) + multimedia? ( X ) + opengl? ( X ) + phonon? ( X ) + scripttools? ( X script ) + sql? ( X ) + svg? ( X ) + webkit? ( X ) +" + +# Minimal supported version of Qt. +QT_PV="4.8.5:4" + +DEPEND=" + ${PYTHON_DEPS} + >=dev-python/sip-4.16:=[${PYTHON_USEDEP}] + >=dev-qt/qtcore-${QT_PV} + X? ( + >=dev-qt/qtgui-${QT_PV} + >=dev-qt/qttest-${QT_PV} + ) + dbus? ( + >=dev-python/dbus-python-0.80[${PYTHON_USEDEP}] + >=dev-qt/qtdbus-${QT_PV} + ) + declarative? ( >=dev-qt/qtdeclarative-${QT_PV} ) + designer? ( >=dev-qt/designer-${QT_PV} ) + help? ( >=dev-qt/qthelp-${QT_PV} ) + multimedia? ( >=dev-qt/qtmultimedia-${QT_PV} ) + opengl? ( >=dev-qt/qtopengl-${QT_PV} ) + phonon? ( + kde? ( media-libs/phonon ) + !kde? ( || ( >=dev-qt/qtphonon-${QT_PV} media-libs/phonon ) ) + ) + script? ( >=dev-qt/qtscript-${QT_PV} ) + sql? ( >=dev-qt/qtsql-${QT_PV} ) + svg? ( >=dev-qt/qtsvg-${QT_PV} ) + webkit? ( >=dev-qt/qtwebkit-${QT_PV} ) + xmlpatterns? ( >=dev-qt/qtxmlpatterns-${QT_PV} ) + dbus? ( virtual/pkgconfig ) +" + +S=${WORKDIR}/${MY_P} + +src_prepare() { + # Support qreal on arm architecture (bug 322349). + use arm && epatch "${FILESDIR}/${PN}-4.7.3-qreal_float_support.patch" + + # Allow building against KDE's phonon (bug 433944 and others). + sed -i \ + -e "s:VideoWidget()\":&, extra_include_dirs=[\"${EPREFIX}/usr/include/qt4/QtGui\"]:" \ + -e "s:^\s\+generate_code(\"phonon\":&, extra_include_dirs=[\"${EPREFIX}/usr/include/phonon\"]:" \ + configure.py || die + + if ! use dbus; then + sed -i -e 's/^\(\s\+\)check_dbus()/\1pass/' configure.py || die + fi + + python_copy_sources + + preparation() { + if [[ ${EPYTHON} == python3.* ]]; then + rm -fr pyuic/uic/port_v2 + else + rm -fr pyuic/uic/port_v3 + fi + } + python_foreach_impl run_in_build_dir preparation +} + +pyqt4_use_enable() { + use $1 && echo --enable=${2:-Qt$(tr 'a-z' 'A-Z' <<< ${1:0:1})${1:1}} +} + +src_configure() { + configuration() { + local myconf=( + "${PYTHON}" configure.py + --confirm-license + --bindir="${EPREFIX}/usr/bin" + --destdir="$(python_get_sitedir)" + --sipdir="${EPREFIX}/usr/share/sip" + --assume-shared + --no-timestamp + --qsci-api + $(use debug && echo --debug) + --enable=QtCore + --enable=QtNetwork + --enable=QtXml + $(pyqt4_use_enable X QtGui) + $(pyqt4_use_enable X QtTest) + $(pyqt4_use_enable dbus QtDBus) + $(pyqt4_use_enable declarative) + $(pyqt4_use_enable designer) $(use designer || echo --no-designer-plugin) + $(pyqt4_use_enable help) + $(pyqt4_use_enable multimedia) + $(pyqt4_use_enable opengl QtOpenGL) + $(pyqt4_use_enable phonon phonon) + $(pyqt4_use_enable script) + $(pyqt4_use_enable scripttools QtScriptTools) + $(pyqt4_use_enable sql) + $(pyqt4_use_enable svg) + $(pyqt4_use_enable webkit QtWebKit) + $(pyqt4_use_enable xmlpatterns QtXmlPatterns) + AR="$(tc-getAR) cqs" + CC="$(tc-getCC)" + CFLAGS="${CFLAGS}" + CFLAGS_RELEASE= + CXX="$(tc-getCXX)" + CXXFLAGS="${CXXFLAGS}" + CXXFLAGS_RELEASE= + LINK="$(tc-getCXX)" + LINK_SHLIB="$(tc-getCXX)" + LFLAGS="${LDFLAGS}" + LFLAGS_RELEASE= + RANLIB= + STRIP= + ) + echo "${myconf[@]}" + "${myconf[@]}" || die + + local mod + for mod in QtCore \ + $(use X && echo QtGui) \ + $(use dbus && echo QtDBus) \ + $(use declarative && echo QtDeclarative) \ + $(use designer && echo QtDesigner) \ + $(use opengl && echo QtOpenGL); do + # Run eqmake4 inside the qpy subdirectories to respect + # CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS and avoid stripping. + pushd qpy/${mod} > /dev/null || return + eqmake4 $(ls w_qpy*.pro) + popd > /dev/null || return + + # Fix insecure runpaths. + sed -i -e "/^LFLAGS\s*=/ s:-Wl,-rpath,${BUILD_DIR}/qpy/${mod}::" \ + ${mod}/Makefile || die "failed to fix rpath for ${mod}" + done + + # Avoid stripping of libpythonplugin.so. + if use designer; then + pushd designer > /dev/null || return + eqmake4 designer.pro + popd > /dev/null || return + fi + } + python_parallel_foreach_impl run_in_build_dir configuration +} + +src_compile() { + : +} + +src_install() { + installation() { + python_export PYTHON_SITEDIR + insinto "${PYTHON_SITEDIR}/${PN}" + doins pyqtconfig.py + } + python_foreach_impl run_in_build_dir installation +} diff --git a/dev-python/PyQt4-pyqtconfig/files/PyQt4-4.7.3-qreal_float_support.patch b/dev-python/PyQt4-pyqtconfig/files/PyQt4-4.7.3-qreal_float_support.patch new file mode 100644 index 000000000..37e1e69eb --- /dev/null +++ b/dev-python/PyQt4-pyqtconfig/files/PyQt4-4.7.3-qreal_float_support.patch @@ -0,0 +1,239 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 03_qreal_float_support.dpatch by Michael Casadevall +## +## DP: Corrects a configure test, and adds explicate double handling +## to qlist.sip on architectures where qreal != double + +@DPATCH@ +Index: python-qt4-4.7.2/sip/QtCore/qlist.sip +=================================================================== +--- python-qt4-4.7.2.orig/sip/QtCore/qlist.sip 2010-03-17 19:29:26.000000000 +0100 ++++ python-qt4-4.7.2/sip/QtCore/qlist.sip 2010-03-25 23:53:55.468631945 +0100 +@@ -749,3 +749,227 @@ + return sipGetState(sipTransferObj); + %End + }; ++ ++// If we're on an architecture where qreal != double, then we need to also ++// explicately handle doubles. On architectures where qreal == double, they ++// will automaticially be cast upwards ++ ++%If (!PyQt_qreal_double) ++ ++%If (Qt_4_3_0 -) ++// QList > is implemented as a Python list of 2-element tuples. ++%MappedType QList > ++{ ++%TypeHeaderCode ++#include ++#include ++%End ++ ++%ConvertFromTypeCode ++ // Create the list. ++ PyObject *l; ++ ++ if ((l = PyList_New(sipCpp->size())) == NULL) ++ return NULL; ++ ++ // Set the list elements. ++ for (int i = 0; i < sipCpp->size(); ++i) ++ { ++ const QPair &p = sipCpp->at(i); ++ PyObject *pobj; ++ ++ if ((pobj = Py_BuildValue((char *)"dd", p.first, p.second)) == NULL) ++ { ++ Py_DECREF(l); ++ ++ return NULL; ++ } ++ ++ PyList_SET_ITEM(l, i, pobj); ++ } ++ ++ return l; ++%End ++ ++%ConvertToTypeCode ++ SIP_SSIZE_T len; ++ ++ // Check the type if that is all that is required. ++ if (sipIsErr == NULL) ++ { ++ if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) ++ return 0; ++ ++ for (SIP_SSIZE_T i = 0; i < len; ++i) ++ { ++ PyObject *tup = PySequence_ITEM(sipPy, i); ++ ++ if (!PySequence_Check(tup) || PySequence_Size(tup) != 2) ++ return 0; ++ } ++ ++ return 1; ++ } ++ ++ QList > *ql = new QList >; ++ len = PySequence_Size(sipPy); ++ ++ for (SIP_SSIZE_T i = 0; i < len; ++i) ++ { ++ PyObject *tup = PySequence_ITEM(sipPy, i); ++ ++ double first = PyFloat_AsDouble(PySequence_ITEM(tup, 0)); ++ double second = PyFloat_AsDouble(PySequence_ITEM(tup, 1)); ++ ++ ql->append(QPair(first, second)); ++ } ++ ++ *sipCppPtr = ql; ++ ++ return sipGetState(sipTransferObj); ++%End ++}; ++%End ++%If (Qt_4_3_0 -) ++// QList > is implemented as a Python list of 2-element tuples. ++template ++%MappedType QList > ++{ ++%TypeHeaderCode ++#include ++#include ++%End ++ ++%ConvertFromTypeCode ++ // Create the list. ++ PyObject *l; ++ ++ if ((l = PyList_New(sipCpp->size())) == NULL) ++ return NULL; ++ ++ // Set the list elements. ++ for (int i = 0; i < sipCpp->size(); ++i) ++ { ++ const QPair &p = sipCpp->at(i); ++ TYPE *t = new TYPE(p.second); ++ PyObject *pobj; ++ ++ if ((pobj = sipBuildResult(NULL, "(dB)", p.first, t, sipClass_TYPE, sipTransferObj)) == NULL) ++ { ++ Py_DECREF(l); ++ delete t; ++ ++ return NULL; ++ } ++ ++ PyList_SET_ITEM(l, i, pobj); ++ } ++ ++ return l; ++%End ++ ++%ConvertToTypeCode ++ SIP_SSIZE_T len; ++ ++ // Check the type if that is all that is required. ++ if (sipIsErr == NULL) ++ { ++ if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) ++ return 0; ++ ++ for (SIP_SSIZE_T i = 0; i < len; ++i) ++ { ++ PyObject *tup = PySequence_ITEM(sipPy, i); ++ ++ if (!PySequence_Check(tup) || PySequence_Size(tup) != 2) ++ return 0; ++ ++ if (!sipCanConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, SIP_NOT_NONE)) ++ return 0; ++ } ++ ++ return 1; ++ } ++ ++ QList > *ql = new QList >; ++ len = PySequence_Size(sipPy); ++ ++ for (SIP_SSIZE_T i = 0; i < len; ++i) ++ { ++ PyObject *tup = PySequence_ITEM(sipPy, i); ++ double d; ++ int state; ++ ++ d = PyFloat_AsDouble(PySequence_ITEM(tup, 0)); ++ TYPE *t = reinterpret_cast(sipConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); ++ ++ if (*sipIsErr) ++ { ++ sipReleaseInstance(t, sipClass_TYPE, state); ++ ++ delete ql; ++ return 0; ++ } ++ ++ ql->append(QPair(d, *t)); ++ ++ sipReleaseInstance(t, sipClass_TYPE, state); ++ } ++ ++ *sipCppPtr = ql; ++ ++ return sipGetState(sipTransferObj); ++%End ++}; ++%End ++ ++// QList is implemented as a Python list of doubles. ++%MappedType QList ++{ ++%TypeHeaderCode ++#include ++%End ++ ++%ConvertFromTypeCode ++ // Create the list. ++ PyObject *l; ++ ++ if ((l = PyList_New(sipCpp->size())) == NULL) ++ return NULL; ++ ++ // Set the list elements. ++ for (int i = 0; i < sipCpp->size(); ++i) ++ { ++ PyObject *pobj; ++ ++ if ((pobj = PyFloat_FromDouble(sipCpp->value(i))) == NULL) ++ { ++ Py_DECREF(l); ++ ++ return NULL; ++ } ++ ++ PyList_SET_ITEM(l, i, pobj); ++ } ++ ++ return l; ++%End ++ ++%ConvertToTypeCode ++ // Check the type if that is all that is required. ++ if (sipIsErr == NULL) ++ return (PySequence_Check(sipPy) && PySequence_Size(sipPy) >= 0); ++ ++ QList *ql = new QList; ++ SIP_SSIZE_T len = PySequence_Size(sipPy); ++ ++ for (SIP_SSIZE_T i = 0; i < len; ++i) ++ ql->append(PyFloat_AsDouble(PySequence_ITEM(sipPy, i))); ++ ++ *sipCppPtr = ql; ++ ++ return sipGetState(sipTransferObj); ++%End ++}; ++ ++%End diff --git a/dev-python/PyQt4-pyqtconfig/metadata.xml b/dev-python/PyQt4-pyqtconfig/metadata.xml new file mode 100644 index 000000000..0cb1927cc --- /dev/null +++ b/dev-python/PyQt4-pyqtconfig/metadata.xml @@ -0,0 +1,30 @@ + + + + qt + + Build bindings for the QtGui module + Build bindings for the QtDBus module + Build bindings for the QtDeclarative module + Build bindings for the QtDesigner module and enable the designer plugin + Build bindings for the QtHelp module + Select media-libs/phonon as Phonon variant (needed for KDE) + Build bindings for the QtMultimedia module + Build bindings for the QtOpenGL module + Build bindings for the phonon module + Build bindings for the QtScript module + Build bindings for the QtScriptTools module + Build bindings for the QtSql module + Build bindings for the QtSvg module + Build bindings for the QtWebKit module + Build bindings for the QtXmlPatterns module + + + + phil@riverbankcomputing.com + Phil Thompson + + mailto:pyqt@riverbankcomputing.com + PyQt4 + +