|
@@ -50,14 +50,8 @@ For the impatient (on POSIX systems):
|
|
|
make && sudo make install
|
|
|
</pre>
|
|
|
<p>
|
|
|
-LuaJIT currently builds out-of-the box on all popular x86 systems
|
|
|
-(Linux, Windows, OSX etc.). It builds and runs fine as a 32 bit
|
|
|
-application under x64-based systems, too.
|
|
|
-</p>
|
|
|
-<p style="color: #00a000;">
|
|
|
-The x64 port of LuaJIT is still preliminary and not enabled by default.
|
|
|
-It only builds on Linux/x64 and Windows/x64 right now. If you want to
|
|
|
-give it a try, please follow the special build instructions below.
|
|
|
+LuaJIT currently builds out-of-the box on all popular x86 or x64 systems
|
|
|
+(Linux, Windows, OSX etc.).
|
|
|
</p>
|
|
|
|
|
|
<h2>Configuring LuaJIT</h2>
|
|
@@ -85,13 +79,8 @@ any settings.
|
|
|
<p>
|
|
|
Depending on your distribution, you may need to install a package for
|
|
|
GCC (GCC 3.4 or later required), the development headers and/or a
|
|
|
-complete SDK.
|
|
|
-</p>
|
|
|
-<p>
|
|
|
-E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
|
|
|
-with the package manager. Currently LuaJIT builds as a 32 bit
|
|
|
-application by default, so you actually need to install <tt>libc6-dev-i386</tt>
|
|
|
-when building on an x64 OS.
|
|
|
+complete SDK. E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
|
|
|
+with the package manager.
|
|
|
</p>
|
|
|
<p>
|
|
|
Download the current source package (pick the .tar.gz), if you haven't
|
|
@@ -111,14 +100,9 @@ which is probably the default on your system, anyway. Simply run:
|
|
|
<pre class="code">
|
|
|
make
|
|
|
</pre>
|
|
|
-<div style="color: #00a000;">
|
|
|
<p>
|
|
|
-You can force a native x64 build on Linux/x64 with the following command:
|
|
|
+This always builds a native x86 or x64 binary, depending on your OS.
|
|
|
</p>
|
|
|
-<pre class="code">
|
|
|
-make CC="gcc -m64"
|
|
|
-</pre>
|
|
|
-</div>
|
|
|
<p>
|
|
|
By default modules are only searched under the prefix <tt>/usr/local</tt>.
|
|
|
You can add an extra prefix to the search paths by appending the
|
|
@@ -203,14 +187,12 @@ Open a "Windows SDK Command Shell" and select the x86 compiler:
|
|
|
<pre class="code">
|
|
|
setenv /release /x86
|
|
|
</pre>
|
|
|
-<div style="color: #00a000;">
|
|
|
<p>
|
|
|
Or select the x64 compiler:
|
|
|
</p>
|
|
|
<pre class="code">
|
|
|
setenv /release /x64
|
|
|
</pre>
|
|
|
-</div>
|
|
|
<p>
|
|
|
Then <tt>cd</tt> to the directory where you've unpacked the sources
|
|
|
and run these commands:
|
|
@@ -254,6 +236,53 @@ absolute path names — all modules are loaded relative to the
|
|
|
directory where <tt>luajit.exe</tt> is installed
|
|
|
(see <tt>src/luaconf.h</tt>).
|
|
|
</p>
|
|
|
+
|
|
|
+<h2>Cross-compiling LuaJIT</h2>
|
|
|
+<p>
|
|
|
+The build system has limited support for cross-compilation. For details
|
|
|
+check the comments in <tt>src/Makefile</tt>. Here are some popular examples:
|
|
|
+</p>
|
|
|
+<p>
|
|
|
+You can cross-compile to a 32 bit binary on a multilib x64 OS by
|
|
|
+installing the multilib development pacakges (e.g. <tt>libc6-dev-i386</tt>
|
|
|
+on Debian/Ubuntu) and running:
|
|
|
+</p>
|
|
|
+<pre class="code">
|
|
|
+make CC="gcc -m32"
|
|
|
+</pre>
|
|
|
+<p>
|
|
|
+You can cross-compile for a Windows target on Debian/Ubuntu by
|
|
|
+installing the <tt>mingw32</tt> package and running:
|
|
|
+</p>
|
|
|
+<pre class="code">
|
|
|
+make CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
|
|
|
+</pre>
|
|
|
+
|
|
|
+<h2>Embedding LuaJIT</h2>
|
|
|
+<p>
|
|
|
+LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua
|
|
|
+into your application, you probably don't need to do anything to switch
|
|
|
+to LuaJIT, except link with a different library. Additional hints:
|
|
|
+</p>
|
|
|
+<ul>
|
|
|
+<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
|
|
|
+<tt>lua_newstate</tt>, since this uses the (slower) default memory
|
|
|
+allocator from your system (no support for this on x64).</tt></li>
|
|
|
+<li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style
|
|
|
+of calling <tt>luaopen_base</tt> etc. directly.</li>
|
|
|
+<li>To change which standard libraries to load, copy <tt>src/lib_init.c</tt>
|
|
|
+to your project and modify it accordingly. Make sure the <tt>jit</tt>
|
|
|
+library is loaded or the JIT compiler will not be activated.</li>
|
|
|
+<li>Here's a
|
|
|
+<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">»</span> simple example</a>.</li>
|
|
|
+</ul>
|
|
|
+<p>
|
|
|
+64 bit applications on OSX must be linked with these options
|
|
|
+(only the main executable):
|
|
|
+</p>
|
|
|
+<pre class="code">
|
|
|
+-pagezero_size 10000 -image_base 100000000
|
|
|
+</pre>
|
|
|
<br class="flush">
|
|
|
</div>
|
|
|
<div id="foot">
|