-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle.html
142 lines (126 loc) · 6.55 KB
/
bundle.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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> bundle - LuaJIT single-executable app deployment </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 = 'bundle'
var PROJECT = 'bundle'
//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> bundle </h1>
<h2> LuaJIT single-executable app deployment </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
<table><tr><td>
<div class="doc" id="package_info_container">
<div id="package_info"> </div>
<div id="commit_log"> </div>
</div>
<a href="https://github.com/luapower/bundle" class="btn btn-rightside btn-github"><span class="icon"></span>View on GitHub</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/bundle/tarball/master" class="btn btn-rightside">Download as .tar.gz</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/bundle/zipball/master" class="btn btn-rightside">Download as .zip</a>
</td></tr></table>
</td>
</tr>
</table>
<div class="btn-container btn-discuss-container">
<a href="https://github.com/luapower/bundle/issues/new" target="_blank"
class="btn btn-rightside btn-discuss"><span class="icon"></span>Discuss</a>
</div>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-bundle" style="background-image: url('bg/bundle.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="work-in-progress">WORK IN PROGRESS</h2>
<h2 id="what-is">What Is</h2>
<p>Bundle is a small framework for bundling together LuaJIT, Lua modules, Lua/C modules, Dynasm/Lua modules, C libraries, and other static assets into a single fat executable. In its default configuration, it assumes luapower's <a href="building.html">toolchain</a> and <a href="get-involved.html">directory layout</a> and it works on Windows, Linux and OSX, x86 and x64.</p>
<h2 id="how-it-works">How it works</h2>
<p>At the core there's a slightly modifed LuaJIT frontend which adds two additional loaders at the end of the <code>package.loaders</code> table, enabling <code>require()</code> to load modules embedded in the executable when they are not found externally. <code>ffi.load()</code> is also modified to return <code>ffi.C</code> if the requested library is not found, allowing embedded C symbols to be used instead. Assets can be loaded with <code>bundle.load(filename)</code> subject to the same policy: load the embedded asset if the corresponding file is not present.</p>
<p>This allows mixed deployments where some modules and assets are bundled inside the exe and some are left outside, with no changes to the code needed. External modules always take precedence over embedded ones, allowing partial upgrades to the original executable without the need for a rebuild. To close the circle, one of the modules (embedded or not) can be specified to run instead of the usual command line, effectively enabling single-executable app deployment for pure Lua apps with no glue C code needed.</p>
<h2 id="usage">Usage</h2>
<pre><code>sh bundle.sh [options...]
-o --output <file> Output executable [a.exe]
-m --modules "file1 ..."|--all Modules to bundle
-a --alibs "lib1 ..."|--all Static libs to bundle
-d --dlibs "lib1 ..." Dynamic libs to link against
-f --frameworks "frm1 ..." Frameworks to link against (OSX)
-M --main <module> Module to run on start-up
-m32 Force 32bit platform (OSX)
-z --compress Compress the executable
-i --icon <file> Set icon (Windows)
-w --no-console Hide the terminal / console (Windows)
-ll --list-lua-modules List Lua modules
-la --list-alibs List static libs (.a files)
-C --clean Ignore the object cache
-v --verbose Be verbose
-h --help Show this screen</code></pre>
<h2 id="examples">Examples</h2>
<pre><code># full bundle: all Lua, dasm and statically built C modules
sh bundle.sh -v -a --all -m --all -M main -o fat.exe
# minimal bundle, two Lua modules, one C module, one blob
sh bundle.sh -v -a sha2 -m 'sha2 main media/bmp/bg.bmp' -M main -o lean.exe
# luajit frontend with built-in luasocket support, no main module
sh bundle.sh -v -a 'socket_core mime_core' -m 'socket mime ltn12 socket/*.lua' -o luajit.exe</code></pre>
<h2 id="about-compression">About compression</h2>
<p>Compressed executables cannot be mmapped, so they have to stay in RAM fully and always. If the bundled assets are large and compressible, better results can be acheived by compressing them individually instead of compressing the entire exe.</p>
</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>