7.3. Flavors Auto-Activation

7.3.1. USES=php and Flavors

When using USES=php with one of these arguments, phpize, ext, zend, or pecl, the port will automatically have FLAVORS filled in with the PHP versions it supports.

Note:

All the examples assume the currently supported PHP versions are 5.6, 7.0, 7.1, and 7.2.

Example 7.5. Simple USES=php Extension

This will generate package for all the supported versions:

PORTNAME=	some-ext
PORTVERSION=	0.0.1
PKGNAMEPREFIX=	${PHP_PKGNAMEPREFIX}

USES=		php:ext

This will generate package for all the supported versions but 7.2:

PORTNAME=	some-ext
PORTVERSION=	0.0.1
PKGNAMEPREFIX=	${PHP_PKGNAMEPREFIX}

USES=		php:ext
IGNORE_WITH_PHP=	72

7.3.1.1. PHP Flavors with PHP Applications

PHP applications can also be flavorized.

This allows generating packages for all PHP versions, so that users can use them with whatever version they need on their servers.

Important:

PHP applications that are flavorized must append PHP_PKGNAMESUFFIX to their package names.

Example 7.6. Flavorizing a PHP Application

Adding Flavors support to a PHP application is straightforward:

PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}

USES=	php:flavors

7.3.2. USES=python and Flavors

When using USES=python and USE_PYTHON=distutils, the port will automatically have FLAVORS filled in with the Python versions it supports.

Example 7.7. Simple USES=python

Supposing the current Python supported versions are 2.7, 3.4, 3.5, and 3.6, and the default Python 2 and 3 versions are 2.7 and 3.6, a port with:

USES=	python
USE_PYTHON=	distutils

Will get these flavors: py27, and py36.

USES=	python
USE_PYTHON=	distutils allflavors

Will get these flavors: py27, py34, py35 and py36.


Example 7.8. USES=python with Version Requirements

Supposing the current Python supported versions are 2.7, 3.4, 3.5, and 3.6, and the default Python 2 and 3 versions are 2.7 and 3.6, a port with:

USES=	python:-3.5
USE_PYTHON=	distutils

Will get this flavor: py27.

USES=	python:-3.5
USE_PYTHON=	distutils allflavors

Will get these flavors: py27, py34, and py35.

USES=	python:3.4+
USE_PYTHON=	distutils

Will get this flavor: py36.

USES=	python:3.4+
USE_PYTHON=	distutils allflavors

Will get these flavors: py34, py35, and py36.


PY_FLAVOR will be available to depend on the correct version of Python modules. This is most useful for ports that are not Python modules and do not have Python flavors but do use python for some part of their operations.

Example 7.9. For a Port Not Using distutils

If the default Python 3 version is 3.6, the following will set PY_FLAVOR to py36:

RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}mutagen>0:audio/py-mutagen@${PY_FLAVOR}

USES=	python:3.5+

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.