6.22. 使用 Lua

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

6.22.1. 楔子

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.22.2. Version Selection

A port using Lua only needs to have this line:

USES=	lua

If a specific version of Lua is needed, instructions on how to select it are given in the USES=lua part of 章 15, Using USES Macros.

6.22.3. Defined Variables

These variables are available in the port.

表格 6.37. Variables Defined for Ports That Use Lua
名字描述
LUA_VERThe Lua version that is going to be used (for example, 5.1)
LUA_VER_STRThe Lua version without the dots (for example, 51)
LUA_PREFIXThe prefix where Lua (and components) is installed
LUA_SUBDIRThe directory under ${PREFIX}/bin, ${PREFIX}/share and ${PREFIX}/lib where Lua is installed
LUA_INCDIRThe directory where Lua and tolua header files are installed
LUA_LIBDIRThe directory where Lua and tolua libraries are installed
LUA_MODLIBDIRThe directory where Lua module libraries (.so) are installed
LUA_MODSHAREDIRThe directory where Lua modules (.lua) are installed
LUA_PKGNAMEPREFIXThe package name prefix used by Lua modules
LUA_CMDThe path to the Lua interpreter
LUAC_CMDThe path to the Lua compiler

本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/

若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢 <questions@FreeBSD.org>。

關於本文件的問題,請洽詢 <doc@FreeBSD.org>。