#### Beyond Linux® From Scratch (systemd Edition) - Version 11.1

### Chapter 13. Programming

- Prev

  LLVM-13.0.1

- Next

  Lua-5.2.4

- Up
- Home

# Lua-5.4.4

## Introduction to Lua

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-11.1 platform.

### Package Information

- Download (HTTP): https://www.lua.org/ftp/lua-5.4.4.tar.gz

- Download MD5 sum: bd8ce7069ff99a400efd14cf339a727b

- Download size: 356 KB

- Estimated disk space required: 5.8 MB (with Basic tests)

- Estimated build time: less than 0.1 SBU (with Basic tests)

### Additional Downloads

- Required patch: https://www.linuxfromscratch.org/patches/blfs/11.1/lua-5.4.4-shared_library-1.patch

- Optional Test Suite Download (HTTP): https://www.lua.org/tests/lua-5.4.4-tests.tar.gz

- Optional Test Suite Download MD5 sum: 0e28a9b48b3596d6b12989d04ae403c4

- Optional Test Suite Download size: 132 KB

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/lua

## Installation of Lua

Some packages check for the pkg-config file for Lua, which is created with:

    cat > lua.pc << "EOF"
    V=5.4
    R=5.4.4

    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}
    EOF

Install Lua by running the following commands:

    patch -Np1 -i ../lua-5.4.4-shared_library-1.patch &&
    make linux

To test the results, issue: make test. “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.

Now, 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.4" \
         install &&

    mkdir -pv                      /usr/share/doc/lua-5.4.4 &&
    cp -v doc/*.{html,css,gif,png} /usr/share/doc/lua-5.4.4 &&

    install -v -m644 -D lua.pc /usr/lib/pkgconfig/lua.pc

Here we describe only the "Basic tests". Untar the tarball and change to the `lua-5.4.4-tests` directory, then issue lua -e "_U=true" all.lua. If the tests finish without error, you will see a message containing the string "final OK".

## Contents

Installed Programs: lua and luac
Installed Library: liblua.so
Installed Directories: /usr/{lib,share}/lua and /usr/share/doc/lua-5.4.4

### Short Descriptions

lua | is the standalone Lua interpreter
luac | is the Lua compiler
`liblua.so` | contains the Lua API functions

Last updated on

- Prev

  LLVM-13.0.1

- Next

  Lua-5.2.4

- Up
- Home