-
Notifications
You must be signed in to change notification settings - Fork 1
/
building.html
266 lines (259 loc) · 14 KB
/
building.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> building - how to build binaries </title>
<script src="jquery.js"></script>
<script src="jquery-cookie.js"></script>
<script src="jquery-tablesorter.js"></script>
<script src="strftime.js"></script>
<script src="mustache.js"></script>
<script src="config.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="templates/reset.css" />
<link rel="stylesheet" type="text/css" href="templates/hack.css" />
<link rel="stylesheet" type="text/css" id="lights_css" />
<script>
var DOCNAME = 'building'
var PROJECT = ''
//set the lights before rendering starts
set_lights()
</script>
</head>
<body>
<header>
<div class="container">
<div class="btn-container btn-lights-container">
<a href="#" class="btn btn-lights" id="lights">lights</a>
</div>
<div class="btn-container btn-home-container">
<a href="/" class="btn btn-home">luapower</a>
</div>
<table id="header_table">
<tr>
<td style="vertical-align: middle;" width="100%">
<h1> building </h1>
<h2> how to build binaries </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
</td>
</tr>
</table>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-building" style="background-image: url('bg/building.png');"></div>
</div>
</div>
<div class="under-header">
<div class="container">
<div id="toc_container" class="toc_container doc"></div>
<button id=tab1_button class="tab_button hidden">Documentation</button>
<button id=tab2_button class="tab_button hidden">Package Info</button>
<div id="tabs_cointainer">
<div id="tab1_container">
<section class="doc">
<span id="module_info"></span>
<h2 id="what-you-need-to-know-first">What you need to know first</h2>
<ul>
<li>Building is based on one-liner shell scripts that invoke gcc directly (no makefiles).</li>
<li>Each supported package/platform/arch has a separate build script <code>csrc/<package>/build-<platf><arch>.sh</code>.</li>
<li>Not all platform/arch combinations are supported for all packages (sort packages by platform to check).</li>
<li>C sources are included so you can start right away.</li>
<li>Dependent packages are listed in <code>csrc/<package>/WHAT</code>. Build those first.</li>
<li>For building Lua/C modules you need <a href="lua-headers.html">lua-headers</a>.</li>
<li>For building Lua/C modules for Windows you need <a href="luajit.html">luajit</a> (for linking to lua51.dll).</li>
<li>You will get stripped binaries, with libgcc and libstdc++ statically linked, except on OSX (see below).</li>
<li>Windows binaries are linked to msvcrt.dll and Lua/C modules are linked to lua51.dll.</li>
<li>Windows builds are compatible down to Windows 2000/XP (32bit and 64bit)</li>
<li>OSX builds are compatible down to OSX 10.6 (x86 only, 32bit and 64bit)</li>
</ul>
<h2 id="building-on-windows-32bit-for-windows-32bit">Building on Windows 32bit for Windows 32bit</h2>
<p>Use <code>build-mingw32.sh</code> (that is <code>sh build-mingw32.sh</code> from the command line). These scripts assume that both MSys and MinGW bin dirs (in this order) are in your PATH. Below is the exact list of MinGW packages used to build the current luapower stack:</p>
<table>
<tbody>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/binutils-2.23.1/binutils-2.23.1-1-mingw32-bin.tar.lzma">binutils-2.23.1-1-mingw32-bin</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.20/mingwrt-3.20-2-mingw32-dev.tar.lzma">mingwrt-3.20-2-mingw32-dev</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/mingwrt-3.20/mingwrt-3.20-2-mingw32-dll.tar.lzma">mingwrt-3.20-2-mingw32-dll</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.17/w32api-3.17-2-mingw32-dev.tar.lzma">w32api-3.17-2-mingw32-dev</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mpc/mpc-0.8.1-1/mpc-0.8.1-1-mingw32-dev.tar.lzma">mpc-0.8.1-1-mingw32-dev</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mpc/mpc-0.8.1-1/libmpc-0.8.1-1-mingw32-dll-2.tar.lzma">libmpc-0.8.1-1-mingw32-dll-2</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mpfr/mpfr-2.4.1-1/mpfr-2.4.1-1-mingw32-dev.tar.lzma">mpfr-2.4.1-1-mingw32-dev</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/mpfr/mpfr-2.4.1-1/libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma">libmpfr-2.4.1-1-mingw32-dll-1</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/gmp-5.0.1-1-mingw32-dev.tar.lzma">gmp-5.0.1-1-mingw32-dev</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/libgmp-5.0.1-1-mingw32-dll-10.tar.lzma">libgmp-5.0.1-1-mingw32-dll-10</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2/pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma">pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2/libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma">libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/libiconv-1.14-2/libiconv-1.14-2-mingw32-dev.tar.lzma">libiconv-1.14-2-mingw32-dev</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/libiconv-1.14-2/libiconv-1.14-2-mingw32-dll-2.tar.lzma">libiconv-1.14-2-mingw32-dll-2</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gettext/gettext-0.18.1.1-2/libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma">libintl-0.18.1.1-2-mingw32-dll-8</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/libgomp-4.7.2-1-mingw32-dll-1.tar.lzma">libgomp-4.7.2-1-mingw32-dll-1</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/libssp-4.7.2-1-mingw32-dll-0.tar.lzma">libssp-4.7.2-1-mingw32-dll-0</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/libquadmath-4.7.2-1-mingw32-dll-0.tar.lzma">libquadmath-4.7.2-1-mingw32-dll-0</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/gcc-core-4.7.2-1-mingw32-bin.tar.lzma">gcc-core-4.7.2-1-mingw32-bin</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/libgcc-4.7.2-1-mingw32-dll-1.tar.lzma">libgcc-4.7.2-1-mingw32-dll-1</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/gcc-c%2B%2B-4.7.2-1-mingw32-bin.tar.lzma">gcc-c++-4.7.2-1-mingw32-bin</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.7.2-1/libstdc%2B%2B-4.7.2-1-mingw32-dll-6.tar.lzma">libstdc++-4.7.2-1-mingw32-dll-6</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingw/files/MinGW/Extension/make/make-3.82-mingw32/make-3.82-5-mingw32-bin.tar.lzma">make-3.82-5-mingw32-bin</a></td>
</tr>
</tbody>
</table>
<p>Additional tools needed by a few special packages (use them for building for 64bit too):</p>
<table>
<tbody>
<tr class="odd">
<td align="left"><a href="http://www.jgoettgens.de/Meine_Bilder_und_Dateien/ragel-vs2012.7z">ragel 6.8 (only for harfbuzz)</a></td>
</tr>
<tr class="even">
<td align="left"><a href="http://www.nasm.us/pub/nasm/releasebuilds/2.11/win32/nasm-2.11-win32.zip">nasm 2.11 (only for libjpeg-turbo)</a></td>
</tr>
<tr class="odd">
<td align="left"><a href="http://www.cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.zip">cmake 2.8.12.2 (only for libjpeg-turbo)</a></td>
</tr>
</tbody>
</table>
<h2 id="building-on-windows-64bit-for-windows-64bit">Building on Windows 64bit for Windows 64bit</h2>
<p>Use <code>sh build-mingw64.sh</code>. These scripts assume that both MSys and MinGW-w64 bin dirs (in this order) are in your PATH. Here's the exact MinGW-w64 package used to build the current luapower stack:</p>
<table>
<tbody>
<tr class="odd">
<td align="left"><a href="http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-posix/seh/x64-4.8.1-release-posix-seh-rev5.7z">mingw-w64 4.8.1 (64bit, posix threads, SEH exception model)</a></td>
</tr>
</tbody>
</table>
<h2 id="building-on-windows-32bit-for-windows-64bit">Building on Windows 32bit for Windows 64bit</h2>
<p>MinGW-w64 can be used to cross-compile C libraries for x86_64 from a 32bit Windows machine. But MinGW-w64 cannot be used to cross-compile LuaJIT this way because LuaJIT requires SEH for the x86_64 target, and there's no MinGW-w64 32bit binaries for that.</p>
<blockquote>
<p>Note that in MinGW-w64 terminology, host means target and target means host.</p>
</blockquote>
<p>Because of that limitation, this is not a supported host/target cross-compling combination.</p>
<p>If you still want to do it, you can download the <a href="http://heanet.dl.sourceforge.net/project/mingwbuilds/host-windows/releases/4.8.1/32-bit/threads-posix/sjlj/">latest toolchain</a> from mingwbuilds, add mingw32/bin in your PATH and build using <code>build-mingw64-from-win32.sh</code> where available.</p>
<blockquote>
<p>NOTE: This will build libraries with the SJLJ exception model, unlike current luapower binaries which use SEH.</p>
</blockquote>
<h2 id="building-on-linux-for-linux-x86-native">Building on Linux for Linux (x86 native)</h2>
<p>Use <code>build-linux32.sh</code> on a 32bit host and <code>build-linux64.sh</code> on a 64bit host. Careful not to mix them up, or you'll get 32bit binaries in the 64bit directory or viceversa.</p>
<p>You need a recent gcc toolchain, which you probably already have.</p>
<p>The current luapower stack is built with gcc 4.7.2 from tinycore 5.2 (see below).</p>
<h2 id="building-on-windows-or-osx-for-linux-x86-32bit-and-64bit">Building on Windows or OSX for Linux (x86 32bit and 64bit)</h2>
<p>If you are on Windows or OSX and you want to compile for Linux and don't want to mess with a cross-compiler, here is a quick method to build Linux binaries from a Windows or OSX (or even Linux) environment.</p>
<ul>
<li>Grab VirtualBox</li>
<li>Grab TinyCore
<ul>
<li>32bit: <a href="http://distro.ibiblio.org/tinycorelinux/5.x/x86/release/Core-5.2.iso">Core-5.2.iso</a> (10 MB!)</li>
<li>64bit: <a href="http://distro.ibiblio.org/tinycorelinux/5.x/x86_64/release/CorePure64-5.2.iso">CorePure64-5.2.iso</a> (10 MB!)</li>
</ul></li>
<li>Make a VM, set up like this:
<ul>
<li>give it 512M RAM or more</li>
<li>add a network card with Internet access</li>
<li>a disk is not necessary, tinycore runs entirely from RAM, if you have enough</li>
<li>enable PAE under System -> Processor</li>
<li>enable VT-x and Nested Paging under System -> Acceleration (if your CPU supports it)
<ul>
<li>if you are on a 32bit Windows and you want to run a 64bit Linux, your CPU <em>must</em> have hardware acceleration</li>
</ul></li>
</ul></li>
<li>Boot it up</li>
<li>Get gear (git and toolchain)
<ul>
<li><code>$ tce-load -wi git compiletc</code></li>
</ul></li>
<li>Get luapower
<ul>
<li><code>$ git clone https://github.com/luapower/luapower-git luapower</code></li>
<li><code>$ cd luapower</code></li>
</ul></li>
<li>Get all luapower packages
<ul>
<li><code>$ ./clone.sh --all</code></li>
</ul></li>
<li>Build all luapower packages (it will only build for your platform, either 32bit or 64bit)
<ul>
<li><code>$ cd csrc</code></li>
<li><code>$ ./build.sh --all</code></li>
</ul></li>
<li>Or, get and compile packages individually
<ul>
<li><code>$ ./clone.sh --list</code></li>
<li><code>$ ./clone.sh foobar</code></li>
<li><code>$ cd csrc/foobar</code></li>
<li><code>$ ./build-linux32.sh</code> or <code>./build-linux64.sh</code>, depending on what ISO you used</li>
</ul></li>
</ul>
<h2 id="building-on-osx-for-osx-x86-32bit-and-64bit">Building on OSX for OSX (x86 32bit and 64bit)</h2>
<p>Use <code>build-osx32.sh</code> to make 32bit x86 binaries and <code>build-osx64.sh</code> to make 64bit x86 binaries. Clang is a cross-compiler, so you can build for 32bit on a 64bit OSX and viceversa.</p>
<p>Current OSX builds are based on clang 5.0 (clang-500.2.279) which comes with Xcode 5.0.2, and are done on a 64bit OSX 10.9.</p>
<p>The generated binaries are compatible down to OSX 10.6 for both 32bit and 64bit.</p>
<blockquote>
<p>NOTE: Clang/OSX doesn't (and will not) support static binding of the standard C++ library nor of libgcc.</p>
</blockquote>
</section>
</div>
<div id="tab2_container" class="doc"></div>
</div>
</div>
<div class="container">
<footer>
<div id="disqus_thread"></div>
<div class="faint">[email protected] | <a href="http://unlicense.org/">public domain</a></div>
</footer>
</div>
</div>
<script type="text/x-mustache" id=info_tab_template>
<h3>Modules</h3>
<ul>
{{#module_array}}
<li>{{name}}</li>
{{/module_array}}
</ul>
</script>
</body>
</html>