freebsd-skq/share/mk/src.lua.mk
Kyle Evans 506f364029 Add flua to the base system, install to /usr/libexec
FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever
extensions we need for base system operations. We currently support a subset
of lfs and lposix that are used in the rewrite of makesyscall.sh into lua,
added in r354786.

flua is intentionally written such that one can install standard lua and
some set of lua modules from ports and achieve the same effect.

linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added
in. This is similar to what we do in stand/. linit.c has been renamed to
make it clear that this has flua-specific bits.

luaconf has been slightly obfuscated to make extensions more difficult. Part
of the problem is that flua is already hard enough to use as a bootstrap
tool because it's not in PATH- attempting to do extension loading would
require a special bootstrap version of flua with paths changed to protect
the innocent.

src.lua.mk has been added to make it easy for in-tree stuff to find flua,
whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1.

Reviewed by:	brooks, emaste (both earlier version), imp
Differential Revision:	https://reviews.freebsd.org/D21893
2019-11-18 23:21:13 +00:00

46 lines
1.4 KiB
Makefile

# $FreeBSD$
#
# Lua helper file for FreeBSD /usr/src builds.
#
# This file provides any necessary assistance for consumers of Lua in the base
# system.
.if !target(__<src.lua.mk>__)
__<src.lua.mk>__:
.include <bsd.own.mk>
#
# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been
# installed to, along with the name of the internal command. The default
# name is flua.
#
# LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine,
# but parts of the src build that use it may have certain expectations that
# may only be fulfilled by the in-tree Lua. The user overwriting it is expected
# to understand these and provide the expectations.
#
# flua is currently equivalent to Lua 5.3, with the following modules:
# - luafilesystem
# - lua-posix
#
LUA_INSTALL_PATH?= ${LIBEXECDIR}
LUA_CMD?= flua
#
# Some standalone usage may want a variable that tries to find the lua command,
# and cannot necessarily embed the logic for trying to find it amongst bootstrap
# tools. For these, we provide the LUA variable.
#
# The LUA variable should point to LUA_CMD on the system, if it exists.
# Otherwise, consumers will have to settle for a PATH search and PATH being
# appropriately set.
#
.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD})
LUA= ${LUA_INSTALL_PATH}/${LUA_CMD}
.else
LUA?= ${LUA_CMD}
.endif
.endif # !target(__<src.lua.mk>__)