Ticket #49109: py-pyqt5.diff

File py-pyqt5.diff, 3.3 KB (added by RJVB (René Bertin), 8 years ago)

ditto, a fix for the depends_lib reset caused by the Python PortGroup. Also introduces working support for DBus and +qtwebkit and +qtwebengine subport to allow using PyQt5 without installing those huge obsolete resp. newish Qt component

  • Portfile

    old new  
    33
    44PortSystem          1.0
    55PortGroup           qt5 1.0
     6set depends_lib_backup \
     7                ${depends_lib}
    68PortGroup           python 1.0
    79
    810name                py-pyqt5
     
    2426
    2527python.versions 27 34 35
    2628
     29# at this point, the python portgroup will have reset depends_lib (python.versions does that),
     30depends_lib-append \
     31                ${depends_lib_backup}
     32
     33if {![info exists qt5.depends_component]} {
     34    proc qt5.depends_component {first args} {
     35        global qt5_component_lib
     36        global qt5.using_kde
     37        # join ${first} and (the optional) ${args}
     38        set args [linsert $args[set list {}] 0 ${first}]
     39        if {[info exists qt5.using_kde] && ${qt5.using_kde}} {
     40            set qt5main "qt5-kde"
     41        } else {
     42            set qt5main "qt5"
     43        }
     44        foreach comp ${args} {
     45            if {${comp} eq "qt5"} {
     46                if {[info exists qt5.using_kde] && ${qt5.using_kde}} {
     47                    global qt5_dependency
     48                    depends_lib-append ${qt5_dependency}
     49                } else {
     50                    depends_lib-append port:${qt5main}
     51                }
     52            } else {
     53                set portname "${qt5main}-${comp}"
     54                depends_lib-append port:${portname}
     55            }
     56        }
     57    }
     58}
     59
    2760if {${name} ne ${subport}} {
    2861    depends_lib-append port:py${python.version}-sip \
    29         port:qt5                                    \
    30         port:qt5-qtwebengine                        \
    3162        port:dbus-python${python.version}
     63
     64    patchfiles-append  patch-no-abort-on-python-errors.diff
     65
    3266    use_configure      yes
    3367    configure.pre_args
    3468    configure.cmd      "${python.bin} configure.py"
    3569    configure.args-append  -q ${qt_qmake_cmd} --verbose --confirm-license \
    36         --sip=${prefix}/bin/sip-${python.branch}
     70        --sip=${prefix}/bin/sip-${python.branch} \
     71        --dbus=${python.include}/dbus-1.0 \
     72        --designer-plugindir=${qt_plugins_dir}/designer/Py${python.version}Qt5 \
     73        --qml-plugindir=${qt_plugins_dir}/Py${python.version}Qt5 \
     74        --disable=QtWebKit --disable=QtWebKitWidgets \
     75        --disable=QtWebEngineCore --disable=QtWebEngineWidgets
     76
     77    variant qtwebkit description {include QtWebKit support} {
     78        qt5.depends_component \
     79                        qtwebkit
     80        configure.args-delete \
     81                        --disable=QtWebKit --disable=QtWebKitWidgets
     82    }
     83    variant qtwebengine description {include QtWebEngine support} {
     84        qt5.depends_component \
     85                        qtwebengine
     86        configure.args-delete \
     87                        --disable=QtWebEngineCore --disable=QtWebEngineWidgets
     88    }
     89
     90    post-configure {
     91        # using --dbus means the compiler will find dbus-python.h but not
     92        # the DBus headers themselves. Correct dbus.pro :
     93        set dbus1incpath [strsed [exec pkg-config --cflags-only-I dbus-1] "g/-I//"]
     94        reinplace "s|INCLUDEPATH += .$|INCLUDEPATH += . ${dbus1incpath}|g" \
     95                       ${worksrcpath}/dbus/dbus.pro
     96        system -W ${worksrcpath}/dbus "${qt_qmake_cmd} dbus.pro"
     97    }
    3798
    3899    build.cmd          make
    39100    build.target       all