We configure and install a basic Lua toolchain including LuaRocks for additional packages.
We will install Lua and LuaRocks as user in ~/.local
Lua executable will be in ~/.local/bin, man pages in /.local/man.
Let set that path in ~/.profile to the $PATH and $MANPATH
# PATH to $HOME/.local/bin
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# MANPATH to $HOME/.local/man
if [ -d "$HOME/.local/man" ] ; then
MANPATH=:"$HOME/.local/man"
fi
Download and unpack latest Lua-5.3 archive http://www.lua.org/ftp
Go inside the extracted archive and type make
$ make
Please do 'make PLATFORM' where PLATFORM is one of these:
aix bsd c89 freebsd generic linux macosx mingw posix solaris
See doc/readme.html for complete instructions.
It will prompt all the available platform. Choose yours and go head, substitute bsd with your platform and install it locally with one command:
$ make bsd install INSTALL_TOP=$HOME/.local
Check your Lua installation, reload your environment or do a logout and login again. Now, Lua should work, including its man page:
$ lua -v
Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio
$ man lua
Download and unpack latest luarocks file https://luarocks.github.io/luarocks/releases/
Go inside the extracted archive, tell configure with the prefix to install locally and where are the Lua inclue. Then build and install:
$ ./configure --prefix=$HOME/.local --with-lua-include=$HOME/.local/include
$ make
$ make install
Lua and LuaRocks should work.
Let's install some local additional packages that would be available for every Lua project.
We cannot live anymore without formatting the code. Install luaformatter via the dev repositry as following:
$ luarocks install --server=https://luarocks.org/dev luaformatter
LuaCheck is a statistic analysis tool and is useful to lint your project. Install LuaCheck as following:
$ luarocks install luacheck