#18359: Guide has wrong advice about variants -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: markd@… Type: defect | Status: new Priority: Normal | Milestone: Website & Documentation Component: guide | Version: 1.7.0 Keywords: | Port: -------------------------------------+-------------------------------------- The Guide [http://guide.macports.org/#development.variants.phase says this] of variants: If a variant requires options in addition to those provided by keywords using -append and/or -delete, in other words, any actions that would normally take place within a port installation phase, do not try to do this within the variant declaration. Rather, modify the behavior of any affected phases when the variant is invoked using the variant_isset keyword. {{{ post-destroot { xinstall -m 755 -d ${destroot}${prefix}/etc/ xinstall ${worksrcpath}/examples/foo.conf \ ${destroot}${prefix}/etc/ if {[variant_isset carbon]} { delete ${destroot}${prefix}/bin/emacs delete ${destroot}${prefix}/bin/emacs-${version} } } }}} I do not know why the Guide says this because it is the opposite of what I recommend. It should say something more like: If a variant requires options in addition to those provided by keywords using -append and/or -delete, in other words, any actions that would normally take place within a port installation phase, include these within the variant declaration if possible, so that it is easier to see at a glance what a variant does. If you want to take an action if a variant is *not* set, use the variant_isset keyword. {{{ post-destroot { xinstall -d ${destroot}${prefix}/share/emacs/${version}/leim delete ${destroot}${prefix}/bin/ctags delete ${destroot}${prefix}/share/man/man1/ctags.1 } variant carbon conflicts x11 description {Adds a Mac (Carbon) version of Emacs} { configure.args-delete --without-carbon configure.args-append --with-carbon \ --enable-carbon-app=${applications_dir} post-destroot { delete ${destroot}${prefix}/bin/emacs ${destroot}${prefix}/bin/emacs-${version} } } post-activate { if {![variant_isset carbon]} { ui_msg "Note: You have not selected the +carbon variant" } } }}} -- Ticket URL: <http://trac.macports.org/ticket/18359> MacPorts <http://www.macports.org/> Ports system for Mac OS