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