1*21d3294cSantirezINSTALL for Lua 5.1 2*21d3294cSantirez 3*21d3294cSantirez* Building Lua 4*21d3294cSantirez ------------ 5*21d3294cSantirez Lua is built in the src directory, but the build process can be 6*21d3294cSantirez controlled from the top-level Makefile. 7*21d3294cSantirez 8*21d3294cSantirez Building Lua on Unix systems should be very easy. First do "make" and 9*21d3294cSantirez see if your platform is listed. If so, just do "make xxx", where xxx 10*21d3294cSantirez is your platform name. The platforms currently supported are: 11*21d3294cSantirez aix ansi bsd freebsd generic linux macosx mingw posix solaris 12*21d3294cSantirez 13*21d3294cSantirez If your platform is not listed, try the closest one or posix, generic, 14*21d3294cSantirez ansi, in this order. 15*21d3294cSantirez 16*21d3294cSantirez See below for customization instructions and for instructions on how 17*21d3294cSantirez to build with other Windows compilers. 18*21d3294cSantirez 19*21d3294cSantirez If you want to check that Lua has been built correctly, do "make test" 20*21d3294cSantirez after building Lua. Also, have a look at the example programs in test. 21*21d3294cSantirez 22*21d3294cSantirez* Installing Lua 23*21d3294cSantirez -------------- 24*21d3294cSantirez Once you have built Lua, you may want to install it in an official 25*21d3294cSantirez place in your system. In this case, do "make install". The official 26*21d3294cSantirez place and the way to install files are defined in Makefile. You must 27*21d3294cSantirez have the right permissions to install files. 28*21d3294cSantirez 29*21d3294cSantirez If you want to build and install Lua in one step, do "make xxx install", 30*21d3294cSantirez where xxx is your platform name. 31*21d3294cSantirez 32*21d3294cSantirez If you want to install Lua locally, then do "make local". This will 33*21d3294cSantirez create directories bin, include, lib, man, and install Lua there as 34*21d3294cSantirez follows: 35*21d3294cSantirez 36*21d3294cSantirez bin: lua luac 37*21d3294cSantirez include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp 38*21d3294cSantirez lib: liblua.a 39*21d3294cSantirez man/man1: lua.1 luac.1 40*21d3294cSantirez 41*21d3294cSantirez These are the only directories you need for development. 42*21d3294cSantirez 43*21d3294cSantirez There are man pages for lua and luac, in both nroff and html, and a 44*21d3294cSantirez reference manual in html in doc, some sample code in test, and some 45*21d3294cSantirez useful stuff in etc. You don't need these directories for development. 46*21d3294cSantirez 47*21d3294cSantirez If you want to install Lua locally, but in some other directory, do 48*21d3294cSantirez "make install INSTALL_TOP=xxx", where xxx is your chosen directory. 49*21d3294cSantirez 50*21d3294cSantirez See below for instructions for Windows and other systems. 51*21d3294cSantirez 52*21d3294cSantirez* Customization 53*21d3294cSantirez ------------- 54*21d3294cSantirez Three things can be customized by editing a file: 55*21d3294cSantirez - Where and how to install Lua -- edit Makefile. 56*21d3294cSantirez - How to build Lua -- edit src/Makefile. 57*21d3294cSantirez - Lua features -- edit src/luaconf.h. 58*21d3294cSantirez 59*21d3294cSantirez You don't actually need to edit the Makefiles because you may set the 60*21d3294cSantirez relevant variables when invoking make. 61*21d3294cSantirez 62*21d3294cSantirez On the other hand, if you need to select some Lua features, you'll need 63*21d3294cSantirez to edit src/luaconf.h. The edited file will be the one installed, and 64*21d3294cSantirez it will be used by any Lua clients that you build, to ensure consistency. 65*21d3294cSantirez 66*21d3294cSantirez We strongly recommend that you enable dynamic loading. This is done 67*21d3294cSantirez automatically for all platforms listed above that have this feature 68*21d3294cSantirez (and also Windows). See src/luaconf.h and also src/Makefile. 69*21d3294cSantirez 70*21d3294cSantirez* Building Lua on Windows and other systems 71*21d3294cSantirez ----------------------------------------- 72*21d3294cSantirez If you're not using the usual Unix tools, then the instructions for 73*21d3294cSantirez building Lua depend on the compiler you use. You'll need to create 74*21d3294cSantirez projects (or whatever your compiler uses) for building the library, 75*21d3294cSantirez the interpreter, and the compiler, as follows: 76*21d3294cSantirez 77*21d3294cSantirez library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c 78*21d3294cSantirez lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c 79*21d3294cSantirez ltable.c ltm.c lundump.c lvm.c lzio.c 80*21d3294cSantirez lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c 81*21d3294cSantirez ltablib.c lstrlib.c loadlib.c linit.c 82*21d3294cSantirez 83*21d3294cSantirez interpreter: library, lua.c 84*21d3294cSantirez 85*21d3294cSantirez compiler: library, luac.c print.c 86*21d3294cSantirez 87*21d3294cSantirez If you use Visual Studio .NET, you can use etc/luavs.bat in its 88*21d3294cSantirez "Command Prompt". 89*21d3294cSantirez 90*21d3294cSantirez If all you want is to build the Lua interpreter, you may put all .c files 91*21d3294cSantirez in a single project, except for luac.c and print.c. Or just use etc/all.c. 92*21d3294cSantirez 93*21d3294cSantirez To use Lua as a library in your own programs, you'll need to know how to 94*21d3294cSantirez create and use libraries with your compiler. 95*21d3294cSantirez 96*21d3294cSantirez As mentioned above, you may edit luaconf.h to select some features before 97*21d3294cSantirez building Lua. 98*21d3294cSantirez 99*21d3294cSantirez(end of INSTALL) 100