2009-12-08 18:46:35 +00:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Installation</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
|
<meta name="Author" content="Mike Pall">
|
2011-01-09 16:12:53 +00:00
|
|
|
<meta name="Copyright" content="Copyright (C) 2005-2011, Mike Pall">
|
2009-12-08 18:46:35 +00:00
|
|
|
<meta name="Language" content="en">
|
|
|
|
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
|
|
|
|
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
|
2010-03-07 16:12:21 +00:00
|
|
|
<style type="text/css">
|
|
|
|
table.compat {
|
|
|
|
line-height: 1.2;
|
2010-10-11 14:26:48 +00:00
|
|
|
width: 600px;
|
2010-03-07 16:12:21 +00:00
|
|
|
}
|
2010-11-09 17:11:35 +00:00
|
|
|
table.compat td {
|
|
|
|
border: 1px solid #bfcfff;
|
|
|
|
font-size: 90%;
|
|
|
|
height: 2.5em;
|
|
|
|
}
|
|
|
|
table.compat tr.compathead td {
|
2010-03-07 16:12:21 +00:00
|
|
|
font-weight: bold;
|
2010-10-11 14:26:48 +00:00
|
|
|
border-bottom: 2px solid #bfcfff;
|
|
|
|
}
|
|
|
|
tr.compathead td.compatos {
|
|
|
|
vertical-align: top;
|
2010-03-07 16:12:21 +00:00
|
|
|
}
|
2010-11-09 17:11:35 +00:00
|
|
|
table.compat td.compatcpu {
|
2010-10-11 14:26:48 +00:00
|
|
|
width: 16%;
|
|
|
|
border-right: 2px solid #bfcfff;
|
2010-10-04 23:36:54 +00:00
|
|
|
}
|
2010-03-07 16:12:21 +00:00
|
|
|
td.compatos {
|
2010-10-11 14:26:48 +00:00
|
|
|
width: 21%;
|
|
|
|
vertical-align: middle;
|
2010-03-07 16:12:21 +00:00
|
|
|
}
|
2010-10-11 14:26:48 +00:00
|
|
|
td.compatno {
|
|
|
|
background-color: #d0d0d0;
|
2010-03-07 16:12:21 +00:00
|
|
|
}
|
|
|
|
</style>
|
2009-12-08 18:46:35 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="site">
|
|
|
|
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
|
|
|
|
</div>
|
|
|
|
<div id="head">
|
|
|
|
<h1>Installation</h1>
|
|
|
|
</div>
|
|
|
|
<div id="nav">
|
|
|
|
<ul><li>
|
|
|
|
<a href="luajit.html">LuaJIT</a>
|
|
|
|
<ul><li>
|
|
|
|
<a class="current" href="install.html">Installation</a>
|
|
|
|
</li><li>
|
|
|
|
<a href="running.html">Running</a>
|
2010-11-09 17:11:35 +00:00
|
|
|
</li></ul>
|
|
|
|
</li><li>
|
|
|
|
<a href="extensions.html">Extensions</a>
|
|
|
|
<ul><li>
|
2011-01-20 21:14:17 +00:00
|
|
|
<a href="ext_ffi.html">FFI Library</a>
|
|
|
|
<ul><li>
|
|
|
|
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
|
|
|
|
</li><li>
|
|
|
|
<a href="ext_ffi_api.html">ffi.* API</a>
|
|
|
|
</li><li>
|
|
|
|
<a href="ext_ffi_semantics.html">FFI Semantics</a>
|
|
|
|
</li></ul>
|
|
|
|
</li><li>
|
2010-11-09 17:11:35 +00:00
|
|
|
<a href="ext_jit.html">jit.* Library</a>
|
2009-12-08 18:46:35 +00:00
|
|
|
</li><li>
|
2010-11-09 17:11:35 +00:00
|
|
|
<a href="ext_c_api.html">Lua/C API</a>
|
2009-12-08 18:46:35 +00:00
|
|
|
</li></ul>
|
|
|
|
</li><li>
|
|
|
|
<a href="status.html">Status</a>
|
|
|
|
<ul><li>
|
|
|
|
<a href="changes.html">Changes</a>
|
|
|
|
</li></ul>
|
|
|
|
</li><li>
|
|
|
|
<a href="faq.html">FAQ</a>
|
|
|
|
</li><li>
|
2010-03-19 20:01:14 +00:00
|
|
|
<a href="http://luajit.org/performance.html">Performance <span class="ext">»</span></a>
|
|
|
|
</li><li>
|
2009-12-08 18:46:35 +00:00
|
|
|
<a href="http://luajit.org/download.html">Download <span class="ext">»</span></a>
|
|
|
|
</li></ul>
|
|
|
|
</div>
|
|
|
|
<div id="main">
|
|
|
|
<p>
|
|
|
|
LuaJIT is only distributed as a source package. This page explains
|
|
|
|
how to build and install LuaJIT with different operating systems
|
|
|
|
and C compilers.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
For the impatient (on POSIX systems):
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
make && sudo make install
|
|
|
|
</pre>
|
|
|
|
<p>
|
2010-10-04 23:36:54 +00:00
|
|
|
LuaJIT currently builds out-of-the box on most systems.
|
2010-03-07 16:12:21 +00:00
|
|
|
Here's the compatibility matrix for the supported combinations of
|
|
|
|
operating system, CPU and compilers:
|
|
|
|
</p>
|
|
|
|
<table class="compat">
|
|
|
|
<tr class="compathead">
|
2010-10-11 14:26:48 +00:00
|
|
|
<td class="compatcpu">CPU / OS</td>
|
|
|
|
<td class="compatos"><a href="#posix">Linux</a></td>
|
|
|
|
<td class="compatos"><a href="#posix">OSX<br>10.3-10.6</a></td>
|
|
|
|
<td class="compatos"><a href="#posix">*BSD, other</a></td>
|
|
|
|
<td class="compatos"><a href="#windows">Windows<br>98/XP/Vista/7</a></td>
|
2010-03-07 16:12:21 +00:00
|
|
|
</tr>
|
|
|
|
<tr class="odd separate">
|
2010-10-11 14:26:48 +00:00
|
|
|
<td class="compatcpu">x86 (32 bit)</td>
|
|
|
|
<td class="compatos">GCC 4.x<br>GCC 3.4</td>
|
|
|
|
<td class="compatos">GCC 4.x<br>GCC 3.4</td>
|
|
|
|
<td class="compatos">GCC 4.x<br>GCC 3.4</td>
|
|
|
|
<td class="compatos">MSVC, MSVC/EE<br>WinSDK<br>MinGW, Cygwin</td>
|
2010-03-07 16:12:21 +00:00
|
|
|
</tr>
|
|
|
|
<tr class="even">
|
2010-10-11 14:26:48 +00:00
|
|
|
<td class="compatcpu">x64 (64 bit)</td>
|
|
|
|
<td class="compatos">GCC 4.x</td>
|
|
|
|
<td class="compatos">GCC 4.x</td>
|
|
|
|
<td class="compatos compatno"> </td>
|
|
|
|
<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td>
|
2010-03-07 16:12:21 +00:00
|
|
|
</tr>
|
|
|
|
<tr class="odd">
|
2010-10-11 14:26:48 +00:00
|
|
|
<td class="compatcpu">PPC/e500v2</td>
|
|
|
|
<td class="compatos">GCC 4.3+</td>
|
|
|
|
<td class="compatos compatno"> </td>
|
|
|
|
<td class="compatos compatno"> </td>
|
|
|
|
<td class="compatos compatno"> </td>
|
2010-03-07 16:12:21 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
<h2>Configuring LuaJIT</h2>
|
|
|
|
<p>
|
|
|
|
The standard configuration should work fine for most installations.
|
2009-12-08 18:49:20 +00:00
|
|
|
Usually there is no need to tweak the settings. The following files
|
|
|
|
hold all user-configurable settings:
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<ul>
|
2009-12-08 18:49:20 +00:00
|
|
|
<li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
|
|
|
|
<li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
|
2009-12-08 18:46:35 +00:00
|
|
|
only).</li>
|
2009-12-08 18:49:20 +00:00
|
|
|
<li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
|
2010-10-11 14:26:48 +00:00
|
|
|
under POSIX, MinGW or Cygwin.</li>
|
2009-12-08 18:46:35 +00:00
|
|
|
<li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
|
2010-10-11 14:26:48 +00:00
|
|
|
MSVC or WinSDK.</li>
|
2009-12-08 18:46:35 +00:00
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
Please read the instructions given in these files, before changing
|
|
|
|
any settings.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
|
|
|
|
<h3>Prerequisites</h3>
|
|
|
|
<p>
|
|
|
|
Depending on your distribution, you may need to install a package for
|
2010-10-11 14:26:48 +00:00
|
|
|
GCC, the development headers and/or a complete SDK. E.g. on a current
|
|
|
|
Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager.
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<p>
|
2010-10-11 14:26:48 +00:00
|
|
|
Download the current source package of LuaJIT (pick the .tar.gz),
|
|
|
|
if you haven't already done so. Move it to a directory of your choice,
|
|
|
|
open a terminal window and change to this directory. Now unpack the archive
|
2009-12-08 18:46:35 +00:00
|
|
|
and change to the newly created directory:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
2011-02-11 15:28:37 +00:00
|
|
|
tar zxf LuaJIT-2.0.0-beta6.tar.gz
|
|
|
|
cd LuaJIT-2.0.0-beta6</pre>
|
2009-12-08 18:46:35 +00:00
|
|
|
<h3>Building LuaJIT</h3>
|
|
|
|
<p>
|
|
|
|
The supplied Makefiles try to auto-detect the settings needed for your
|
|
|
|
operating system and your compiler. They need to be run with GNU Make,
|
|
|
|
which is probably the default on your system, anyway. Simply run:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
make
|
|
|
|
</pre>
|
2010-01-17 21:02:13 +00:00
|
|
|
<p>
|
2010-10-04 23:36:54 +00:00
|
|
|
This always builds a native x86, x64 or PPC binary, depending on the host OS
|
|
|
|
you're running this command on. Check the section on
|
|
|
|
<a href="#cross">cross-compilation</a> for more options.
|
2010-01-17 21:02:13 +00:00
|
|
|
</p>
|
2009-12-08 18:49:20 +00:00
|
|
|
<p>
|
2010-10-04 23:36:54 +00:00
|
|
|
By default, modules are only searched under the prefix <tt>/usr/local</tt>.
|
2009-12-08 18:49:20 +00:00
|
|
|
You can add an extra prefix to the search paths by appending the
|
|
|
|
<tt>PREFIX</tt> option, e.g.:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
make PREFIX=/home/myself/lj2
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Note for OSX: <tt>MACOSX_DEPLOYMENT_TARGET</tt> is set to <tt>10.4</tt>
|
|
|
|
in <tt>src/Makefile</tt>. Change it, if you want to build on an older version.
|
|
|
|
</p>
|
2009-12-08 18:46:35 +00:00
|
|
|
<h3>Installing LuaJIT</h3>
|
|
|
|
<p>
|
|
|
|
The top-level Makefile installs LuaJIT by default under
|
|
|
|
<tt>/usr/local</tt>, i.e. the executable ends up in
|
2010-01-17 21:02:13 +00:00
|
|
|
<tt>/usr/local/bin</tt> and so on. You need root privileges
|
2009-12-08 18:46:35 +00:00
|
|
|
to write to this path. So, assuming sudo is installed on your system,
|
|
|
|
run the following command and enter your sudo password:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
sudo make install
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Otherwise specify the directory prefix as an absolute path, e.g.:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
2009-12-08 18:49:20 +00:00
|
|
|
make install PREFIX=/home/myself/lj2
|
2009-12-08 18:46:35 +00:00
|
|
|
</pre>
|
|
|
|
<p>
|
2009-12-08 18:49:20 +00:00
|
|
|
Obviously the prefixes given during build and installation need to be the same.
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<p style="color: #c00000;">
|
|
|
|
Note: to avoid overwriting a previous version, the beta test releases
|
|
|
|
only install the LuaJIT executable under the versioned name (i.e.
|
2011-02-11 15:28:37 +00:00
|
|
|
<tt>luajit-2.0.0-beta6</tt>). You probably want to create a symlink
|
2009-12-08 18:46:35 +00:00
|
|
|
for convenience, with a command like this:
|
|
|
|
</p>
|
|
|
|
<pre class="code" style="color: #c00000;">
|
2011-02-11 15:28:37 +00:00
|
|
|
sudo ln -sf luajit-2.0.0-beta6 /usr/local/bin/luajit
|
2009-12-08 18:46:35 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<h2 id="windows">Windows Systems</h2>
|
|
|
|
<h3>Prerequisites</h3>
|
|
|
|
<p>
|
|
|
|
Either install one of the open source SDKs
|
|
|
|
(<a href="http://mingw.org/"><span class="ext">»</span> MinGW</a> or
|
2009-12-08 18:49:20 +00:00
|
|
|
<a href="http://www.cygwin.com/"><span class="ext">»</span> Cygwin</a>), which come with a modified
|
|
|
|
GCC plus the required development headers.
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<p>
|
2010-01-17 21:02:13 +00:00
|
|
|
Or install Microsoft's Visual C++ (MSVC). The freely downloadable
|
2009-12-08 18:46:35 +00:00
|
|
|
<a href="http://www.microsoft.com/Express/VC/"><span class="ext">»</span> Express Edition</a>
|
2010-01-17 21:02:13 +00:00
|
|
|
works just fine, but only contains an x86 compiler.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
The freely downloadable
|
|
|
|
<a href="http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx"><span class="ext">»</span> Windows SDK</a>
|
|
|
|
only comes with command line tools, but this is all you need to build LuaJIT.
|
|
|
|
It contains x86 and x64 compilers.
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Next, download the source package and unpack it using an archive manager
|
|
|
|
(e.g. the Windows Explorer) to a directory of your choice.
|
|
|
|
</p>
|
|
|
|
<h3>Building with MSVC</h3>
|
|
|
|
<p>
|
2009-12-08 18:49:20 +00:00
|
|
|
Open a "Visual Studio .NET Command Prompt", <tt>cd</tt> to the
|
|
|
|
directory where you've unpacked the sources and run these commands:
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
cd src
|
|
|
|
msvcbuild
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Then follow the installation instructions below.
|
|
|
|
</p>
|
2010-01-17 21:02:13 +00:00
|
|
|
<h3>Building with the Windows SDK</h3>
|
|
|
|
<p>
|
|
|
|
Open a "Windows SDK Command Shell" and select the x86 compiler:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
setenv /release /x86
|
|
|
|
</pre>
|
|
|
|
<p>
|
2010-02-28 20:45:38 +00:00
|
|
|
Or select the x64 compiler:
|
2010-01-17 21:02:13 +00:00
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
setenv /release /x64
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Then <tt>cd</tt> to the directory where you've unpacked the sources
|
|
|
|
and run these commands:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
cd src
|
|
|
|
msvcbuild
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Then follow the installation instructions below.
|
|
|
|
</p>
|
2009-12-08 18:46:35 +00:00
|
|
|
<h3>Building with MinGW or Cygwin</h3>
|
|
|
|
<p>
|
|
|
|
Open a command prompt window and make sure the MinGW or Cygwin programs
|
|
|
|
are in your path. Then <tt>cd</tt> to the directory where
|
|
|
|
you've unpacked the sources and run this command for MinGW:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
mingw32-make
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Or this command for Cygwin:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
make
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
Then follow the installation instructions below.
|
|
|
|
</p>
|
|
|
|
<h3>Installing LuaJIT</h3>
|
|
|
|
<p>
|
2009-12-08 18:49:20 +00:00
|
|
|
Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> (built in the <tt>src</tt>
|
|
|
|
directory) to a newly created directory (any location is ok).
|
|
|
|
Add <tt>lua</tt> and <tt>lua\jit</tt> directories below it and copy
|
|
|
|
all Lua files from the <tt>lib</tt> directory of the distribution
|
|
|
|
to the latter directory.
|
2009-12-08 18:46:35 +00:00
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
There are no hardcoded
|
|
|
|
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>
|
2010-03-04 18:07:38 +00:00
|
|
|
|
2010-10-04 23:36:54 +00:00
|
|
|
<h2 id="cross">Cross-compiling LuaJIT</h2>
|
2010-03-04 18:07:38 +00:00
|
|
|
<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
|
2010-03-07 16:12:21 +00:00
|
|
|
installing the multilib development packages (e.g. <tt>libc6-dev-i386</tt>
|
2010-03-04 18:07:38 +00:00
|
|
|
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">
|
2010-08-27 16:32:24 +00:00
|
|
|
make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
|
2010-03-04 18:07:38 +00:00
|
|
|
</pre>
|
2010-10-04 23:36:54 +00:00
|
|
|
<p>
|
|
|
|
You can cross-compile for a PPC/e500v2 target on an x86 or x64 host system
|
|
|
|
using a standard GNU cross-compile toolchain (Binutils, GCC, EGLIBC).
|
|
|
|
The <tt>CROSS</tt> prefix may vary depending on the <tt>--target</tt>
|
|
|
|
of the toolchain:
|
|
|
|
</p>
|
|
|
|
<pre class="code">
|
|
|
|
make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe
|
|
|
|
</pre>
|
2010-03-04 18:07:38 +00:00
|
|
|
|
2010-10-04 23:36:54 +00:00
|
|
|
<h2 id="embed">Embedding LuaJIT</h2>
|
2010-03-04 18:07:38 +00:00
|
|
|
<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
|
2010-10-04 23:36:54 +00:00
|
|
|
to LuaJIT, except link with a different library:
|
2010-03-04 18:07:38 +00:00
|
|
|
</p>
|
|
|
|
<ul>
|
2010-10-04 23:36:54 +00:00
|
|
|
<li>It's strongly suggested to build LuaJIT separately using the supplied
|
|
|
|
build system. Please do <em>not</em> attempt to integrate the individual
|
|
|
|
source files into your build tree. You'll most likely get the internal build
|
|
|
|
dependencies wrong or mess up the compiler flags. Treat LuaJIT like any
|
|
|
|
other external library and link your application with either the dynamic
|
|
|
|
or static library, depending on your needs.</li>
|
|
|
|
<li>If you want to load C modules compiled for plain Lua
|
|
|
|
with <tt>require()</tt>, you need to make sure the public symbols
|
|
|
|
(e.g. <tt>lua_pushnumber</tt>) are exported, too:
|
|
|
|
<ul><li>On POSIX systems you can either link to the shared library
|
|
|
|
or link the static library into your application. In the latter case
|
|
|
|
you'll need to export all public symbols from your main executable
|
|
|
|
(e.g. <tt>-Wl,-E</tt> on Linux) and add the external dependencies
|
|
|
|
(e.g. <tt>-lm -ldl</tt> on Linux).</li>
|
|
|
|
<li>Since Windows symbols are bound to a specific DLL name, you need to
|
|
|
|
link to the <tt>lua51.dll</tt> created by the LuaJIT build (do not rename
|
|
|
|
the DLL). You may link LuaJIT statically on Windows only if you don't
|
|
|
|
intend to load Lua/C modules at runtime.
|
|
|
|
</li></ul>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
If you're building a 64 bit application on OSX which links directly or
|
|
|
|
indirectly against LuaJIT, you need to link your main executable
|
|
|
|
with these flags:
|
|
|
|
<pre class="code">
|
|
|
|
-pagezero_size 10000 -image_base 100000000
|
|
|
|
</pre>
|
|
|
|
Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
|
|
|
|
which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
|
|
|
|
See: <tt>man rebase</tt>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>Additional hints for initializing LuaJIT using the C API functions:</p>
|
|
|
|
<ul>
|
|
|
|
<li>Here's a
|
|
|
|
<a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">»</span> simple example</a>
|
|
|
|
for embedding Lua or LuaJIT into your application.</li>
|
2010-03-04 18:07:38 +00:00
|
|
|
<li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
|
|
|
|
<tt>lua_newstate</tt>, since this uses the (slower) default memory
|
2011-02-10 02:10:38 +00:00
|
|
|
allocator from your system (no support for this on x64).</li>
|
2010-03-04 18:07:38 +00:00
|
|
|
<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>
|
2010-10-04 23:36:54 +00:00
|
|
|
<li>To change or extend the list of 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>The <tt>bit.*</tt> module for bitwise operations
|
|
|
|
is already built-in. There's no need to statically link
|
|
|
|
<a href="http://bitop.luajit.org/"><span class="ext">»</span> Lua BitOp</a> to your application.</li>
|
2010-03-04 18:07:38 +00:00
|
|
|
</ul>
|
2010-10-04 23:36:54 +00:00
|
|
|
|
|
|
|
<h2 id="distro">Hints for Distribution Maintainers</h2>
|
|
|
|
<p>
|
|
|
|
The LuaJIT build system has extra provisions for the needs of most
|
|
|
|
POSIX-based distributions. If you're a package maintainer for
|
|
|
|
a distribution, <em>please</em> make use of these features and
|
|
|
|
avoid patching, subverting, autotoolizing or messing up the build system
|
|
|
|
in unspeakable ways.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
There should be absolutely no need to patch <tt>luaconf.h</tt> or any
|
|
|
|
of the Makefiles. And please do not hand-pick files for your packages —
|
|
|
|
simply use whatever <tt>make install</tt> creates. There's a reason
|
|
|
|
for all of the files <em>and</em> directories it creates.
|
|
|
|
</p>
|
|
|
|
<p>
|
2011-02-11 12:50:01 +00:00
|
|
|
The build system uses GNU make and auto-detects most settings based on
|
2010-10-04 23:36:54 +00:00
|
|
|
the host you're building it on. This should work fine for native builds,
|
|
|
|
even when sandboxed. You may need to pass some of the following flags to
|
|
|
|
<em>both</em> the <tt>make</tt> and the <tt>make install</tt> command lines
|
|
|
|
for a regular distribution build:
|
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li><tt>PREFIX</tt> overrides the installation path and should usually
|
|
|
|
be set to <tt>/usr</tt>. Setting this also changes the module paths and
|
|
|
|
the <tt>-rpath</tt> of the shared library.</li>
|
|
|
|
<li><tt>DESTDIR</tt> is an absolute path which allows you to install
|
|
|
|
to a shadow tree instead of the root tree of the build system.</li>
|
|
|
|
<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
|
|
|
|
for additional variables to tweak. The following variables <em>may</em> be
|
2011-02-11 12:50:01 +00:00
|
|
|
overridden, but it's <em>not</em> recommended, except for special needs
|
2010-10-04 23:36:54 +00:00
|
|
|
like cross-builds:
|
|
|
|
<tt>BUILDMODE, CC, HOST_CC, STATIC_CC, DYNAMIC_CC, CFLAGS, HOST_CFLAGS,
|
|
|
|
TARGET_CFLAGS, LDFLAGS, HOST_LDFLAGS, TARGET_LDFLAGS, TARGET_SHLDFLAGS,
|
|
|
|
LIBS, HOST_LIBS, TARGET_LIBS, CROSS, HOST_SYS, TARGET_SYS</tt></li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
The build system has a special target for an amalgamated build, i.e.
|
|
|
|
<tt>make amalg</tt>. This compiles the LuaJIT core as one huge C file
|
|
|
|
and allows GCC to generate faster and shorter code. Alas, this requires
|
|
|
|
lots of memory during the build. This may be a problem for some users,
|
|
|
|
that's why it's not enabled by default. But it shouldn't be a problem for
|
|
|
|
most build farms. It's recommended that binary distributions use this
|
|
|
|
target for their LuaJIT builds.
|
|
|
|
</p>
|
2010-03-04 18:07:38 +00:00
|
|
|
<p>
|
2010-10-04 23:36:54 +00:00
|
|
|
The tl;dr version of the above:
|
2010-03-04 18:07:38 +00:00
|
|
|
</p>
|
|
|
|
<pre class="code">
|
2010-10-04 23:36:54 +00:00
|
|
|
make amalg PREFIX=/usr && \
|
|
|
|
make install PREFIX=/usr DESTDIR=/tmp/buildroot
|
2010-03-04 18:07:38 +00:00
|
|
|
</pre>
|
2010-03-07 16:12:21 +00:00
|
|
|
<p>
|
2010-10-04 23:36:54 +00:00
|
|
|
Finally, if you encounter any difficulties, please
|
|
|
|
<a href="contact.html">contact me</a> first, instead of releasing a broken
|
|
|
|
package onto unsuspecting users. Because they'll usually gonna complain
|
|
|
|
to me (the upstream) and not you (the package maintainer), anyway.
|
2010-03-07 16:12:21 +00:00
|
|
|
</p>
|
2009-12-08 18:46:35 +00:00
|
|
|
<br class="flush">
|
|
|
|
</div>
|
|
|
|
<div id="foot">
|
|
|
|
<hr class="hide">
|
2011-01-09 16:12:53 +00:00
|
|
|
Copyright © 2005-2011 Mike Pall
|
2009-12-08 18:46:35 +00:00
|
|
|
<span class="noprint">
|
|
|
|
·
|
|
|
|
<a href="contact.html">Contact</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|