diff options
Diffstat (limited to 'libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html')
-rw-r--r-- | libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html b/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html new file mode 100644 index 0000000..bc5a3cd --- /dev/null +++ b/libraries/LuaJIT-1.1.7/jitdoc/luajit_install.html | |||
@@ -0,0 +1,340 @@ | |||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>Installing LuaJIT</title> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | ||
6 | <meta name="Author" content="Mike Pall"> | ||
7 | <meta name="Copyright" content="Copyright (C) 2005-2011, Mike Pall"> | ||
8 | <meta name="Language" content="en"> | ||
9 | <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen"> | ||
10 | <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print"> | ||
11 | <style type="text/css"> | ||
12 | table.build { | ||
13 | line-height: 1.2; | ||
14 | } | ||
15 | td.buildsys { | ||
16 | width: 11em; | ||
17 | } | ||
18 | td.buildcmd { | ||
19 | width: 10em; | ||
20 | font-family: Courier New, Courier, monospace; | ||
21 | } | ||
22 | tr.buildhead td { | ||
23 | /* font-family: inherit; ... not supported in IE *sigh* */ | ||
24 | font-family: Verdana, Arial, Helvetica, sans-serif; | ||
25 | font-weight: bold; | ||
26 | } | ||
27 | </style> | ||
28 | </head> | ||
29 | <body> | ||
30 | <div id="site"> | ||
31 | <a href="http://luajit.org/"><span>Lua<span id="logo">JIT</span></span></a> | ||
32 | </div> | ||
33 | <div id="head"> | ||
34 | <h1>Installing LuaJIT</h1> | ||
35 | </div> | ||
36 | <div id="nav"> | ||
37 | <ul><li> | ||
38 | <a href="index.html">Index</a> | ||
39 | </li><li> | ||
40 | <a href="luajit.html">LuaJIT</a> | ||
41 | <ul><li> | ||
42 | <a href="luajit_features.html">Features</a> | ||
43 | </li><li> | ||
44 | <a class="current" href="luajit_install.html">Installation</a> | ||
45 | </li><li> | ||
46 | <a href="luajit_run.html">Running</a> | ||
47 | </li><li> | ||
48 | <a href="luajit_api.html">API Extensions</a> | ||
49 | </li><li> | ||
50 | <a href="luajit_intro.html">Introduction</a> | ||
51 | </li><li> | ||
52 | <a href="luajit_performance.html">Performance</a> | ||
53 | </li><li> | ||
54 | <a href="luajit_debug.html">Debugging</a> | ||
55 | </li><li> | ||
56 | <a href="luajit_changes.html">Changes</a> | ||
57 | </li></ul> | ||
58 | </li><li> | ||
59 | <a href="coco.html">Coco</a> | ||
60 | <ul><li> | ||
61 | <a href="coco_portability.html">Portability</a> | ||
62 | </li><li> | ||
63 | <a href="coco_api.html">API Extensions</a> | ||
64 | </li><li> | ||
65 | <a href="coco_changes.html">Changes</a> | ||
66 | </li></ul> | ||
67 | </li><li> | ||
68 | <a href="dynasm.html">DynASM</a> | ||
69 | <ul><li> | ||
70 | <a href="dynasm_features.html">Features</a> | ||
71 | </li><li> | ||
72 | <a href="dynasm_examples.html">Examples</a> | ||
73 | </li></ul> | ||
74 | </li><li> | ||
75 | <a href="http://luajit.org/download.html">Download <span class="ext">»</span></a> | ||
76 | </li></ul> | ||
77 | </div> | ||
78 | <div id="main"> | ||
79 | <p> | ||
80 | LuaJIT is not much more difficult to install than Lua itself. | ||
81 | Just unpack the distribution file, change into the newly created | ||
82 | directory and follow the instructions below. | ||
83 | </p> | ||
84 | <p class="indent"> | ||
85 | For the impatient: <b><tt>make linux && sudo make install</tt></b><br> | ||
86 | Replace <tt>linux</tt> with e.g. <tt>bsd</tt> or <tt>macosx</tt> depending on your OS. | ||
87 | </p> | ||
88 | <p> | ||
89 | In case you've missed this in <a href="luajit_features.html">Features</a>: | ||
90 | LuaJIT only works on x86 (i386+) systems right now. Support for | ||
91 | other architectures may be added in future versions. | ||
92 | </p> | ||
93 | |||
94 | <h2>Configuring LuaJIT</h2> | ||
95 | <p> | ||
96 | LuaJIT is (deliberately) <em>not</em> autoconfigured — the | ||
97 | defaults should work fine on most systems. But please check the | ||
98 | system-specific instructions below. | ||
99 | </p> | ||
100 | <p> | ||
101 | The following three files hold all configuration information: | ||
102 | </p> | ||
103 | <ul> | ||
104 | <li><tt>Makefile</tt> holds settings for installing LuaJIT.</li> | ||
105 | <li><tt>src/Makefile</tt> holds settings for compiling LuaJIT.</li> | ||
106 | <li><tt>src/luaconf.h</tt> sets a multitude of configuration | ||
107 | variables.</li> | ||
108 | </ul> | ||
109 | <p> | ||
110 | If this is your first build then it's better not to give into | ||
111 | the temptation to tweak every little setting. The standard | ||
112 | configuration provides sensible defaults (IMHO). | ||
113 | </p> | ||
114 | <p> | ||
115 | One particular setting you might want to change is the installation | ||
116 | path. Note that you need to modify both the top-level <tt>Makefile</tt> | ||
117 | and <tt>src/luaconf.h</tt> (right at the start) to take | ||
118 | effect. | ||
119 | </p> | ||
120 | <p> | ||
121 | If you have trouble getting Coco to work, you can disable it by | ||
122 | uncommenting the <tt>COCOFLAGS= -DCOCO_DISABLE</tt> line in | ||
123 | <tt>src/Makefile</tt>. But note that this effectively disables | ||
124 | yielding from coroutines for JIT compiled functions. | ||
125 | </p> | ||
126 | <p> | ||
127 | A few more settings need to be changed if you want to | ||
128 | <a href="luajit_debug.html">Debug LuaJIT</a> <em>itself</em>. | ||
129 | Application debugging can be turned on/off at runtime. | ||
130 | </p> | ||
131 | |||
132 | <h3>Upgrading From Previous Versions</h3> | ||
133 | <p> | ||
134 | It's important to keep the LuaJIT core and the add-on modules in sync. | ||
135 | Be sure to delete any old versions of LuaJIT modules from the | ||
136 | Lua module search path (check the current directory, too!). | ||
137 | </p> | ||
138 | <p> | ||
139 | Lua files compiled to bytecode may be incompatible if the underlying | ||
140 | Lua core has changed (like from Lua 5.1 alpha to Lua 5.1 | ||
141 | final between LuaJIT 1.0.3 and LuaJIT 1.1.0). The same | ||
142 | applies to any | ||
143 | <a href="http://lua-users.org/wiki/BuildingModules"><span class="ext">»</span> loadable C modules</a> | ||
144 | (shared libraries, DLLs) which need to be recompiled with the new | ||
145 | Lua header files. | ||
146 | </p> | ||
147 | <p> | ||
148 | Compiled bytecode and loadable C modules are fully compatible and | ||
149 | can be freely exchanged between LuaJIT and the <em>same</em> | ||
150 | version of Lua it is based on. Please verify that <tt>LUA_RELEASE</tt> | ||
151 | in <tt>src/lua.h</tt> is the same in both distributions. | ||
152 | </p> | ||
153 | |||
154 | <h2>Building LuaJIT</h2> | ||
155 | |||
156 | <h3>Makefile Targets</h3> | ||
157 | <p> | ||
158 | The Makefiles have a number of targets for various operating systems: | ||
159 | </p> | ||
160 | |||
161 | <div class="tablewrap"> | ||
162 | <table class="build"> | ||
163 | <tr class="buildhead"><td class="buildsys">System</td><td class="buildcmd">Build Command</td><td>Notes</td></tr> | ||
164 | <tr class="odd"><td class="buildsys">Linux i386</td><td class="buildcmd">make linux</td><td></td></tr> | ||
165 | <tr class="even"><td class="buildsys">BSD i386</td><td class="buildcmd">make bsd</td><td>FreeBSD, NetBSD or OpenBSD</td></tr> | ||
166 | <tr class="odd"><td class="buildsys">Mac OS X on Intel</td><td class="buildcmd">make macosx</td><td>Check <tt>src/Makefile</tt> for OS X < 10.4</td></tr> | ||
167 | <tr class="even"><td class="buildsys">Solaris x86</td><td class="buildcmd">make solaris</td><td>GCC only, SunCC miscompiles LuaJIT</td></tr> | ||
168 | <tr class="odd"><td class="buildsys">MinGW (Win32)</td><td class="buildcmd">make mingw</td><td>cross-MinGW: must be 1st in PATH</td></tr> | ||
169 | <tr class="even"><td class="buildsys">Cygwin</td><td class="buildcmd">make cygwin</td><td></td></tr> | ||
170 | <tr class="odd"><td class="buildsys">POSIX on x86</td><td class="buildcmd">make posix</td><td>Check <a href="coco_portability.html">Portability Req. for Coco</a>, too</td></tr> | ||
171 | <tr class="even"><td class="buildsys">Generic x86</td><td class="buildcmd">make generic</td><td>Check <a href="coco_portability.html">Portability Req. for Coco</a>, too</td></tr> | ||
172 | </table> | ||
173 | </div> | ||
174 | |||
175 | <p> | ||
176 | You may want to enable interactive line editing for the stand-alone | ||
177 | executable. There are extra targets for Linux, BSD and Mac OS X: | ||
178 | <tt>make linux_rl</tt>, <tt>make bsd_rl</tt> | ||
179 | and <tt>make macosx_rl</tt>. | ||
180 | </p> | ||
181 | |||
182 | <h3>MSVC (Win32)</h3> | ||
183 | <p> | ||
184 | First check out <tt>etc\luavs.bat</tt> if it suits your needs. Then try | ||
185 | running it from the MSVC command prompt (start it from the toplevel directory). | ||
186 | </p> | ||
187 | <p> | ||
188 | Another option is to set up your own MSVC project: | ||
189 | </p> | ||
190 | <p> | ||
191 | Change to the <tt>src</tt> directory | ||
192 | and create a new DLL project for <tt>lua51.dll</tt>. | ||
193 | Add all C files to it except for <tt>lua.c</tt>, <tt>luac.c</tt> | ||
194 | and <tt>print.c</tt>. Add the <tt>..\dynasm</tt> directory | ||
195 | to the include path and build the DLL. | ||
196 | </p> | ||
197 | <p> | ||
198 | Next create a new EXE project for <tt>luajit.exe</tt>. | ||
199 | Add <tt>lua.c</tt> to it and link with the import library | ||
200 | <tt>lua51.lib</tt> created for <tt>lua51.dll</tt>. Build | ||
201 | the executable. | ||
202 | </p> | ||
203 | |||
204 | <h2>Installation</h2> | ||
205 | |||
206 | <h3>POSIX systems</h3> | ||
207 | <p> | ||
208 | Run <tt>make install</tt> from the top-level directory. | ||
209 | You probably need to be the root user before doing so, i.e. use | ||
210 | <tt>sudo make install</tt> or <tt>su - root</tt> | ||
211 | before the <tt>make install</tt>. | ||
212 | </p> | ||
213 | <p> | ||
214 | By default this installs only:<br> | ||
215 | <tt> /usr/local/bin/<strong>luajit</strong></tt> — The stand-alone executable.<br> | ||
216 | <tt> /usr/local/lib/lua/5.1</tt> — C module directory.<br> | ||
217 | <tt> /usr/local/share/lua/5.1</tt> — Lua module directory.<br> | ||
218 | <tt> /usr/local/share/lua/5.1/<strong>jit/*.lua</strong></tt> — | ||
219 | <tt>jit.*</tt> modules.<br> | ||
220 | </p> | ||
221 | <p> | ||
222 | The Lua docs and includes are not installed to avoid overwriting | ||
223 | an existing Lua installation. In any case these are identical | ||
224 | to the version of Lua that LuaJIT is based on. If you want | ||
225 | to install them, edit the top-level makefile (look for <tt>###</tt>). | ||
226 | </p> | ||
227 | <p> | ||
228 | The stand-alone Lua bytecode compiler <tt>luac</tt> is neither | ||
229 | built nor installed, for the same reason. If you really need it, | ||
230 | you may be better off with <tt>luac</tt> built from the original Lua | ||
231 | distribution (use the <em>same</em> version your copy of LuaJIT | ||
232 | is based on). This avoids dragging in most of LuaJIT which is not | ||
233 | needed for the pure bytecode compiler. You can also use the bare-bones | ||
234 | Lua to bytecode translator <tt>luac.lua</tt> (look in the <tt>test</tt> | ||
235 | directory of the original Lua distribution). | ||
236 | </p> | ||
237 | |||
238 | <h3>Windows</h3> | ||
239 | <p> | ||
240 | Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> | ||
241 | to a newly created directory (any location is ok). Add <tt>lua</tt> | ||
242 | and <tt>lua\jit</tt> directories below it and copy all Lua files | ||
243 | from the <tt>jit</tt> directory of the distribution to the latter directory. | ||
244 | </p> | ||
245 | <p> | ||
246 | There are no hardcoded | ||
247 | absolute path names — all modules are loaded relative to the | ||
248 | directory where <tt>luajit.exe</tt> is installed | ||
249 | (see <tt>src/luaconf.h</tt>). | ||
250 | </p> | ||
251 | |||
252 | <h2 id="embedding">Embedding LuaJIT</h2> | ||
253 | <p> | ||
254 | It's strongly recommended that you build the stand-alone executable | ||
255 | with your toolchain and verify that it works <em>before</em> starting | ||
256 | to embed LuaJIT into an application. The stand-alone executable is | ||
257 | also useful later on, when you want to experiment with code snippets | ||
258 | or try out some Lua files. | ||
259 | </p> | ||
260 | <p> | ||
261 | Please consult the Lua docs for general information about how to | ||
262 | embed Lua into your application. The following list only shows | ||
263 | the additional steps needed for embedding LuaJIT: | ||
264 | </p> | ||
265 | <ul> | ||
266 | <li>You need to add the LuaJIT library functions by running | ||
267 | <tt>luaopen_jit()</tt> after all the other standard library functions. | ||
268 | The modified <tt>src/linit.c</tt> used by the stand-alone executable | ||
269 | already does this for you.</li> | ||
270 | <li><em>Caveat:</em> LuaJIT is based on Lua 5.1 which | ||
271 | means the <tt>luaopen_*()</tt> functions <em>must not</em> | ||
272 | be called directly. See <tt>src/linit.c</tt> for the proper way to | ||
273 | run them. You'll get an error initializing the <tt>io</tt> library | ||
274 | if you don't follow these instructions.</li> | ||
275 | <li>To use the optimizer (strongly recommended) you need to: | ||
276 | <ul> | ||
277 | <li>Install the optimizer modules <tt>jit.opt</tt> and | ||
278 | <tt>jit.opt_inline</tt> relative to the Lua module path | ||
279 | (you've probably modified it — see <tt>src/luaconf.h</tt>):<br> | ||
280 | <tt>jit/opt.lua</tt><br> | ||
281 | <tt>jit/opt_inline.lua</tt></li> | ||
282 | <li>If you want to ship a single executable then you may want to | ||
283 | embed the optimizer modules into your application (but don't loose | ||
284 | time with this during the early development phase). This involves: | ||
285 | <ul> | ||
286 | <li>Compile the two modules to bytecode | ||
287 | (using <tt>luac -s</tt> from a plain Lua installation).</li> | ||
288 | <li>Convert them to C include files (search for "Lua bin2c").</li> | ||
289 | <li>On Windows you can also put the compiled bytecode into a resource | ||
290 | (search for "Lua bin2res").</li> | ||
291 | <li>Load the bytecode with <tt>luaL_loadbuffer</tt> (but don't run it).</li> | ||
292 | <li>Put the resulting functions into <tt>package.preload["jit.opt"]</tt> | ||
293 | and <tt>package.preload["jit.opt_inline"]</tt>.</li> | ||
294 | </ul></li> | ||
295 | <li>Activate the LuaJIT optimizer from Lua code to be run at startup: | ||
296 | <tt> require("jit.opt").start()</tt><br> | ||
297 | Or use equivalent C code. See <tt>dojitopt()</tt> in <tt>src/lua.c</tt>.</li> | ||
298 | </ul></li> | ||
299 | <li>All other LuaJIT specific modules (<tt>jit.*</tt>) are for debugging only. | ||
300 | They do not need to be shipped with an application. But they may be quite | ||
301 | useful, anyway (especially <tt>jit.trace</tt>).</li> | ||
302 | <li>DynASM is only needed while <em>building</em> LuaJIT. It's not | ||
303 | needed while running LuaJIT and there is no point in shipping or | ||
304 | installing it together with an application.</li> | ||
305 | <li>In case you want to strip some of the standard libraries from | ||
306 | your application: The optimizer modules need several functions from | ||
307 | the base library and the string library (and of course the LuaJIT | ||
308 | core libraries). The io library is only used to print a fatal error | ||
309 | message (you may want to replace it). The optional modules | ||
310 | for debugging depend on a few more library functions — | ||
311 | please check the source.</li> | ||
312 | </ul> | ||
313 | <p> | ||
314 | Although the very liberal LuaJIT | ||
315 | <a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">»</span> license</a> | ||
316 | does not require any acknowledgment whatsoever, it would be appreciated | ||
317 | if you give some credit in the docs (or the "About" box) of your application. | ||
318 | A simple line like:<br> | ||
319 | <tt> This product includes LuaJIT, http://luajit.org/</tt><br> | ||
320 | would be nice. Please do not include any E-Mail addresses. Thank you! | ||
321 | </p> | ||
322 | <p> | ||
323 | I'm always interested where LuaJIT can be put to good use in applications. | ||
324 | Please <a href="contact.html">tell me</a> | ||
325 | or better yet write a few lines about your project to the | ||
326 | <a href="http://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. | ||
327 | Thank you! | ||
328 | </p> | ||
329 | <br class="flush"> | ||
330 | </div> | ||
331 | <div id="foot"> | ||
332 | <hr class="hide"> | ||
333 | Copyright © 2005-2011 Mike Pall | ||
334 | <span class="noprint"> | ||
335 | · | ||
336 | <a href="contact.html">Contact</a> | ||
337 | </span> | ||
338 | </div> | ||
339 | </body> | ||
340 | </html> | ||