xref: /freebsd/share/mk/src.lua.mk (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1#
2# Lua helper file for FreeBSD /usr/src builds.
3#
4# This file provides any necessary assistance for consumers of Lua in the base
5# system.
6
7.if !target(__<src.lua.mk>__)
8__<src.lua.mk>__:
9
10.include <bsd.own.mk>
11
12#
13# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been
14# installed to, along with the name of the internal command.  The default
15# name is flua.
16#
17# LUA_CMD can be overwritten to point to a Lua that isn't flua.  This is fine,
18# but parts of the src build that use it may have certain expectations that
19# may only be fulfilled by the in-tree Lua.  The user overwriting it is expected
20# to understand these and provide the expectations.
21#
22# flua is currently equivalent to Lua 5.3, with the following modules:
23# - luafilesystem
24# - lua-posix
25#
26LUA_INSTALL_PATH?=	${LIBEXECDIR}
27LUA_CMD?=		flua
28
29#
30# Some standalone usage may want a variable that tries to find the lua command,
31# and cannot necessarily embed the logic for trying to find it amongst bootstrap
32# tools.  For these, we provide the LUA variable.
33#
34# The LUA variable should point to LUA_CMD on the system, if it exists.
35# Otherwise, consumers will have to settle for a PATH search and PATH being
36# appropriately set.
37#
38.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD})
39LUA=	${LUA_INSTALL_PATH}/${LUA_CMD}
40.else
41LUA?=	${LUA_CMD}
42.endif
43
44.endif #  !target(__<src.lua.mk>__)
45