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