[MacPorts] #53089: option-contains
MacPorts
noreply at macports.org
Sat Dec 17 16:36:04 CET 2016
#53089: option-contains
-------------------------+-----------------
Reporter: RJVB | Owner:
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: base | Version:
Keywords: haspatch | Port:
-------------------------+-----------------
This is a little prototype patch that adds a "contains" function to the
options mechanism, something I've often missed when trying to do things
like adding depspecs cleanly.
Example:
{{{
if {![depends_build-contains port:pkgconfig]} {
# pkgconfig already added by one of the included PortGroups
depends_build-append port:pkgconfig
}
}}}
or
{{{
variant qtA description {support Qt component "A"} {
# someday: qt5.depends_component qt-a
depends_lib-append port:qt5-qt-a
}
variant qtB description {support Qt component "B"} {
# someday: qt5.depends_component qt-b
depends_lib-append port:qt5-qt-b
}
...
# pull in some runtime dependency made necessary by either of the qt
variants,
# checking for the dependency pattern rather than using multiple
variant_isset calls
if {[depends_lib-contains -regexp port:qt5-qt-*]} {
depends_run-append port:shared_runtime_dependency
}
}}}
Ideally the handle_option-contains procedure would scan over $args and
catch all lsearch arguments, but that may be overkill.
--
Ticket URL: <https://trac.macports.org/ticket/53089>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list