FFI: Fix code generation for replay of sunk float fields.
[luajit-2.0.git] / doc / install.html
blob7d8636d2a592646f0ca12676b9135226ad62f795
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <title>Installation</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <meta name="Author" content="Mike Pall">
7 <meta name="Copyright" content="Copyright (C) 2005-2012, Mike Pall">
8 <meta name="Language" content="en">
9 <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10 <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
11 <style type="text/css">
12 table.compat {
13 line-height: 1.2;
14 font-size: 80%;
16 table.compat td {
17 border: 1px solid #bfcfff;
18 height: 2.5em;
20 table.compat tr.compathead td {
21 font-weight: bold;
22 border-bottom: 2px solid #bfcfff;
24 tr.compathead td.compatos {
25 vertical-align: top;
27 table.compat td.compatcpu {
28 width: 18%;
29 border-right: 2px solid #bfcfff;
31 td.compatos {
32 width: 21%;
33 vertical-align: middle;
35 td.compatno {
36 background-color: #d0d0d0;
38 </style>
39 </head>
40 <body>
41 <div id="site">
42 <a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
43 </div>
44 <div id="head">
45 <h1>Installation</h1>
46 </div>
47 <div id="nav">
48 <ul><li>
49 <a href="luajit.html">LuaJIT</a>
50 <ul><li>
51 <a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
52 </li><li>
53 <a class="current" href="install.html">Installation</a>
54 </li><li>
55 <a href="running.html">Running</a>
56 </li></ul>
57 </li><li>
58 <a href="extensions.html">Extensions</a>
59 <ul><li>
60 <a href="ext_ffi.html">FFI Library</a>
61 <ul><li>
62 <a href="ext_ffi_tutorial.html">FFI Tutorial</a>
63 </li><li>
64 <a href="ext_ffi_api.html">ffi.* API</a>
65 </li><li>
66 <a href="ext_ffi_semantics.html">FFI Semantics</a>
67 </li></ul>
68 </li><li>
69 <a href="ext_jit.html">jit.* Library</a>
70 </li><li>
71 <a href="ext_c_api.html">Lua/C API</a>
72 </li></ul>
73 </li><li>
74 <a href="status.html">Status</a>
75 <ul><li>
76 <a href="changes.html">Changes</a>
77 </li></ul>
78 </li><li>
79 <a href="faq.html">FAQ</a>
80 </li><li>
81 <a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
82 </li><li>
83 <a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
84 </li><li>
85 <a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
86 </li></ul>
87 </div>
88 <div id="main">
89 <p>
90 LuaJIT is only distributed as a source package. This page explains
91 how to build and install LuaJIT with different operating systems
92 and C&nbsp;compilers.
93 </p>
94 <p>
95 For the impatient (on POSIX systems):
96 </p>
97 <pre class="code">
98 make &amp;&amp; sudo make install
99 </pre>
101 LuaJIT currently builds out-of-the box on most systems.
102 Here's the compatibility matrix for the supported combinations of
103 operating systems, CPUs and compilers:
104 </p>
105 <table class="compat">
106 <tr class="compathead">
107 <td class="compatcpu">CPU / OS</td>
108 <td class="compatos"><a href="#posix">Linux</a> or<br><a href="#android">Android</a></td>
109 <td class="compatos"><a href="#posix">*BSD, Other</a></td>
110 <td class="compatos"><a href="#posix">OSX 10.4+</a> or<br><a href="#ios">iOS 3.0+</a></td>
111 <td class="compatos"><a href="#windows">Windows<br>XP/Vista/7</a></td>
112 </tr>
113 <tr class="odd separate">
114 <td class="compatcpu">x86 (32 bit)</td>
115 <td class="compatos">GCC 4.x<br>GCC 3.4</td>
116 <td class="compatos">GCC 4.x<br>GCC 3.4</td>
117 <td class="compatos">GCC 4.x<br>GCC 3.4</td>
118 <td class="compatos">MSVC, MSVC/EE<br>WinSDK<br>MinGW, Cygwin</td>
119 </tr>
120 <tr class="even">
121 <td class="compatcpu">x64 (64 bit)</td>
122 <td class="compatos">GCC 4.x</td>
123 <td class="compatos compatno">&nbsp;</td>
124 <td class="compatos">GCC 4.x</td>
125 <td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td>
126 </tr>
127 <tr class="odd">
128 <td class="compatcpu"><a href="#cross2">ARMv5+<br>ARM9E+</a></td>
129 <td class="compatos">GCC 4.2+</td>
130 <td class="compatos">GCC 4.2+</td>
131 <td class="compatos">GCC 4.2+</td>
132 <td class="compatos compatno">&nbsp;</td>
133 </tr>
134 <tr class="even">
135 <td class="compatcpu"><a href="#cross2">PPC</a></td>
136 <td class="compatos">GCC 4.3+</td>
137 <td class="compatos">GCC 4.3+<br>GCC 4.1 (<a href="#cross2">PS3</a>)</td>
138 <td class="compatos compatno">&nbsp;</td>
139 <td class="compatos compatno">&nbsp;</td>
140 </tr>
141 <tr class="odd">
142 <td class="compatcpu"><a href="#cross2">PPC/e500v2</a></td>
143 <td class="compatos">GCC 4.3+</td>
144 <td class="compatos">GCC 4.3+</td>
145 <td class="compatos compatno">&nbsp;</td>
146 <td class="compatos compatno">&nbsp;</td>
147 </tr>
148 <tr class="even">
149 <td class="compatcpu"><a href="#cross2">MIPS</a></td>
150 <td class="compatos">GCC 4.3+</td>
151 <td class="compatos">GCC 4.3+</td>
152 <td class="compatos compatno">&nbsp;</td>
153 <td class="compatos compatno">&nbsp;</td>
154 </tr>
155 </table>
157 <h2>Configuring LuaJIT</h2>
159 The standard configuration should work fine for most installations.
160 Usually there is no need to tweak the settings. The following files
161 hold all user-configurable settings:
162 </p>
163 <ul>
164 <li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
165 <li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
166 only).</li>
167 <li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
168 under POSIX, MinGW or Cygwin.</li>
169 <li><tt>src/msvcbuild.bat</tt> has settings for compiling LuaJIT with
170 MSVC or WinSDK.</li>
171 </ul>
173 Please read the instructions given in these files, before changing
174 any settings.
175 </p>
177 <h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
178 <h3>Prerequisites</h3>
180 Depending on your distribution, you may need to install a package for
181 GCC, the development headers and/or a complete SDK. E.g. on a current
182 Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager.
183 </p>
185 Download the current source package of LuaJIT (pick the .tar.gz),
186 if you haven't already done so. Move it to a directory of your choice,
187 open a terminal window and change to this directory. Now unpack the archive
188 and change to the newly created directory:
189 </p>
190 <pre class="code">
191 tar zxf LuaJIT-2.0.0-beta11.tar.gz
192 cd LuaJIT-2.0.0-beta11</pre>
193 <h3>Building LuaJIT</h3>
195 The supplied Makefiles try to auto-detect the settings needed for your
196 operating system and your compiler. They need to be run with GNU Make,
197 which is probably the default on your system, anyway. Simply run:
198 </p>
199 <pre class="code">
200 make
201 </pre>
203 This always builds a native x86, x64 or PPC binary, depending on the host OS
204 you're running this command on. Check the section on
205 <a href="#cross">cross-compilation</a> for more options.
206 </p>
208 By default, modules are only searched under the prefix <tt>/usr/local</tt>.
209 You can add an extra prefix to the search paths by appending the
210 <tt>PREFIX</tt> option, e.g.:
211 </p>
212 <pre class="code">
213 make PREFIX=/home/myself/lj2
214 </pre>
216 Note for OSX: if the <tt>MACOSX_DEPLOYMENT_TARGET</tt> environment
217 variable is not set, then it's forced to <tt>10.4</tt>.
218 </p>
219 <h3>Installing LuaJIT</h3>
221 The top-level Makefile installs LuaJIT by default under
222 <tt>/usr/local</tt>, i.e. the executable ends up in
223 <tt>/usr/local/bin</tt> and so on. You need root privileges
224 to write to this path. So, assuming sudo is installed on your system,
225 run the following command and enter your sudo password:
226 </p>
227 <pre class="code">
228 sudo make install
229 </pre>
231 Otherwise specify the directory prefix as an absolute path, e.g.:
232 </p>
233 <pre class="code">
234 make install PREFIX=/home/myself/lj2
235 </pre>
237 Obviously the prefixes given during build and installation need to be the same.
238 </p>
239 <p style="color: #c00000;">
240 Note: to avoid overwriting a previous version, the beta test releases
241 only install the LuaJIT executable under the versioned name (i.e.
242 <tt>luajit-2.0.0-beta11</tt>). You probably want to create a symlink
243 for convenience, with a command like this:
244 </p>
245 <pre class="code" style="color: #c00000;">
246 sudo ln -sf luajit-2.0.0-beta11&nbsp;/usr/local/bin/luajit
247 </pre>
249 <h2 id="windows">Windows Systems</h2>
250 <h3>Prerequisites</h3>
252 Either install one of the open source SDKs
253 (<a href="http://mingw.org/"><span class="ext">&raquo;</span>&nbsp;MinGW</a> or
254 <a href="http://www.cygwin.com/"><span class="ext">&raquo;</span>&nbsp;Cygwin</a>), which come with a modified
255 GCC plus the required development headers.
256 </p>
258 Or install Microsoft's Visual C++ (MSVC). The freely downloadable
259 <a href="http://www.microsoft.com/Express/VC/"><span class="ext">&raquo;</span>&nbsp;Express Edition</a>
260 works just fine, but only contains an x86 compiler.
261 </p>
263 The freely downloadable
264 <a href="http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx"><span class="ext">&raquo;</span>&nbsp;Windows SDK</a>
265 only comes with command line tools, but this is all you need to build LuaJIT.
266 It contains x86 and x64 compilers.
267 </p>
269 Next, download the source package and unpack it using an archive manager
270 (e.g. the Windows Explorer) to a directory of your choice.
271 </p>
272 <h3>Building with MSVC</h3>
274 Open a "Visual Studio .NET Command Prompt", <tt>cd</tt> to the
275 directory where you've unpacked the sources and run these commands:
276 </p>
277 <pre class="code">
278 cd src
279 msvcbuild
280 </pre>
282 Then follow the installation instructions below.
283 </p>
284 <h3>Building with the Windows SDK</h3>
286 Open a "Windows SDK Command Shell" and select the x86 compiler:
287 </p>
288 <pre class="code">
289 setenv /release /x86
290 </pre>
292 Or select the x64 compiler:
293 </p>
294 <pre class="code">
295 setenv /release /x64
296 </pre>
298 Then <tt>cd</tt> to the directory where you've unpacked the sources
299 and run these commands:
300 </p>
301 <pre class="code">
302 cd src
303 msvcbuild
304 </pre>
306 Then follow the installation instructions below.
307 </p>
308 <h3>Building with MinGW or Cygwin</h3>
310 Open a command prompt window and make sure the MinGW or Cygwin programs
311 are in your path. Then <tt>cd</tt> to the directory where
312 you've unpacked the sources and run this command for MinGW:
313 </p>
314 <pre class="code">
315 mingw32-make
316 </pre>
318 Or this command for Cygwin:
319 </p>
320 <pre class="code">
321 make
322 </pre>
324 Then follow the installation instructions below.
325 </p>
326 <h3>Installing LuaJIT</h3>
328 Copy <tt>luajit.exe</tt> and <tt>lua51.dll</tt> (built in the <tt>src</tt>
329 directory) to a newly created directory (any location is ok).
330 Add <tt>lua</tt> and <tt>lua\jit</tt> directories below it and copy
331 all Lua files from the <tt>src\jit</tt> directory of the distribution
332 to the latter directory.
333 </p>
335 There are no hardcoded
336 absolute path names &mdash; all modules are loaded relative to the
337 directory where <tt>luajit.exe</tt> is installed
338 (see <tt>src/luaconf.h</tt>).
339 </p>
341 <h2 id="cross">Cross-compiling LuaJIT</h2>
343 The GNU Makefile-based build system allows cross-compiling on any host
344 for any supported target, as long as both architectures have the same
345 pointer size. If you want to cross-compile to any 32 bit target on an
346 x64 OS, you need to install the multilib development package (e.g.
347 <tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part
348 (<tt>HOST_CC="gcc -m32"</tt>).
349 </p>
351 You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the
352 target OS differ, or you'll get assembler or linker errors. E.g. if
353 you're compiling on a Windows or OSX host for embedded Linux or Android,
354 you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a
355 minimal target OS, you may need to disable the built-in allocator in
356 <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. The examples
357 below only show some popular targets &mdash; please check the comments
358 in <tt>src/Makefile</tt> for more details.
359 </p>
360 <pre class="code">
361 # Cross-compile to a 32 bit binary on a multilib x64 OS
362 make CC="gcc -m32"
364 # Cross-compile on Debian/Ubuntu for Windows (mingw32 package)
365 make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
366 </pre>
367 <p id="cross2">
368 The <tt>CROSS</tt> prefix allows specifying a standard GNU cross-compile
369 toolchain (Binutils, GCC and a matching libc). The prefix may vary
370 depending on the <tt>--target</tt> the toolchain was built for (note the
371 <tt>CROSS</tt> prefix has a trailing <tt>"-"</tt>). The examples below
372 use the canonical toolchain triplets for Linux.
373 </p>
375 Since there's often no easy way to detect CPU features at runtime, it's
376 important to compile with the proper CPU or architecture settings. You
377 can specify these when building the toolchain yourself. Or add
378 <tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For
379 ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting,
380 too. Otherwise LuaJIT may not run at the full performance of your target
381 CPU.
382 </p>
383 <pre class="code">
384 # ARM soft-float
385 make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
386 TARGET_CFLAGS="-mfloat-abi=soft"
388 # ARM soft-float ABI with VFP (example for Cortex-a8)
389 make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
390 TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp"
392 # ARM hard-float ABI with VFP (armhf, requires recent toolchain)
393 make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
395 # PPC
396 make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
397 # PPC/e500v2 (fast interpreter only)
398 make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe-
399 # PS3 (fast interpreter only)
400 make HOST_CC="gcc -m32" CROSS=ppu-lv2-
402 # MIPS big-endian
403 make HOST_CC="gcc -m32" CROSS=mips-linux-
404 # MIPS little-endian
405 make HOST_CC="gcc -m32" CROSS=mipsel-linux-
406 </pre>
408 You can cross-compile for <b id="android">Android</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">&raquo;</span>&nbsp;Android NDK</a>.
409 The environment variables need to match the install locations and the
410 desired target platform. E.g. Android&nbsp;4.0 corresponds to ABI level&nbsp;14.
411 For details check the folder <tt>docs</tt> in the NDK directory.
412 </p>
414 Only a few common variations for the different CPUs, ABIs and platforms
415 are listed. Please use your own judgement for which combination you want
416 to build/deploy or which lowest common denominator you want to pick:
417 </p>
418 <pre class="code">
419 # Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
420 NDK=/opt/android/ndk
421 NDKABI=8
422 NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
423 NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
424 NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
425 make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
427 # Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
428 NDK=/opt/android/ndk
429 NDKABI=14
430 NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
431 NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
432 NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
433 NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
434 make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
436 # Android/MIPS, mips (MIPS32R1 hard-float), Android 4.0+ (ICS)
437 NDK=/opt/android/ndk
438 NDKABI=14
439 NDKVER=$NDK/toolchains/mipsel-linux-android-4.6
440 NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android-
441 NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips"
442 make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
444 # Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS)
445 NDK=/opt/android/ndk
446 NDKABI=14
447 NDKVER=$NDK/toolchains/x86-4.6
448 NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android-
449 NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
450 make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
451 </pre>
453 You can cross-compile for <b id="ios">iOS 3.0+</b> (iPhone/iPad) using the <a href="http://developer.apple.com/devcenter/ios/index.action"><span class="ext">&raquo;</span>&nbsp;iOS SDK</a>.
454 The environment variables need to match the iOS SDK version:
455 </p>
456 <p style="font-size: 8pt;">
457 Note: <b>the JIT compiler is disabled for iOS</b>, because regular iOS Apps
458 are not allowed to generate code at runtime. You'll only get the performance
459 of the LuaJIT interpreter on iOS. This is still faster than plain Lua, but
460 much slower than the JIT compiler. Please complain to Apple, not me.
461 Or use Android. :-p
462 </p>
463 <pre class="code">
464 IXCODE=/Applications/Xcode45-DP4.app/Contents
465 ISDK=$IXCODE/Developer/Platforms/iPhoneOS.platform/Developer
466 ISDKVER=iPhoneOS6.0.sdk
467 ISDKP=$ISDK/usr/bin/
468 ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
469 make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
470 TARGET_SYS=iOS
471 </pre>
473 <h2 id="embed">Embedding LuaJIT</h2>
475 LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua
476 into your application, you probably don't need to do anything to switch
477 to LuaJIT, except link with a different library:
478 </p>
479 <ul>
480 <li>It's strongly suggested to build LuaJIT separately using the supplied
481 build system. Please do <em>not</em> attempt to integrate the individual
482 source files into your build tree. You'll most likely get the internal build
483 dependencies wrong or mess up the compiler flags. Treat LuaJIT like any
484 other external library and link your application with either the dynamic
485 or static library, depending on your needs.</li>
486 <li>If you want to load C modules compiled for plain Lua
487 with <tt>require()</tt>, you need to make sure the public symbols
488 (e.g. <tt>lua_pushnumber</tt>) are exported, too:
489 <ul><li>On POSIX systems you can either link to the shared library
490 or link the static library into your application. In the latter case
491 you'll need to export all public symbols from your main executable
492 (e.g. <tt>-Wl,-E</tt> on Linux) and add the external dependencies
493 (e.g. <tt>-lm -ldl</tt> on Linux).</li>
494 <li>Since Windows symbols are bound to a specific DLL name, you need to
495 link to the <tt>lua51.dll</tt> created by the LuaJIT build (do not rename
496 the DLL). You may link LuaJIT statically on Windows only if you don't
497 intend to load Lua/C modules at runtime.
498 </li></ul>
499 </li>
500 <li>
501 If you're building a 64 bit application on OSX which links directly or
502 indirectly against LuaJIT, you need to link your main executable
503 with these flags:
504 <pre class="code">
505 -pagezero_size 10000 -image_base 100000000
506 </pre>
507 Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
508 which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
509 See: <tt>man rebase</tt>
510 </li>
511 </ul>
512 <p>Additional hints for initializing LuaJIT using the C API functions:</p>
513 <ul>
514 <li>Here's a
515 <a href="http://lua-users.org/wiki/SimpleLuaApiExample"><span class="ext">&raquo;</span>&nbsp;simple example</a>
516 for embedding Lua or LuaJIT into your application.</li>
517 <li>Make sure you use <tt>luaL_newstate</tt>. Avoid using
518 <tt>lua_newstate</tt>, since this uses the (slower) default memory
519 allocator from your system (no support for this on x64).</li>
520 <li>Make sure you use <tt>luaL_openlibs</tt> and not the old Lua 5.0 style
521 of calling <tt>luaopen_base</tt> etc. directly.</li>
522 <li>To change or extend the list of standard libraries to load, copy
523 <tt>src/lib_init.c</tt> to your project and modify it accordingly.
524 Make sure the <tt>jit</tt> library is loaded or the JIT compiler
525 will not be activated.</li>
526 <li>The <tt>bit.*</tt> module for bitwise operations
527 is already built-in. There's no need to statically link
528 <a href="http://bitop.luajit.org/"><span class="ext">&raquo;</span>&nbsp;Lua BitOp</a> to your application.</li>
529 </ul>
531 <h2 id="distro">Hints for Distribution Maintainers</h2>
533 The LuaJIT build system has extra provisions for the needs of most
534 POSIX-based distributions. If you're a package maintainer for
535 a distribution, <em>please</em> make use of these features and
536 avoid patching, subverting, autotoolizing or messing up the build system
537 in unspeakable ways.
538 </p>
540 There should be absolutely no need to patch <tt>luaconf.h</tt> or any
541 of the Makefiles. And please do not hand-pick files for your packages &mdash;
542 simply use whatever <tt>make install</tt> creates. There's a reason
543 for all of the files <em>and</em> directories it creates.
544 </p>
546 The build system uses GNU make and auto-detects most settings based on
547 the host you're building it on. This should work fine for native builds,
548 even when sandboxed. You may need to pass some of the following flags to
549 <em>both</em> the <tt>make</tt> and the <tt>make install</tt> command lines
550 for a regular distribution build:
551 </p>
552 <ul>
553 <li><tt>PREFIX</tt> overrides the installation path and should usually
554 be set to <tt>/usr</tt>. Setting this also changes the module paths and
555 the <tt>-rpath</tt> of the shared library.</li>
556 <li><tt>DESTDIR</tt> is an absolute path which allows you to install
557 to a shadow tree instead of the root tree of the build system.</li>
558 <li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
559 for additional variables to tweak. The following variables <em>may</em> be
560 overridden, but it's <em>not</em> recommended, except for special needs
561 like cross-builds:
562 <tt>BUILDMODE, CC, HOST_CC, STATIC_CC, DYNAMIC_CC, CFLAGS, HOST_CFLAGS,
563 TARGET_CFLAGS, LDFLAGS, HOST_LDFLAGS, TARGET_LDFLAGS, TARGET_SHLDFLAGS,
564 TARGET_FLAGS, LIBS, HOST_LIBS, TARGET_LIBS, CROSS, HOST_SYS, TARGET_SYS
565 </tt></li>
566 </ul>
568 The build system has a special target for an amalgamated build, i.e.
569 <tt>make amalg</tt>. This compiles the LuaJIT core as one huge C file
570 and allows GCC to generate faster and shorter code. Alas, this requires
571 lots of memory during the build. This may be a problem for some users,
572 that's why it's not enabled by default. But it shouldn't be a problem for
573 most build farms. It's recommended that binary distributions use this
574 target for their LuaJIT builds.
575 </p>
577 The tl;dr version of the above:
578 </p>
579 <pre class="code">
580 make amalg PREFIX=/usr && \
581 make install PREFIX=/usr DESTDIR=/tmp/buildroot
582 </pre>
584 Finally, if you encounter any difficulties, please
585 <a href="contact.html">contact me</a> first, instead of releasing a broken
586 package onto unsuspecting users. Because they'll usually gonna complain
587 to me (the upstream) and not you (the package maintainer), anyway.
588 </p>
589 <br class="flush">
590 </div>
591 <div id="foot">
592 <hr class="hide">
593 Copyright &copy; 2005-2012 Mike Pall
594 <span class="noprint">
595 &middot;
596 <a href="contact.html">Contact</a>
597 </span>
598 </div>
599 </body>
600 </html>