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 is an older version of Lua needed only for compatibility with other programs such as Wireshark-3.6.7.
This package is known to build and work properly using an LFS-11.2 platform.
Download (HTTP): https://www.lua.org/ftp/lua-5.2.4.tar.gz
Download MD5 sum: 913fdb32207046b273fdb17aad70be13
Download size: 248 KB
Estimated disk space required: 3.6 MB
Estimated build time: less than 0.1 SBU
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/lua
Some packages check for the pkg-config file for Lua, which is created with:
cat > lua.pc << "EOF"
V=5.2
R=5.2.4
prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include/lua5.2
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/lua5.2
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua5.2 -lm -ldl
Cflags: -I${includedir}
EOF
Install Lua by running the following commands:
patch -Np1 -i ../lua-5.2.4-shared_library-1.patch && sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h && sed -r -e '/^LUA_(SO|A|T)=/ s/lua/lua5.2/' \ -e '/^LUAC_T=/ s/luac/luac5.2/' \ -i src/Makefile && make MYCFLAGS="-fPIC" linux
The installation of this package is complex, so we will use the DESTDIR method of installation:
make TO_BIN='lua5.2 luac5.2' \ TO_LIB="liblua5.2.so liblua5.2.so.5.2 liblua5.2.so.5.2.4" \ INSTALL_DATA="cp -d" \ INSTALL_TOP=$PWD/install/usr \ INSTALL_INC=$PWD/install/usr/include/lua5.2 \ INSTALL_MAN=$PWD/install/usr/share/man/man1 \ install && install -Dm644 lua.pc install/usr/lib/pkgconfig/lua52.pc && mkdir -pv install/usr/share/doc/lua-5.2.4 && cp -v doc/*.{html,css,gif,png} install/usr/share/doc/lua-5.2.4 && ln -s liblua5.2.so install/usr/lib/liblua.so.5.2 && ln -s liblua5.2.so install/usr/lib/liblua.so.5.2.4 && mv install/usr/share/man/man1/{lua.1,lua5.2.1} && mv install/usr/share/man/man1/{luac.1,luac5.2.1}
Now, as the root
user:
chown -R root:root install && cp -a install/* /
sed -i ... src/luaconf.h: This command changes the Lua search path to match the install path.
sed -i ... src/Makefile: This command deconflicts this installation with the latest version of lua.