Ticket #51619: qt5-1.0.tcl.2.diff

File qt5-1.0.tcl.2.diff, 9.6 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 7 years ago)
  • qt5-1.0.tcl

    old new  
    3434# Usage:
    3535# PortGroup     qt5 1.0
    3636
     37options qt5.kde_variant
     38
    3739global available_qt_versions
    3840set available_qt_versions {
    3941    qt5
     42    qt56
    4043    qt55
     44    qt5-kde
    4145}
    4246
    4347proc qt5.get_default_name {} {
     
    121125global qt_name
    122126
    123127if { [info exists qt_name] } {
     128    default qt5.kde_variant no
    124129} else {
    125130    set qt_name [qt5.get_default_name]
     131    default qt5.kde_variant yes
    126132}
    127133
    128134# Qt has what is calls reference configurations, which are said to be thoroughly tested
     
    237243    return
    238244}
    239245
     246# a procedure for declaring dependencies on Qt5 components, which will expand them
     247# into the appropriate subports for the Qt5 flavour installed
     248# e.g. qt5.depends_component qtbase qtsvg qtdeclarative
     249proc qt5.depends_component {first args} {
     250    global qt5_private_components
     251
     252    set args [linsert $args[set list {}] 0 ${first}]
     253    foreach comp ${args} {
     254        lappend qt5_private_components ${comp}
     255    }
     256}
     257
    240258# no universal binary support in Qt 5
    241259#     see http://lists.qt-project.org/pipermail/interest/2012-December/005038.html
    242260#     and https://bugreports.qt.io/browse/QTBUG-24952
     
    283301    set qt_qmake_spec ""
    284302}
    285303
    286 # do not try to install if qt5-qtbase dependency will fail to build
    287 # warn about non-reference configurations
    288 if { ${os.major} < 11 } {
    289     pre-fetch {
    290         ui_warn "Qt dependency is not supported on this platform and may not build"
    291     }
    292 }
    293 
    294 if { ${qt_name} ne "qt5" } {
    295     pre-fetch {
    296         ui_warn "Qt dependency is not the latest version but may be the latest supported on your OS"
    297     }
    298 }
    299 
    300 if {![info exists building_qt5]} {
    301     depends_lib-append path:lib/pkgconfig/Qt5Core.pc:${qt_name}-qtbase
    302 }
    303 
    304304# use PKGCONFIG for Qt discovery in configure scripts
    305305depends_build-append    port:pkgconfig
    306306
     
    313313        lappend merger_destroot_env($arch) INSTALL_ROOT=${workpath}/destroot-${arch}
    314314    }
    315315}
     316
     317pre-configure {
     318    set qt_installed_name ""
     319
     320    foreach qt_test_name ${available_qt_versions} {
     321
     322        if { [string range ${qt_test_name} end-3 end] eq "-kde" } {
     323            set qt_test_port_name ${qt_test_name}
     324        } else {
     325            set qt_test_port_name ${qt_test_name}-qtbase
     326        }
     327
     328        if {![catch {set installed [lindex [registry_active ${qt_test_port_name}] 0]}]} {
     329            set qt_installed_name ${qt_test_name}
     330        }
     331    }
     332
     333    if { ${qt_installed_name} eq "" } {
     334        ui_error "at least one Qt must be installed"
     335        return -code error "insufficient dependencies"
     336    }
     337
     338    ui_debug "qt5 PortGroup: Qt is provided by ${qt_installed_name}"
     339
     340    if { [variant_exists qt5kde] && [variant_isset qt5kde] } {
     341        if { [string range ${qt_installed_name} end-3 end] ne "-kde" } {
     342            ui_error "qt5 PortGroup: Qt is installed but not qt5-kde, as is required by this variant"
     343            ui_error "qt5 PortGroup: please run `sudo port uninstall --follow-dependents ${qt_installed_name}-qtbase and try again"
     344        }
     345    } else {
     346        if { ${qt_installed_name} ne [qt5.get_default_name] } {
     347            # see https://wiki.qt.io/Qt-Version-Compatibility
     348            ui_warn "qt5 PortGroup: default Qt for this platform is [qt5.get_default_name] but ${qt_installed_name} is installed"
     349        }
     350    }
     351}
     352
     353if { [tbool qt5.kde_variant] } {
     354    variant qt5kde description {use Qt patched for KDE compatibility} {}
     355}
     356
     357namespace eval Qt5PortGroup {
     358    proc register_dependents {} {
     359        global qt5_private_components
     360
     361        if { ![exists qt5_private_components] || ${qt5_private_components} eq "" } {
     362            # no Qt components have been requested
     363            # qt5.depends_component has never been called
     364            set qt5_private_components ""
     365        }
     366
     367        if { [variant_exists qt5kde] && [variant_isset qt5kde] } {
     368            set qt_kde_name qt5-kde
     369
     370            depends_lib-append port:${qt_kde_name}
     371
     372            foreach comp ${qt5_private_components} {
     373                switch -exact ${comp} {
     374                    qtwebkit -
     375                    qtwebengine -
     376                    qtwebview -
     377                    qtenginio {
     378                        # these components are subports
     379                        depends_lib-append port:${qt_kde_name}-${comp}
     380                    }
     381                    default {
     382                        # qt5-kde provides all components except those above
     383                    }
     384                }
     385            }
     386        } else {
     387            # ![variant_isset qt5kde]
     388            foreach comp "qtbase ${qt5_private_components}" {
     389                switch -exact ${comp} {
     390                    qtquickcontrols2 {
     391                        set path lib/pkgconfig/Qt5QuickControls2.pc
     392                    }
     393                    qtbase {
     394                        set path lib/pkgconfig/Qt5Core.pc
     395                    }
     396                    qtwebengine {
     397                        set path lib/pkgconfig/Qt5WebEngine.pc
     398                    }
     399                    qtdeclarative {
     400                        set path lib/pkgconfig/Qt5Qml.pc
     401                    }
     402                    qtserialport {
     403                        set path lib/pkgconfig/Qt5SerialPort.pc
     404                    }
     405                    qtsensors {
     406                        set path lib/pkgconfig/Qt5Sensors.pc
     407                    }
     408                    qtcharts {
     409                        set path lib/pkgconfig/Qt5Charts.pc
     410                    }
     411                    qtwebkit {
     412                        set path lib/pkgconfig/Qt5WebKit.pc
     413                    }
     414                    qtwebchannel {
     415                        set path lib/pkgconfig/Qt5WebChannel.pc
     416                    }
     417                    qtdeclarative-render2d {
     418                        set path lib/cmake/Qt5Quick/Qt5Quick_ContextPlugin.cmake
     419                    }
     420                    qtimageformats {
     421                        set path lib/cmake/Qt5Gui/Qt5Gui_QTiffPlugin.cmake
     422                    }
     423                    qtvirtualkeyboard {
     424                        set path lib/cmake/Qt5Gui/Qt5Gui_QVirtualKeyboardPlugin.cmake
     425                    }
     426                    qtsvg {
     427                        set path lib/pkgconfig/Qt5Svg.pc
     428                    }
     429                    qtmacextras {
     430                        set path lib/pkgconfig/Qt5MacExtras.pc
     431                    }
     432                    qtlocation {
     433                        set path lib/pkgconfig/Qt5Location.pc
     434                    }
     435                    qtxmlpatterns {
     436                        set path lib/pkgconfig/Qt5XmlPatterns.pc
     437                    }
     438                    qtserialbus {
     439                        set path lib/pkgconfig/Qt5SerialBus.pc
     440                    }
     441                    qtmultimedia {
     442                        set path lib/pkgconfig/Qt5Multimedia.pc
     443                    }
     444                    qtcanvas3d {
     445                        set path libexec/qt5/qml/QtCanvas3D/libqtcanvas3d.dylib
     446                    }
     447                    qtdatavis3d {
     448                        set path lib/pkgconfig/Qt5DataVisualization.pc
     449                    }
     450                    qtgraphicaleffects {
     451                        set path libexec/qt5/qml/QtGraphicalEffects/libqtgraphicaleffectsplugin.dylib
     452                    }
     453                    qtpurchasing {
     454                        set path lib/pkgconfig/Qt5Purchasing.pc
     455                    }
     456                    qtscript {
     457                        set path lib/pkgconfig/Qt5Script.pc
     458                    }
     459                    qtscxml {
     460                        set path lib/pkgconfig/Qt5Scxml.pc
     461                    }
     462                    qt3d {
     463                        set path lib/pkgconfig/Qt53DCore.pc
     464                    }
     465                    qtconnectivity {
     466                        set path lib/pkgconfig/Qt5Bluetooth.pc
     467                    }
     468                    qtgamepad {
     469                        set path lib/pkgconfig/Qt5Gamepad.pc
     470                    }
     471                    qtwebview {
     472                        set path lib/pkgconfig/Qt5WebView.pc
     473                    }
     474                    qttools {
     475                        set path lib/pkgconfig/Qt5Designer.pc
     476                    }
     477                    qtquickcontrols {
     478                        set path libexec/qt5/qml/QtQuick/Controls/libqtquickcontrolsplugin.dylib
     479                    }
     480                    qtwebsockets {
     481                        set path lib/pkgconfig/Qt5WebSockets.pc
     482                    }
     483                    qttranslations {
     484                        set path libexec/qt5/translations/qt_ar.qm
     485                    }
     486                    mysql-plugin {
     487                        set path lib/cmake/Qt5Sql/Qt5Sql_QMYSQLDriverPlugin.cmake
     488                    }
     489                    psql-plugin {
     490                        set path lib/cmake/Qt5Sql/Qt5Sql_QPSQLDriverPlugin.cmake
     491                    }
     492                    sqlite-plugin {
     493                        set path lib/cmake/Qt5Sql/Qt5Sql_QSQLiteDriverPlugin.cmake
     494                    }
     495                    qtquick1 {
     496                        set path lib/pkgconfig/Qt5Declarative.pc
     497                    }
     498                    qtenginio {
     499                        set path lib/pkgconfig/Enginio.pc
     500                    }
     501                    default {
     502                        set path ""
     503                        return -code error "unknown component"
     504                    }
     505                }
     506                depends_lib-append path:${path}:[qt5.get_default_name]-${comp}
     507            }
     508        }
     509    }
     510}
     511
     512port::register_callback Qt5PortGroup::register_dependents