5.17. Use BINARY_ALIAS to Rename Commands Instead of Patching the Build

When BINARY_ALIAS is defined it will create symlinks of the given commands in a directory which will be prepended to PATH.

Use it to substitute hardcoded commands the build phase relies on without having to patch any build files.

Example 5.48. Using BINARY_ALIAS to Make gsed Available as sed

Some ports expect sed to behave like GNU sed and use features that sed(1) does not provide. GNU sed is available from textproc/gsed on FreeBSD.

Use BINARY_ALIAS to substitute sed with gsed for the duration of the build:

BUILD_DEPENDS=	gsed:textproc/gsed
...
BINARY_ALIAS=	sed=gsed

Example 5.49. Using BINARY_ALIAS to Provide Aliases for Hardcoded python3 Commands

A port that has a hardcoded reference to python3 in its build scripts will need to have it available in PATH at build time. Use BINARY_ALIAS to create an alias that points to the right Python 3 binary:

USES=	python:3.4+,build
...
BINARY_ALIAS=	python3=${PYTHON_CMD}

See Section 6.17, “Using Python” for more information about USES=python.


Note:

Binary aliases are created after the dependencies provided via BUILD_DEPENDS and LIB_DEPENDS are processed and before the configure target. This leads to various limitations. For example, programs installed via TEST_DEPENDS cannot be used to create a binary alias as test dependencies specified this way are processed after binary aliases are created.

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>.