Lua is a powerful light-weight programming language designed for extending applications. It is also frequently used as a general-purpose, stand-alone language. Lua is implemented as a small library of C functions, written in ANSI C, and compiles unmodified in all known platforms. The implementation goals are simplicity, efficiency, portability, and low embedding cost. The result is a fast language engine with small footprint, making it ideal in embedded systems too.
This package is known to build and work properly using an LFS 12.4 platform.
Download (HTTP): https://www.lua.org/ftp/lua-5.4.8.tar.gz
Download SHA256 Sum: 4f18ddae154e793e46eeab727c59ef1c0c0c2b744e7b94219710d76f530629ae
Download MD5 sum: 81cf5265b8634967d8a7480d238168ce
Download size: 1,292.9 KB
Estimated disk space required: 3,568.8 KB
Estimated build time: less than 0.1 SBU
Required patch: https://www.linuxfromscratch.org/patches/downloads/lua/lua-5.4.8-shared_library-1.patch
Patch SHA256 Sum: 44324a802822f0a35d095aaad2f5f58fa7b1821ae87ae44dbcfc8a23fcd2e67e
Optional Test Suite Download (HTTP): https://www.lua.org/tests/lua-5.4.8-tests.tar.gz
Optional Test Suite Download SHA256 Sum: 9581d5a7c39ffbf29b8ccde2709083c380f7bbddbd968dcb15712d2f2e33f4e5
Optional Test Suite Download MD5 sum: eafc6cebee86ce2e931b2c2f335de18e
Optional Test Suite Download size: 134 KB
Some packages check for the pkg-config file for Lua, which is created with:
cat > lua.pc << "EOF"
V=5.4
R=5.4.8
prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm -ldl
Cflags: -I${includedir}
EOFPrepare Lua by running the following commands:
patch -Np1 -i ../lua-5.4.8-shared_library-1.patch
To Build the package, issue:
make linux
“This will run the interpreter and print its version.” More comprehensive tests can be performed if you downloaded the "Test suite" tarball. Those tests need to be executed after the package is installed, thus we defer to the description below. To test the results, issue:
make test
Now Install the package, as the root user:
make INSTALL_TOP=/usr \
INSTALL_DATA="cp -d" \
INSTALL_MAN=/usr/share/man/man1 \
TO_LIB="liblua.so liblua.so.5.4 liblua.so.5.4.8" \
install
mkdir -pv /usr/share/doc/lua-5.4.8
cp -v doc/*.{html,css,gif,png} /usr/share/doc/lua-5.4.8
install -v -m644 -D lua.pc /usr/lib/pkgconfig/lua.pcIf the tests finish without error, you will see a message containing the string "final OK". Extract the downloaded tarball and change to the directory, by running the following commands:
tar -xf ../lua-5.4.8-tests.tar.gz cd lua-5.4.8-tests lua -e "_U=true" all.lua