English French (fr_FR)
Chapter 7. Flavors
Flavors
An Introduction to Flavors
Flavors are a way to have multiple variations of a port. The port is built multiple times, with variations.
For example, a port can have a normal version with many features and quite a few dependencies, and a light "lite" version with only basic features and minimal dependencies.
Another example could be, a port can have a GTK flavor and a QT flavor, depending on which toolkit it uses.
Using FLAVORS
To declare a port having multiple flavors, add `FLAVORS` to its [.filename]#Makefile#. The first flavor in `FLAVORS` is the default flavor.
It can help simplify the logic of the [.filename]#Makefile# to also define `FLAVOR` as:
FLAVOR?= ${FLAVORS:[1]}
To distinguish flavors from options, which are always uppercase letters, flavor names can _only_ contain lowercase letters, numbers, and the underscore `_`.
Basic Flavors Usage
If a port has a "lite" slave port, the slave port can be removed, and the port can be converted to flavors with:
FLAVORS= default lite
lite_PKGNAMESUFFIX= -lite
[...]
.if ${FLAVOR:U} != lite
[enable non lite features]
.endif
Another Basic Flavors Usage
If a port has a `-nox11` slave port, the slave port can be removed, and the port can be converted to flavors with:
FLAVORS= x11 nox11
FLAVOR?= ${FLAVORS:[1]}
nox11_PKGNAMESUFFIX= -nox11
[...]
.if ${FLAVOR} == x11
[enable x11 features]
.endif
More Complex Flavors Usage
Here is a slightly edited excerpt of what is present in package:devel/libpeas[], a port that uses the <<flavors-auto-python,Python flavors>>. With the default Python 2 and 3 versions being 2.7 and 3.6, it will automatically get `FLAVORS=py27 py36`
USES= gnome python
USE_PYTHON= flavors