Merge pull request #2998 from lateralusX/jlorenss/win-x64-full-aot-support
[mono.git] / man / mkbundle.1
1 .\" 
2 .\" mkbundle manual page.
3 .\" (C) 2004 Ximian, Inc. 
4 .\" Author:
5 .\"   Miguel de Icaza (miguel@gnu.org)
6 .\"
7 .de Sp \" Vertical space (when we can't use .PP)
8 .if t .sp .5v
9 .if n .sp
10 ..
11 .TH mkbundle "mkbundle 1.0"
12 .SH NAME
13 mkbundle, mkbundle2 \- Creates a bundled executable.
14 .SH SYNOPSIS
15 .PP
16 .B mkbundle [options] assembly1 [assembly2 ...]
17 .SH DESCRIPTION
18 \fImkbundle\fP generates an executable program that will contain
19 static copies of the assemblies listed on the command line.  By
20 default only the assemblies specified in the command line will be
21 included in the bundle.  To automatically include all of the
22 dependencies referenced, use the "--deps" command line option.
23 .PP
24 There are two modes of operation, the default one uses the
25 C compiler to create a bundle and requires a complete C and Mono SDK
26 to produced executables.   The simple mode (enabled when using the
27 "--simple") command line option does not require this, and also allows
28 for cross compilation.
29 .PP
30 For example, to create a bundle for hello world, use the following
31 command:
32 .nf
33         $ mkbundle -o hello --simple hello.exe
34 .fi
35 .PP
36 The simple version allows for cross-compiling, this requires a Mono
37 runtime to be installed in the ~/.mono/targets/TARGET/mono to be
38 available.   You can use the "--local-targets" to list all available
39 targets, and the "--cross" argument to specify the target, like this:
40 .nf
41         $ mkbundle --local-targets      
42         Available targets:
43                 default - Current System Mono
44                 4.4.0-macosx-x86
45                 4.4.0-debian-8-arm64
46         $ mkbundle --cross 4.4.0-debian-8-powerpc hello.exe -o hello-debian
47 .fi
48 .PP
49 The above will bundle your native library into hello-debian for
50 a Debian 8 system running on a PowerPC machine.
51 .SH OLD EMBEDDING
52 .PP
53 For example, to create a bundle for hello world, use the following
54 command:
55 .nf
56         $ mkbundle -o hello hello.exe
57 .fi
58 .PP
59 The above will pull hello.exe into a native program called "hello".  Notice
60 that the produced image still contains the CIL image and no
61 precompilation is done.
62 .PP
63 In addition, it is possible to control whether \fImkbundle\fP should compile
64 the resulting executable or not with the -c option.  This is useful if
65 you want to link additional libraries or control the generated output
66 in more detail. For example, this could be used to link some libraries
67 statically:
68 .nf
69         $ mkbundle -c -o host.c -oo bundles.o --deps hello.exe
70
71         $ cc host.c bundles.o /usr/lib/libmono.a -lc -lrt
72 .fi
73 .PP
74 You may also use \fImkbundle\fP to generate a bundle you can use when
75 embedding the Mono runtime in a native application.  In that case, use
76 both the -c and --nomain options.  The resulting host.c file will
77 not have a main() function.  Call mono_mkbundle_init() before
78 initializing the JIT in your code so that the bundled assemblies
79 are available to the embedded runtime.
80 .SH OPTIONS
81 .TP
82 .I "-c"
83 Produce the stub file, do not compile the resulting stub.
84 .TP
85 .I "--cross target"
86 Creates a bundle for the specified target platform.   The target
87 must be a directory in ~/.mono/targets/ that contains a "mono"
88 binary.   You can fetch various targets using the --fetch-target
89 command line option.
90 .TP
91 .I "-o filename"
92 Places the output on `out'.  If the flag -c is specified, this is the
93 C host program.  If not, this contains the resulting executable.
94 .TP
95 .I "-oo filename"
96 Specifies the name to be used for the helper object file that contains
97 the bundle.
98 .TP
99 .I "-L path"
100 Adds the `path' do the search list for assemblies.  The rules are the
101 same as for the compiler -lib: or -L flags.
102 .TP "--config FILE"
103 Specifies that a machine.config file must be bundled as well.
104 Typically this is $prefix/etc/mono/1.0/machine.config or
105 $prefix/etc/mono/2.0/machine.config depending on the profile that you
106 are using (1.0 or 2.0)
107 .TP
108 .I "--deps"
109 This option will bundle all of the referenced assemblies for the
110 assemblies listed on the command line option.  This is useful to
111 distribute a self-contained image.
112 .TP
113 .I "--fetch-target target"
114 Downloads a precompiled runtime for the specified target from the Mono
115 distribution site.
116 .TP
117 .I  "--nodeps"
118 This is the default: \fImkbundle\fP will only include the assemblies that
119 were specified on the command line to reduce the size of the resulting
120 image created.
121 .TP
122 .I "--keeptemp"
123 By default \fImkbundle\fP will delete the temporary files that it uses to
124 produce the bundle.  This option keeps the file around.
125 .TP
126 .I "--lists-targets"
127 Lists all of the available local cross compilation targets available
128 as precompiled binaries on the Mono distribution server.
129 .TP
130 .I "--local-targets"
131 Lists all of the available local cross compilation targets.
132 .TP
133 .I "--machine-config FILE"
134 Uses the given FILE as the machine.config file for the generated
135 application.   
136 .TP
137 .I "--nomain"
138 With the -c option, generate the host stub without a main() function.
139 .TP
140 .I "--config-dir DIR"
141 When passed, DIR will be set for the MONO_CFG_DIR environment variable
142 .TP
143 .I "--static"
144 By default \fImkbundle\fP dynamically links to mono and glib.  This option
145 causes it to statically link instead.
146 .TP
147 .I "--target-server SERVER"
148 By default the mkbundle tool will download from a Mono server the
149 target runtimes, you can specify a different server to provide
150 cross-compiled runtimes.
151 .TP
152 .I "-z"
153 Compresses the assemblies before embedding. This results in smaller
154 executable files, but increases startup time and requires zlib to be
155 installed on the target system.
156 .SH WINDOWS
157 On Windows systems, it it necessary to have  Unix-like toolchain to be
158 installed for \fImkbundle\fP to work.  You can use cygwin's and install gcc,
159 gcc-mingw and as packages. 
160 .SH ENVIRONMENT VARIABLES
161 .TP
162 .I "AS"
163 Assembler command. The default is "as".
164 .TP
165 .I "CC"
166 C compiler command. The default is "cc" under Linux and "gcc"
167 under Windows.
168 .TP
169 .I "MONO_BUNDLED_OPTIONS"
170 Options to be passed to the bundled
171 Mono runtime, separated by spaces. See the mono(1) manual page or run mono --help.
172 .SH FILES
173 This program will load referenced assemblies from the Mono assembly
174 cache. 
175 .PP
176 Targets are loaded from ~/.mono/targets/TARGETNAME/mono
177 .SH BUGS
178 The option "--static" is not supported under Windows.
179 Moreover, a full cygwin environment containing at least "gcc" and "as"
180 is required for the build process. The generated executable does not
181 depend on cygwin.
182 .SH MAILING LISTS
183 Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
184 .SH WEB SITE
185 Visit: http://www.mono-project.com for details
186 .SH SEE ALSO
187 .BR mcs(1), mono(1), mono-config(5).
188
189