[MacPorts] #51619: qt5.depends_component procedure

MacPorts noreply at macports.org
Wed Dec 28 18:31:44 CET 2016


#51619: qt5.depends_component procedure
---------------------------+----------------------
  Reporter:  RJVB          |      Owner:  mkae
      Type:  enhancement   |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:
Resolution:                |   Keywords:
      Port:  qt5, qt5-kde  |
---------------------------+----------------------

Comment (by RJVB):

 A more important warning: when testing this procedure, please make sure to
 use the latest version from
 https://github.com/RJVB/macstrop/blob/master/_resources/port1.0/group/qt5-1.0.tcl

 {{{
 # a procedure for declaring dependencies on Qt5 components, which will
 expand them
 # into the appropriate subports for the Qt5 flavour installed
 # e.g. qt5.depends_component qtbase qtsvg qtdeclarative
 proc qt5.depends_component {first args} {
     global qt5_component_lib qt5.using_kde os.major
     # join ${first} and (the optional) ${args}
     set args [linsert $args[set list {}] 0 ${first}]
     # select the Qt5 port prefix, depending on which Qt5 port is installed
     set is_qt5kde [expr [info exists qt5.using_kde] && ${qt5.using_kde}]
     if {${is_qt5kde} == 1 || ${os.major} == 10} {
         # We have port:qt5-kde or we're on OS X 10.6 which only gets Qt
 5.3.2 from that port
         set qt5pprefix  "qt5-kde"
     } elseif {${os.major} == 11} {
         set qt5pprefix  "qt55"
     } else {
         set qt5pprefix  "qt5"
     }
     foreach comp ${args} {
         set done true
         switch ${comp} {
             "qt5" {
                 if {${is_qt5kde} == 1} {
                     global qt5_dependency
                     # qt5-kde-1.0.tcl exports the exact dependency
 expression in a variable
                     depends_lib-append ${qt5_dependency}
                 } else {
                     depends_lib-append port:${qt5pprefix}
                 }
             }
             "qtwebkit" -
             "qtwebengine" -
             "qtwebview" {
                 # these components are never stub subports
                 set done false
             }
             default {
                 # these components are included port:qt5-kde (and provided
 as additional stub subports)
                 if {${is_qt5kde} == 0} {
                     set done false
                 }
             }
         }
         if {!${done}} {
             set portname "${qt5pprefix}-${comp}"
             if {[info exists qt5_component_lib] && [info exists
 qt5_component_lib(${comp})]} {
                 # an explicit dependency pattern was given, e.g. path:foo
                 depends_lib-append
 "$qt5_component_lib(${comp}):${portname}"
             } else {
                 depends_lib-append port:${portname}
             }
         }
     }
 }
 }}}

 @mojca: the goal here is not that ports can declare dependencies on
 different Qt versions. Even port:qt55 is supposed to be used only on
 earlier OS X version(s) (10.7 +?). How exactly that is supposed to work I
 don't know nor what kind of protection there is against installing that
 port on later OS versions; the procedure above assumes that this port is
 to be used on 10.7 only.
 port:qt5 and port:qt5-kde aren't supposed to have different Qt versions.
 Just as with -devel ports, it is largely up to the user to decide which Qt
 port s/he installs, and ports have to work with either of the available
 alternatives.
 But in line with your remark: using port:qt5-kde has always led to setting
 a variant.

 Not that variants can protect against ABI differences when a dependency is
 changed ... The risk is mitigated a bit by Qt's guaranteed backwards
 compatibility, so everything should be fine as long as no one tries to use
 port:qt55 after having used a later Qt version.

--
Ticket URL: <https://trac.macports.org/ticket/51619#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list