@Seeker
Excellent question! The answer is:
...it be simultaneously building both origins and simultaneously all theirs dependencies
The code gathers the dependencies for all of the origins specified serially (one at a time), but will then build all dependencies together. So it is possible the second origin completes before the first origin.
The algorithm goes something like this:
- Run
make config-conditional for all specified origins, unless
-b is specified
- Gather list of dependencies for all specified origins (one at a time), store in "index"
- Gather list of dependencies for all dependencies, store in "index"
- Repeat until all possible dependencies are indexed
- Find all ports in the above "index" that are leaves (have no dependencies of their own), store in "install"
- Build all leaves listed in the "install" file, up to
-j amount at a time.
- Rebuild "index" as needed, removing listed dependencies for an origin if the dependency was installed (will reveal more "leaves" that have no further dependencies)
- Repeat until all ports are installed.
Every now and then, there will be a time where the system is just building one port at a time, this is normal. It happens when a major port (such as
devel/gettext or
devel/libiconv) is being built, and everything requires it. I've made an effort to reduce the amount of time only one port is being built, but it will still happen.
The code's not easy to read (for that I apologize). This is more of a proof-of-concept than anything else. As I mentioned, I'll probably try to get this code added to the Ports system properly, in the
/usr/ports/Mk/ files. That way a user can specify [cmd=]make -C /usr/ports/lang/php52 parallel-package[/cmd] and it's done, much faster than the normal serial building method.