Ticket #53778: qt5-1.0-for-kde.2.diff

File qt5-1.0-for-kde.2.diff, 5.0 KB (added by RJVB (René Bertin), 7 years ago)

updated qt5-1.0 PG patch (for rev. 9e44fe58a605e66730f8f50353334984318a42ea)

  • .0.tcl

    old new  
    3434# Usage:
    3535# PortGroup     qt5 1.0
    3636
    37 options qt5.using_kde qt5.base_version
     37options qt5.base_version
    3838
    3939global available_qt_versions
    4040set available_qt_versions {
     
    127127global qt_name
    128128
    129129if { [info exists qt_name] } {
    130     default qt5.using_kde no
    131130    default qt5.base_version ${qt_name}
    132131} else {
    133132    set qt_name [qt5.get_default_name]
    134     default qt5.using_kde no
    135133    default qt5.base_version {[qt5.get_default_name]}
    136134}
    137135
     
    144142    return
    145143}
    146144
     145###########################################################################################
     146# Check what Qt5 port and PortGroup we should be using, based on indicated port preference,
     147# what is already installed and OS version.
     148# Given that ports exist for multiple Qt5 versions it is easier to distinguish port:qt5 and
     149# port:qt5-kde from differences in install layout than from active installed portnames.
     150
     151# first, check if port:qt5-kde or a port:qt5-kde-devel is installed, or if we're on Mac OS X 10.6
     152# NB: the qt5-kde-devel ports may never exist officially in MacPorts but is used locally by KF5 port maintainers!
     153if {[file exists ${prefix}/include/qt5/QtCore/QtCore] || ${os.major} == 10} {
     154    # Qt5 has been installed through port:qt5-kde or port:qt5-kde-devel or we're on 10.6
     155    # transfer control to qt5-kde-1.0.tcl
     156    ui_debug "Qt5 is provided by port:qt5-kde"
     157    PortGroup           qt5-kde 1.0
     158    return
     159} elseif {[file exists ${prefix}/libexec/qt5/plugins]
     160        && [file type ${prefix}/libexec/qt5/plugins] eq "directory"} {
     161    # qt5-qtbase is installed: Qt5 has been installed through a standard port:qt5 port
     162    # (checking if "plugins" is a directory is probably redundant)
     163    # We're already in the correct PortGroup
     164    if {[info exists qt5.prefer_kde] && [info exists building_qt5]} {
     165        # user tries to install say qt5-kde-qtwebkit against qt5-qtbase etc.
     166        ui_error "You cannot install a Qt5-KDE port with port:qt5 or one of its subports installed!"
     167        # print the error but only raise it when attempting to fetch or configure the port.
     168        pre-fetch {
     169            return -code error "Deactivate the conflicting port:qt5 port(s) first!"
     170        }
     171        pre-configure {
     172            return -code error "Deactivate the conflicting port:qt5 port(s) first!"
     173        }
     174    }
     175} elseif {[info exists qt5.prefer_kde]} {
     176    # The calling port has indicated a preference and no Qt5 port is installed already
     177    # transfer control to qt5-kde-1.0.tcl
     178    ui_debug "Qt5 will be provided by port:qt5-kde, by request"
     179    PortGroup           qt5-kde 1.0
     180    return
     181} else {
     182    # default situation: we're already in the correct PortGroup
     183}
     184
     185if {[info exists qt5.prefer_kde]} {
     186    # this is a port that prefers port:qt5-kde and thus expects most of Qt5 to be installed
     187    # through that single port rather than enumerate all components it depends on.
     188    depends_lib-append  port:qt5
     189    # the port may also use a variable that is still provided by qt5-kde-1.0.tcl;
     190    # set it to an empty value so that it can be referenced without side-effects.
     191    global qt_cmake_defines
     192    set qt_cmake_defines ""
     193}
     194###########################################################################################
     195
     196options qt5.using_kde
     197default qt5.using_kde no
     198
    147199# standard install directory
    148200global qt_dir
    149201set qt_dir               ${prefix}/libexec/qt5
     
    617669    ui_debug "qt5 PortGroup: Qt is provided by ${qt_installed_name}"
    618670
    619671    if { [variant_exists qt5kde] && [variant_isset qt5kde] } {
    620         if { [string range ${qt_installed_name} end-3 end] ne "-kde" } {
    621             ui_error "qt5 PortGroup: Qt is installed but not qt5-kde, as is required by this variant"
    622             ui_error "qt5 PortGroup: please run `sudo port uninstall --follow-dependents ${qt_installed_name}-qtbase and try again"
    623             return -code error "improper Qt installed"
    624         }
     672        ui_error "Internal Qt5 port error: inappropriate use of the Qt5 1.0 PortGroup"
     673        return -code error "internal Qt5 port error"
    625674    } else {
    626675        if { ${qt_installed_name} ne [qt5.get_default_name] } {
    627676            # see https://wiki.qt.io/Qt-Version-Compatibility
     
    637686}
    638687}
    639688
    640 # add qt5kde variant if one does not exist and one is requested via qt5.using_kde
    641 # variant is added in eval_variants so that qt5.using_kde can be set anywhere in the Portfile
    642 rename ::eval_variants ::real_qt5_eval_variants
    643 proc eval_variants {variations} {
    644     global qt5.using_kde
    645     if { ![variant_exists qt5kde] && [tbool qt5.using_kde] } {
    646         variant qt5kde description {use Qt patched for KDE compatibility} {}
    647     }
    648     uplevel ::real_qt5_eval_variants $variations
    649 }
    650 
    651689namespace eval qt5pg {
    652690    proc register_dependents {} {
    653691        global qt5_private_components qt5_private_build_components qt5.base_version