6.18 Using Lua

This section describes the status of the Lua libraries in the ports tree and its integration with the ports system.

6.18.1 Introduction

There are many versions of the Lua libraries and corresponding interpreters, which conflict between them (install files under the same name). In the ports tree this problem has been solved by installing each version under a different name using version number suffixes.

The obvious disadvantage of this is that each application has to be modified to find the expected version. But it can be solved by adding some additional flags to the compiler and linker.

6.18.2 Version selection

To make your port use a specific version of Lua there are two variables available for defining (if only one is defined the other will be set to a default value):

The following is a list of available Lua versions and the corresponding ports in the tree:

The variables in Table 6-33 can be set to one or more of the following combinations separated by spaces:

There are also some variables to select the preferred versions from the available ones. They can be set to a list of versions, the first ones will have higher priority.

6.18.3 Component selection

There are other applications that, while not being Lua libraries, are related to them. These applications can be specified in the LUA_COMPS variable. The following components are available:

Note: There are more components but they are modules for the interpreter, not used by applications (only by other modules).

The dependency type can be selected for each component by adding a suffix separated by a semicolon. If not present then a default type will be used (see Table 6-39). The following types are available:

The default values for the components are detailed in the following table:

6.18.4 Detecting installed versions

To detect an installed version you have to define WANT_LUA. If you do not set it to a specific version then the components will have a version suffix. The HAVE_LUA variable will be filled after detection.

6.18.5 Defined variables

The following variables are available in the port (after defining one from Table 6-33).

6.18.6 Processing in bsd.port.pre.mk

If you need to use the variables for running commands right after including bsd.port.pre.mk you need to define LUA_PREMK.

Important: If you define LUA_PREMK, then the version, dependencies, components and defined variables will not change if you modify the Lua port variables after including bsd.port.pre.mk.

Note: The Lua variables can be safely used in commands when they are inside targets without the need of LUA_PREMK.

For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.