Brain dump: OPTIONS, FLAVORS and SUBPACKAGES in FreeBSD Ports Framework

Posted on February 7, 2024
Tags: ,

This post is an attempt of mine to build a clear mental image of how OPTIONS, FLAVORS and SUBPACKAGES are related. I was told several times that this writeup is quite useful, I decided to put it there.

So, what are

Before we proceed let’s underline the following idea. A single Makefile may produce several build directories via flavors and each build may produce several packages via subpackages:

                                                      /+++++++++++++++\
                                                      |               |
                                                ==>   | foo-flav1.pkg |
                       /+++++++++++++++\       /      |               |
/++++++++++\           |               |       |      \+++++++++++++++/
|          | ======>   | work-flavor1/ | ======*
| Makefile |           |               |       |
|          | ====\     \+++++++++++++++/       |       /+++++++++++++++\
\++++++++++/     |                             \       |               |
                 |         /+++++++++++++++\    ===>   | foo-flav2.pkg |
                 |         |               |           |               |
                 \======>  | work-flavor2/ |           \+++++++++++++++/
                           |               |
                           \+++++++++++++++/

Now, what are

When do I use options?

When do I use subpackages?

When do I use flavors?

When do I use master/slave ports?