summaryrefslogtreecommitdiff
path: root/doc/install.html
diff options
context:
space:
mode:
authorMike Pall <mike>2010-10-05 01:36:54 +0200
committerMike Pall <mike>2010-10-05 01:36:54 +0200
commitddae8878786a310f2e6cbe2a1d602a17ea28bb11 (patch)
tree3ffe5c7790acbacdcdae748984960418b358fcc1 /doc/install.html
parente396bef7d8a346c6ea54191d658209ee90047276 (diff)
downloadluajit-ddae8878786a310f2e6cbe2a1d602a17ea28bb11.tar.gz
luajit-ddae8878786a310f2e6cbe2a1d602a17ea28bb11.tar.bz2
luajit-ddae8878786a310f2e6cbe2a1d602a17ea28bb11.zip
Update docs for PPC port. Clarify and extend install instructions.
Diffstat (limited to 'doc/install.html')
-rw-r--r--doc/install.html155
1 files changed, 130 insertions, 25 deletions
diff --git a/doc/install.html b/doc/install.html
index 45925e7a..b0c806db 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -11,16 +11,20 @@
11<style type="text/css"> 11<style type="text/css">
12table.compat { 12table.compat {
13 line-height: 1.2; 13 line-height: 1.2;
14 width: 40em; 14 width: 47em;
15} 15}
16tr.compathead td { 16tr.compathead td {
17 font-weight: bold; 17 font-weight: bold;
18} 18}
19td {
20 border-left: 1px solid #bfcfff;
21 border-right: 1px solid #bfcfff;
22}
19td.compatos { 23td.compatos {
20 width: 40%; 24 width: 25%;
21} 25}
22td.compatcc { 26td.compatcc {
23 width: 30%; 27 width: 25%;
24 vertical-align: top; 28 vertical-align: top;
25} 29}
26</style> 30</style>
@@ -68,35 +72,40 @@ For the impatient (on POSIX systems):
68make &amp;&amp; sudo make install 72make &amp;&amp; sudo make install
69</pre> 73</pre>
70<p> 74<p>
71LuaJIT currently builds out-of-the box on most x86 or x64 systems. 75LuaJIT currently builds out-of-the box on most systems.
72Here's the compatibility matrix for the supported combinations of 76Here's the compatibility matrix for the supported combinations of
73operating system, CPU and compilers: 77operating system, CPU and compilers:
74</p> 78</p>
75<table class="compat"> 79<table class="compat">
76<tr class="compathead"> 80<tr class="compathead">
77<td class="compatos">Operating system</td> 81<td class="compatos">OS / CPU</td>
78<td class="compatcc">x86 (32 bit)</td> 82<td class="compatcc">x86 (32 bit)</td>
79<td class="compatcc">x64 (64 bit)</td> 83<td class="compatcc">x64 (64 bit)</td>
84<td class="compatcc">PPC/e500v2</td>
80</tr> 85</tr>
81<tr class="odd separate"> 86<tr class="odd separate">
82<td class="compatos">Linux</td> 87<td class="compatos"><a href="#posix">Linux</a></td>
83<td class="compatcc">GCC 4.x<br>GCC 3.4</td> 88<td class="compatcc">GCC 4.x<br>GCC 3.4</td>
84<td class="compatcc">GCC 4.x</td> 89<td class="compatcc">GCC 4.x</td>
90<td class="compatcc">GCC 4.3+</td>
85</tr> 91</tr>
86<tr class="even"> 92<tr class="even">
87<td class="compatos">Windows 98/XP/Vista/7</td> 93<td class="compatos"><a href="#windows">Windows<br>98/XP/Vista/7</a></td>
88<td class="compatcc">MSVC (EE)<br>Windows SDK<br>MinGW (GCC)<br>Cygwin (GCC)</td> 94<td class="compatcc">MSVC (EE)<br>Windows SDK<br>MinGW (GCC)<br>Cygwin (GCC)</td>
89<td class="compatcc">MSVC + SDK v7.0<br>Windows SDK v7.0</td> 95<td class="compatcc">MSVC + SDK v7.0<br>Windows SDK v7.0</td>
96<td class="compatcc">&nbsp;</td>
90</tr> 97</tr>
91<tr class="odd"> 98<tr class="odd">
92<td class="compatos">OSX 10.3-10.6</td> 99<td class="compatos"><a href="#posix">OSX 10.3-10.6</a></td>
93<td class="compatcc">GCC 4.x<br>GCC 3.4</td> 100<td class="compatcc">GCC 4.x<br>GCC 3.4</td>
94<td class="compatcc">GCC 4.x</td> 101<td class="compatcc">GCC 4.x</td>
102<td class="compatcc">&nbsp;</td>
95</tr> 103</tr>
96<tr class="even"> 104<tr class="even">
97<td class="compatos">*BSD, other</td> 105<td class="compatos"><a href="#posix">*BSD, other</a></td>
98<td class="compatcc">GCC 4.x<br>GCC 3.4</td> 106<td class="compatcc">GCC 4.x<br>GCC 3.4</td>
99<td class="compatcc">(not supported)</td> 107<td class="compatcc">(not supported)</td>
108<td class="compatcc">&nbsp;</td>
100</tr> 109</tr>
101</table> 110</table>
102 111
@@ -147,10 +156,12 @@ which is probably the default on your system, anyway. Simply run:
147make 156make
148</pre> 157</pre>
149<p> 158<p>
150This always builds a native x86 or x64 binary, depending on your OS. 159This always builds a native x86, x64 or PPC binary, depending on the host OS
160you're running this command on. Check the section on
161<a href="#cross">cross-compilation</a> for more options.
151</p> 162</p>
152<p> 163<p>
153By default modules are only searched under the prefix <tt>/usr/local</tt>. 164By default, modules are only searched under the prefix <tt>/usr/local</tt>.
154You can add an extra prefix to the search paths by appending the 165You can add an extra prefix to the search paths by appending the
155<tt>PREFIX</tt> option, e.g.: 166<tt>PREFIX</tt> option, e.g.:
156</p> 167</p>
@@ -283,7 +294,7 @@ directory where <tt>luajit.exe</tt> is installed
283(see <tt>src/luaconf.h</tt>). 294(see <tt>src/luaconf.h</tt>).
284</p> 295</p>
285 296
286<h2>Cross-compiling LuaJIT</h2> 297<h2 id="cross">Cross-compiling LuaJIT</h2>
287<p> 298<p>
288The build system has limited support for cross-compilation. For details 299The build system has limited support for cross-compilation. For details
289check the comments in <tt>src/Makefile</tt>. Here are some popular examples: 300check the comments in <tt>src/Makefile</tt>. Here are some popular examples:
@@ -303,36 +314,130 @@ installing the <tt>mingw32</tt> package and running:
303<pre class="code"> 314<pre class="code">
304make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows 315make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
305</pre> 316</pre>
317<p>
318You can cross-compile for a PPC/e500v2 target on an x86 or x64 host system
319using a standard GNU cross-compile toolchain (Binutils, GCC, EGLIBC).
320The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt>
321of the toolchain:
322</p>
323<pre class="code">
324make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe
325</pre>
306 326
307<h2>Embedding LuaJIT</h2> 327<h2 id="embed">Embedding LuaJIT</h2>
308<p> 328<p>
309LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua 329LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua
310into your application, you probably don't need to do anything to switch 330into your application, you probably don't need to do anything to switch
311to LuaJIT, except link with a different library. Additional hints: 331to LuaJIT, except link with a different library:
312</p> 332</p>
313<ul> 333<ul>
334<li>It's strongly suggested to build LuaJIT separately using the supplied
335build system. Please do <em>not</em> attempt to integrate the individual
336source files into your build tree. You'll most likely get the internal build
337dependencies wrong or mess up the compiler flags. Treat LuaJIT like any
338other external library and link your application with either the dynamic
339or static library, depending on your needs.</li>
340<li>If you want to load C modules compiled for plain Lua
341with <tt>require()</tt>, you need to make sure the public symbols
342(e.g. <tt>lua_pushnumber</tt>) are exported, too:
343<ul><li>On POSIX systems you can either link to the shared library
344or link the static library into your application. In the latter case
345you'll need to export all public symbols from your main executable
346(e.g. <tt>-Wl,-E</tt> on Linux) and add the external dependencies
347(e.g. <tt>-lm -ldl</tt> on Linux).</li>
348<li>Since Windows symbols are bound to a specific DLL name, you need to
349link to the <tt>lua51.dll</tt> created by the LuaJIT build (do not rename
350the DLL). You may link LuaJIT statically on Windows only if you don't
351intend to load Lua/C modules at runtime.
352</li></ul>
353</li>
354<li>
355If you're building a 64 bit application on OSX which links directly or
356indirectly against LuaJIT, you need to link your main executable
357with these flags:
358<pre class="code">
359-pagezero_size 10000 -image_base 100000000
360</pre>
361Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
362which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
363See: <tt>man rebase</tt>
364</li>
365</ul>
366<p>Additional hints for initializing LuaJIT using the C API functions:</p>
367<ul>
368<li>Here's a
369<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">&raquo;</span>&nbsp;simple example</a>
370for embedding Lua or LuaJIT into your application.</li>
314<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using 371<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
315<tt>lua_newstate</tt>, since this uses the (slower) default memory 372<tt>lua_newstate</tt>, since this uses the (slower) default memory
316allocator from your system (no support for this on x64).</tt></li> 373allocator from your system (no support for this on x64).</tt></li>
317<li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style 374<li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style
318of calling <tt>luaopen_base</tt> etc. directly.</li> 375of calling <tt>luaopen_base</tt> etc. directly.</li>
319<li>To change which standard libraries to load, copy <tt>src/lib_init.c</tt> 376<li>To change or extend the list of standard libraries to load, copy
320to your project and modify it accordingly. Make sure the <tt>jit</tt> 377<tt>src/lib_init.c</tt> to your project and modify it accordingly.
321library is loaded or the JIT compiler will not be activated.</li> 378Make sure the <tt>jit</tt> library is loaded or the JIT compiler
322<li>Here's a 379will not be activated.</li>
323<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">&raquo;</span>&nbsp;simple example</a>.</li> 380<li>The <tt>bit.*</tt> module for bitwise operations
381is already built-in. There's no need to statically link
382<a href="http://bitop.luajit.org/"><span class="ext">&raquo;</span>&nbsp;Lua BitOp</a> to your application.</li>
324</ul> 383</ul>
384
385<h2 id="distro">Hints for Distribution Maintainers</h2>
386<p>
387The LuaJIT build system has extra provisions for the needs of most
388POSIX-based distributions. If you're a package maintainer for
389a distribution, <em>please</em> make use of these features and
390avoid patching, subverting, autotoolizing or messing up the build system
391in unspeakable ways.
392</p>
393<p>
394There should be absolutely no need to patch <tt>luaconf.h</tt> or any
395of the Makefiles. And please do not hand-pick files for your packages &mdash;
396simply use whatever <tt>make install</tt> creates. There's a reason
397for all of the files <em>and</em> directories it creates.
398</p>
399<p>
400The build system uses GNU make and autodetects most settings based on
401the host you're building it on. This should work fine for native builds,
402even when sandboxed. You may need to pass some of the following flags to
403<em>both</em> the <tt>make</tt> and the <tt>make install</tt> command lines
404for a regular distribution build:
405</p>
406<ul>
407<li><tt>PREFIX</tt> overrides the installation path and should usually
408be set to <tt>/usr</tt>. Setting this also changes the module paths and
409the <tt>-rpath</tt> of the shared library.</li>
410<li><tt>DESTDIR</tt> is an absolute path which allows you to install
411to a shadow tree instead of the root tree of the build system.</li>
412<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
413for additional variables to tweak. The following variables <em>may</em> be
414overriden, but it's <em>not</em> recommended, except for special needs
415like cross-builds:
416<tt>BUILDMODE, CC, HOST_CC, STATIC_CC, DYNAMIC_CC, CFLAGS, HOST_CFLAGS,
417TARGET_CFLAGS, LDFLAGS, HOST_LDFLAGS, TARGET_LDFLAGS, TARGET_SHLDFLAGS,
418LIBS, HOST_LIBS, TARGET_LIBS, CROSS, HOST_SYS, TARGET_SYS</tt></li>
419</ul>
420<p>
421The build system has a special target for an amalgamated build, i.e.
422<tt>make amalg</tt>. This compiles the LuaJIT core as one huge C file
423and allows GCC to generate faster and shorter code. Alas, this requires
424lots of memory during the build. This may be a problem for some users,
425that's why it's not enabled by default. But it shouldn't be a problem for
426most build farms. It's recommended that binary distributions use this
427target for their LuaJIT builds.
428</p>
325<p> 429<p>
32664 bit applications on OSX must be linked with these options 430The tl;dr version of the above:
327(only the main executable):
328</p> 431</p>
329<pre class="code"> 432<pre class="code">
330-pagezero_size 10000 -image_base 100000000 433make amalg PREFIX=/usr && \
434make install PREFIX=/usr DESTDIR=/tmp/buildroot
331</pre> 435</pre>
332<p> 436<p>
333It's recommended to <tt>rebase</tt> all (self-compiled) shared libraries 437Finally, if you encounter any difficulties, please
334which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). 438<a href="contact.html">contact me</a> first, instead of releasing a broken
335See: <tt>man rebase</tt> 439package onto unsuspecting users. Because they'll usually gonna complain
440to me (the upstream) and not you (the package maintainer), anyway.
336</p> 441</p>
337<br class="flush"> 442<br class="flush">
338</div> 443</div>