diff options
author | Mike Pall <mike> | 2010-10-05 01:36:54 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-10-05 01:36:54 +0200 |
commit | ddae8878786a310f2e6cbe2a1d602a17ea28bb11 (patch) | |
tree | 3ffe5c7790acbacdcdae748984960418b358fcc1 /doc/install.html | |
parent | e396bef7d8a346c6ea54191d658209ee90047276 (diff) | |
download | luajit-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.html | 155 |
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"> |
12 | table.compat { | 12 | table.compat { |
13 | line-height: 1.2; | 13 | line-height: 1.2; |
14 | width: 40em; | 14 | width: 47em; |
15 | } | 15 | } |
16 | tr.compathead td { | 16 | tr.compathead td { |
17 | font-weight: bold; | 17 | font-weight: bold; |
18 | } | 18 | } |
19 | td { | ||
20 | border-left: 1px solid #bfcfff; | ||
21 | border-right: 1px solid #bfcfff; | ||
22 | } | ||
19 | td.compatos { | 23 | td.compatos { |
20 | width: 40%; | 24 | width: 25%; |
21 | } | 25 | } |
22 | td.compatcc { | 26 | td.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): | |||
68 | make && sudo make install | 72 | make && sudo make install |
69 | </pre> | 73 | </pre> |
70 | <p> | 74 | <p> |
71 | LuaJIT currently builds out-of-the box on most x86 or x64 systems. | 75 | LuaJIT currently builds out-of-the box on most systems. |
72 | Here's the compatibility matrix for the supported combinations of | 76 | Here's the compatibility matrix for the supported combinations of |
73 | operating system, CPU and compilers: | 77 | operating 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"> </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"> </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"> </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: | |||
147 | make | 156 | make |
148 | </pre> | 157 | </pre> |
149 | <p> | 158 | <p> |
150 | This always builds a native x86 or x64 binary, depending on your OS. | 159 | This always builds a native x86, x64 or PPC binary, depending on the host OS |
160 | you'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> |
153 | By default modules are only searched under the prefix <tt>/usr/local</tt>. | 164 | By default, modules are only searched under the prefix <tt>/usr/local</tt>. |
154 | You can add an extra prefix to the search paths by appending the | 165 | You 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> |
288 | The build system has limited support for cross-compilation. For details | 299 | The build system has limited support for cross-compilation. For details |
289 | check the comments in <tt>src/Makefile</tt>. Here are some popular examples: | 300 | check 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"> |
304 | make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 315 | make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
305 | </pre> | 316 | </pre> |
317 | <p> | ||
318 | You can cross-compile for a PPC/e500v2 target on an x86 or x64 host system | ||
319 | using a standard GNU cross-compile toolchain (Binutils, GCC, EGLIBC). | ||
320 | The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt> | ||
321 | of the toolchain: | ||
322 | </p> | ||
323 | <pre class="code"> | ||
324 | make 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> |
309 | LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua | 329 | LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua |
310 | into your application, you probably don't need to do anything to switch | 330 | into your application, you probably don't need to do anything to switch |
311 | to LuaJIT, except link with a different library. Additional hints: | 331 | to 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 | ||
335 | build system. Please do <em>not</em> attempt to integrate the individual | ||
336 | source files into your build tree. You'll most likely get the internal build | ||
337 | dependencies wrong or mess up the compiler flags. Treat LuaJIT like any | ||
338 | other external library and link your application with either the dynamic | ||
339 | or static library, depending on your needs.</li> | ||
340 | <li>If you want to load C modules compiled for plain Lua | ||
341 | with <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 | ||
344 | or link the static library into your application. In the latter case | ||
345 | you'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 | ||
349 | link to the <tt>lua51.dll</tt> created by the LuaJIT build (do not rename | ||
350 | the DLL). You may link LuaJIT statically on Windows only if you don't | ||
351 | intend to load Lua/C modules at runtime. | ||
352 | </li></ul> | ||
353 | </li> | ||
354 | <li> | ||
355 | If you're building a 64 bit application on OSX which links directly or | ||
356 | indirectly against LuaJIT, you need to link your main executable | ||
357 | with these flags: | ||
358 | <pre class="code"> | ||
359 | -pagezero_size 10000 -image_base 100000000 | ||
360 | </pre> | ||
361 | Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries | ||
362 | which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). | ||
363 | See: <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">»</span> simple example</a> | ||
370 | for 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 |
316 | allocator from your system (no support for this on x64).</tt></li> | 373 | allocator 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 |
318 | of calling <tt>luaopen_base</tt> etc. directly.</li> | 375 | of 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 |
320 | to 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. |
321 | library is loaded or the JIT compiler will not be activated.</li> | 378 | Make sure the <tt>jit</tt> library is loaded or the JIT compiler |
322 | <li>Here's a | 379 | will not be activated.</li> |
323 | <a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">»</span> simple example</a>.</li> | 380 | <li>The <tt>bit.*</tt> module for bitwise operations |
381 | is already built-in. There's no need to statically link | ||
382 | <a href="http://bitop.luajit.org/"><span class="ext">»</span> Lua BitOp</a> to your application.</li> | ||
324 | </ul> | 383 | </ul> |
384 | |||
385 | <h2 id="distro">Hints for Distribution Maintainers</h2> | ||
386 | <p> | ||
387 | The LuaJIT build system has extra provisions for the needs of most | ||
388 | POSIX-based distributions. If you're a package maintainer for | ||
389 | a distribution, <em>please</em> make use of these features and | ||
390 | avoid patching, subverting, autotoolizing or messing up the build system | ||
391 | in unspeakable ways. | ||
392 | </p> | ||
393 | <p> | ||
394 | There should be absolutely no need to patch <tt>luaconf.h</tt> or any | ||
395 | of the Makefiles. And please do not hand-pick files for your packages — | ||
396 | simply use whatever <tt>make install</tt> creates. There's a reason | ||
397 | for all of the files <em>and</em> directories it creates. | ||
398 | </p> | ||
399 | <p> | ||
400 | The build system uses GNU make and autodetects most settings based on | ||
401 | the host you're building it on. This should work fine for native builds, | ||
402 | even 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 | ||
404 | for a regular distribution build: | ||
405 | </p> | ||
406 | <ul> | ||
407 | <li><tt>PREFIX</tt> overrides the installation path and should usually | ||
408 | be set to <tt>/usr</tt>. Setting this also changes the module paths and | ||
409 | the <tt>-rpath</tt> of the shared library.</li> | ||
410 | <li><tt>DESTDIR</tt> is an absolute path which allows you to install | ||
411 | to 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> | ||
413 | for additional variables to tweak. The following variables <em>may</em> be | ||
414 | overriden, but it's <em>not</em> recommended, except for special needs | ||
415 | like cross-builds: | ||
416 | <tt>BUILDMODE, CC, HOST_CC, STATIC_CC, DYNAMIC_CC, CFLAGS, HOST_CFLAGS, | ||
417 | TARGET_CFLAGS, LDFLAGS, HOST_LDFLAGS, TARGET_LDFLAGS, TARGET_SHLDFLAGS, | ||
418 | LIBS, HOST_LIBS, TARGET_LIBS, CROSS, HOST_SYS, TARGET_SYS</tt></li> | ||
419 | </ul> | ||
420 | <p> | ||
421 | The 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 | ||
423 | and allows GCC to generate faster and shorter code. Alas, this requires | ||
424 | lots of memory during the build. This may be a problem for some users, | ||
425 | that's why it's not enabled by default. But it shouldn't be a problem for | ||
426 | most build farms. It's recommended that binary distributions use this | ||
427 | target for their LuaJIT builds. | ||
428 | </p> | ||
325 | <p> | 429 | <p> |
326 | 64 bit applications on OSX must be linked with these options | 430 | The 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 | 433 | make amalg PREFIX=/usr && \ |
434 | make install PREFIX=/usr DESTDIR=/tmp/buildroot | ||
331 | </pre> | 435 | </pre> |
332 | <p> | 436 | <p> |
333 | It's recommended to <tt>rebase</tt> all (self-compiled) shared libraries | 437 | Finally, if you encounter any difficulties, please |
334 | which 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 |
335 | See: <tt>man rebase</tt> | 439 | package onto unsuspecting users. Because they'll usually gonna complain |
440 | to 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> |