Newbie Portfile writer question: what does "subport" do?

Jim DeLaHunt list+macports-dev at
Sat Jul 10 07:42:10 UTC 2021

Hi folks:

I'm trying to write my first Portfile, and I have a terribly naive 
question: what does the "subport" directive in the Portfile do?

And: How do the "subport" directives interact with what is defined at 
the top level of the Portfile?  How do both the top level of the 
Portfile and the subport blocks relate to a) fetching the source code 
and b) configuring the source code and c) building the software and d) 
installing the software?

Should I think of the top-level Portfile definitions and each subport as 
being separate ports, each with their own fetch, configure, build, and 
install activity? Or do the subports somehow modify the top-level 
Portfile definitions for a single fetch, configure, build, and install 

I don't see the subport directive mentioned in the MacPorts Guide, 
particularly not in Chapter 4. Portfile Development[1], nor in Chapter 
5. Portfile Reference[2]. I didn't see anything about subports authoring 
in the Wiki either.

FYI, I am working on a Portfile for ticket #62984 on port:freeciv [3]. 
The upstream code can be configured to generate about 5 different sets 
of client software, with about five different sets of dependencies. So 
the concept is to make each set of client software a subport, and have a 
base subport and an overarching port. But I don't know if this means six 
fetches, configures, and builds, or one.




Thank you for helping me with my elementary education. Best regards,
      —Jim DeLaHunt

More information about the macports-dev mailing list