summaryrefslogtreecommitdiff
path: root/doc/install.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/install.html')
-rw-r--r--doc/install.html75
1 files changed, 52 insertions, 23 deletions
diff --git a/doc/install.html b/doc/install.html
index 102f3417..727668cf 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -50,14 +50,8 @@ For the impatient (on POSIX systems):
50make && sudo make install 50make && sudo make install
51</pre> 51</pre>
52<p> 52<p>
53LuaJIT currently builds out-of-the box on all popular x86 systems 53LuaJIT currently builds out-of-the box on all popular x86 or x64 systems
54(Linux, Windows, OSX etc.). It builds and runs fine as a 32&nbsp;bit 54(Linux, Windows, OSX etc.).
55application under x64-based systems, too.
56</p>
57<p style="color: #00a000;">
58The x64 port of LuaJIT is still preliminary and not enabled by default.
59It only builds on Linux/x64 and Windows/x64 right now. If you want to
60give it a try, please follow the special build instructions below.
61</p> 55</p>
62 56
63<h2>Configuring LuaJIT</h2> 57<h2>Configuring LuaJIT</h2>
@@ -85,13 +79,8 @@ any settings.
85<p> 79<p>
86Depending on your distribution, you may need to install a package for 80Depending on your distribution, you may need to install a package for
87GCC (GCC 3.4 or later required), the development headers and/or a 81GCC (GCC 3.4 or later required), the development headers and/or a
88complete SDK. 82complete SDK. E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
89</p> 83with the package manager.
90<p>
91E.g. on a current Debian/Ubuntu, install <tt>libc6-dev</tt>
92with the package manager. Currently LuaJIT builds as a 32&nbsp;bit
93application by default, so you actually need to install <tt>libc6-dev-i386</tt>
94when building on an x64 OS.
95</p> 84</p>
96<p> 85<p>
97Download the current source package (pick the .tar.gz), if you haven't 86Download 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:
111<pre class="code"> 100<pre class="code">
112make 101make
113</pre> 102</pre>
114<div style="color: #00a000;">
115<p> 103<p>
116You can force a native x64 build on Linux/x64 with the following command: 104This always builds a native x86 or x64 binary, depending on your OS.
117</p> 105</p>
118<pre class="code">
119make CC="gcc -m64"
120</pre>
121</div>
122<p> 106<p>
123By default modules are only searched under the prefix <tt>/usr/local</tt>. 107By default modules are only searched under the prefix <tt>/usr/local</tt>.
124You can add an extra prefix to the search paths by appending the 108You 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:
203<pre class="code"> 187<pre class="code">
204setenv /release /x86 188setenv /release /x86
205</pre> 189</pre>
206<div style="color: #00a000;">
207<p> 190<p>
208Or select the x64 compiler: 191Or select the x64 compiler:
209</p> 192</p>
210<pre class="code"> 193<pre class="code">
211setenv /release /x64 194setenv /release /x64
212</pre> 195</pre>
213</div>
214<p> 196<p>
215Then <tt>cd</tt> to the directory where you've unpacked the sources 197Then <tt>cd</tt> to the directory where you've unpacked the sources
216and run these commands: 198and run these commands:
@@ -254,6 +236,53 @@ absolute path names &mdash; all modules are loaded relative to the
254directory where <tt>luajit.exe</tt> is installed 236directory where <tt>luajit.exe</tt> is installed
255(see <tt>src/luaconf.h</tt>). 237(see <tt>src/luaconf.h</tt>).
256</p> 238</p>
239
240<h2>Cross-compiling LuaJIT</h2>
241<p>
242The build system has limited support for cross-compilation. For details
243check the comments in <tt>src/Makefile</tt>. Here are some popular examples:
244</p>
245<p>
246You can cross-compile to a 32 bit binary on a multilib x64 OS by
247installing the multilib development pacakges (e.g. <tt>libc6-dev-i386</tt>
248on Debian/Ubuntu) and running:
249</p>
250<pre class="code">
251make CC="gcc -m32"
252</pre>
253<p>
254You can cross-compile for a Windows target on Debian/Ubuntu by
255installing the <tt>mingw32</tt> package and running:
256</p>
257<pre class="code">
258make CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
259</pre>
260
261<h2>Embedding LuaJIT</h2>
262<p>
263LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua
264into your application, you probably don't need to do anything to switch
265to LuaJIT, except link with a different library. Additional hints:
266</p>
267<ul>
268<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
269<tt>lua_newstate</tt>, since this uses the (slower) default memory
270allocator from your system (no support for this on x64).</tt></li>
271<li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style
272of calling <tt>luaopen_base</tt> etc. directly.</li>
273<li>To change which standard libraries to load, copy <tt>src/lib_init.c</tt>
274to your project and modify it accordingly. Make sure the <tt>jit</tt>
275library is loaded or the JIT compiler will not be activated.</li>
276<li>Here's a
277<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">&raquo;</span>&nbsp;simple example</a>.</li>
278</ul>
279<p>
28064 bit applications on OSX must be linked with these options
281(only the main executable):
282</p>
283<pre class="code">
284-pagezero_size 10000 -image_base 100000000
285</pre>
257<br class="flush"> 286<br class="flush">
258</div> 287</div>
259<div id="foot"> 288<div id="foot">