The subport declaration causes MacPorts to define an additional port, with the name given by the declaration. The keywords for the subport are those in the global section of the Portfile, and those in the brace-enclosed body.
Example:
Portfile 1.0
name example
depends_lib aaa
configure.args --bbb
subport example-sub1 {
depends_lib-append ccc
configure.args --ddd
}
subport example-sub2 {
depends_lib-append eee
configure.args-append --fff
}Because MacPorts treats each subport as a separate port declaration, each subport will have its own, independent phases: fetch, configure, build, destroot, install, activate, etc. However, because the subports share the global declaration part, all the subports will by default share the same dist_subdir. This means that MacPorts only needs to fetch the distfiles once, and the remaining subports can reuse the distfiles.