Install Lua

From PLplotWiki
Jump to: navigation, search

In order for the high-class Lua bindings and examples for PLplot to work you must install Lua on your Windows platform.

The Lua build only takes a minute or so. Thus the simplest way to install Lua is to first install MinGW/MSYS (if you haven't done so already). Then use that compiler and associated build tools to build Lua on Windows with the following steps:

  • Put both MinGW and MSYS on your PATH. This puts all sorts of command-line tools at your fingertips that will be used in the further steps.
  • Set the LUA_PREFIX variable which points to the directory used for all further steps. Under bash (available as part of MSYS), I set "LUA_PREFIX=/z/home/wine/newstart/lua/", but use whatever is convenient for you.
  • Create that directory if it doesn't exist already and change directory to that location using the following commands:
    • mkdir -p $LUA_PREFIX
    • cd $LUA_PREFIX
  • Download http://www.lua.org/ftp/lua-5.1.4.tar.gz in that location.
  • Unpack, build, and install Lua using the following commands (where that last "cp -a" command works around a bug in the lua-5.1.4 build system for MinGW/MSYS):
    • tar zxf lua-5.1.4.tar.gz
    • cd lua-5.1.4
    • make mingw >& make_mingw.out
    • make install INSTALL_TOP=$LUA_PREFIX/install >& make_install.out
    • cp -a src/lua51.dll $LUA_PREFIX/install/bin

To make Lua accessible to the PLplot CMake-based build system, you must put the lua command on your PATH (using "PATH=$LUA_PREFIX/install/bin:$PATH") and use the following cmake options for your PLplot build:

  • -DLUA_INCLUDE_DIR:PATH=$LUA_PREFIX/install/include
  • -DLUA_LIBRARY:FILEPATH=$LUA_PREFIX/install/lib/liblua.a