summaryrefslogtreecommitdiff
path: root/doc/flatpak-builder.xml
blob: eb2858ae79ca2b2a052456dc28b06e3275324f1e (plain)
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<refentry id="flatpak-builder">

    <refentryinfo>
        <title>flatpak builder</title>
        <productname>flatpak</productname>

        <authorgroup>
            <author>
                <contrib>Developer</contrib>
                <firstname>Alexander</firstname>
                <surname>Larsson</surname>
                <email>alexl@redhat.com</email>
            </author>
        </authorgroup>
    </refentryinfo>

    <refmeta>
        <refentrytitle>flatpak-builder</refentrytitle>
        <manvolnum>1</manvolnum>
    </refmeta>

    <refnamediv>
        <refname>flatpak-builder</refname>
        <refpurpose>Help build application dependencies</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
            <cmdsynopsis>
                <command>flatpak-builder</command>
                <arg choice="opt" rep="repeat">OPTION</arg>
                <arg choice="plain">DIRECTORY</arg>
                <arg choice="plain">MANIFEST</arg>
            </cmdsynopsis>
            <cmdsynopsis>
                <command>flatpak-builder</command>
                <arg choice="plain">--run</arg>
                <arg choice="opt" rep="repeat">OPTION</arg>
                <arg choice="plain">DIRECTORY</arg>
                <arg choice="plain">MANIFEST</arg>
                <arg choice="plain">COMMAND</arg>
            </cmdsynopsis>
    </refsynopsisdiv>

    <refsect1>
        <title>Description</title>

        <para>
            <command>flatpak-builder</command> is a wrapper around the <command>flatpak build</command> command
            that automates the building of applications and their dependencies. It is one option you can use
            to build applications.
        </para>
        <para>
            The goal of <command>flatpak-builder</command> is to push as much knowledge about how to build modules to
            the individual upstream projects. It does this by assuming that the modules adhere to the Build API specified
            at https://github.com/cgwalters/build-api. This essentially  means that it follows the <command>./configure
            &amp;&amp; make &amp;&amp; make install</command> scheme with an optional autogen script. If the upstream
            does not adhere to the API you can make it do so by adding patches and extra files.
        </para>
        <para>
            An invocation of <command>flatpak-builder</command> proceeds in these stages, each being specified
            in detail in json format in <arg choice="plain">MANIFEST</arg>:
            <itemizedlist mark='bullet'>
                <listitem>
                    <para>Download all sources</para>
                </listitem>
                <listitem>
                    <para>Initialize the application directory with <command>flatpak build-init</command></para>
                </listitem>
                <listitem>
                    <para>Build and install each module with <command>flatpak build</command></para>
                </listitem>
                <listitem>
                    <para>Clean up the final build tree by removing unwanted files and e.g. stripping binaries</para>
                </listitem>
                <listitem>
                    <para>Finish the application directory with <command>flatpak build-finish</command></para>
                </listitem>
            </itemizedlist>

            After this you will end up with a build of the application in <arg choice="plain">DIRECTORY</arg>, which you can
            export to a repository with the <command>flatpak build-export</command> command.
        </para>
        <para>
            At each of the above steps flatpak caches the result, and if you build the same file again, it will start
            of at the first step where something changes. For instance the first version controlled source that had
            new commits added, or the first module where some changes to the <arg choice="plain">MANIFEST</arg> file caused
            the build environment to change. This makes flatpak-builder very efficient for incremental builds.
        </para>
    </refsect1>

    <refsect1>
        <title>Manifest format</title>
        <refsect2>
            <title>Toplevel</title>
            <para>
                The top level of the json file describes global
                attributes of the application, and how it can be
                build, and the list of modules that need to be
                built.
            </para>
            <para>
                These are the properties that are accepted:
            </para>
            <variablelist>
                <varlistentry>
                    <term><option>id</option> (string)</term>
                    <listitem><para>A string defining the application id.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>branch</option> (string)</term>
                    <listitem><para>The branch of the application, defaults to master.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>runtime</option> (string)</term>
                    <listitem><para>The name of the runtime that the application uses.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>runtime-version</option> (string)</term>
                    <listitem><para>The version of the runtime that the application uses, defaults to master.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>sdk</option> (string)</term>
                    <listitem><para>The name of the development runtime that the application builds with.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>metadata</option> (string)</term>
                    <listitem><para>Use this file as the base metadata file when finishing.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>command</option> (string)</term>
                    <listitem><para>The filename or path to the main binary of the application.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>build-runtime</option> (boolean)</term>
                    <listitem><para>Build a new runtime instead of an application.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>separate-locales</option> (boolean)</term>
                    <listitem><para>Separate out locale files and translations to an extension runtime. Defaults to true.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>id-platform</option> (string)</term>
                    <listitem><para>When building a runtime sdk, also create a platform based on it with this id.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>metadata-platform</option> (string)</term>
                    <listitem><para>The metadata file to use for the platform we create.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>writable-sdk</option> (boolean)</term>
                    <listitem><para>If true, use a writable copy of the sdk for /usr.
                    Defaults to true if --build-runtime is specified.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>appstream-compose</option> (boolean)</term>
                    <listitem><para>Run appstream-compose during cleanup phase. Defaults to true.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>sdk-extensions</option> (array of strings)</term>
                    <listitem><para>Install these extra sdk extensions in /usr.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>platform-extensions</option> (array of strings)</term>
                    <listitem><para>Install these extra sdk extensions when creating the platform.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>tags</option> (array of strings)</term>
                    <listitem><para>Add these tags to the metadata file.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>build-options</option> (object)</term>
                    <listitem><para>Object specifying the build environment. See below for details.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>modules</option> (array of objects)</term>
                    <listitem><para>An array of object specifying the modules to be built in order.
                    See below for details.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cleanup</option> (array of strings)</term>
                    <listitem><para>An array of file patterns that should be removed at the end.
                    Patterns starting with / are taken to be full pathnames (without the /app prefix), otherwise they just match
                    the basename.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cleanup-commands</option> (array of strings)</term>
                    <listitem><para>An array of commandlines that are run during the cleanup phase.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cleanup-platform</option> (array of strings)</term>
                    <listitem><para>Extra files to clean up in the platform.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>finish-args</option> (array of strings)</term>
                    <listitem><para>An array of arguments passed to the <command>flatpak build-finish</command> command.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>rename-desktop-file</option> (string)</term>
                    <listitem><para>Any desktop file with this name will be renamed to a name based on id during the cleanup phase.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>rename-appdata-file</option> (string)</term>
                    <listitem><para>Any appdata file with this name will be renamed to a name based on id during the cleanup phase.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>rename-icon</option> (string)</term>
                    <listitem><para>Any icon with this name will be renamed to a name based on id during the cleanup phase.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>copy-icon</option> (boolean)</term>
                    <listitem><para>If rename-icon is set, keep a copy of the old icon file.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>desktop-file-name-prefix</option> (string)</term>
                    <listitem><para>This string will be prefixed to the Name key in the main application desktop file.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>desktop-file-name-suffixed</option> (string)</term>
                    <listitem><para>This string will be suffixed to the Name key in the main application desktop file.</para></listitem>
                </varlistentry>
            </variablelist>

        </refsect2>
        <refsect2>
            <title>Build Options</title>
            <para>
                Build options specify the build environment of a module, and can be specified globally as
                well as per-module. Options can also be specified on a per-architecture basis using the arch property.
            </para>
            <para>
                These are the properties that are accepted:
            </para>
            <variablelist>
                <varlistentry>
                    <term><option>cflags</option> (string)</term>
                    <listitem><para>This is set in the environment variable CFLAGS during the build.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cxxflags</option> (string)</term>
                    <listitem><para>This is set in the environment variable CXXFLAGS during the build.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>prefix</option> (string)</term>
                    <listitem><para>The build prefix for the modules (defaults to <filename>/app</filename> for
                    applications and <filename>/usr</filename> for runtimes).</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>env</option> (object)</term>
                    <listitem><para>This is a dictionary defining environment variables to be set during the build.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>build-args</option> (array of strings)</term>
                    <listitem><para>This is an array containing extra options to pass to flatpak build.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>strip</option> (boolean)</term>
                    <listitem><para>If this is true (the default is false) then all ELF files will be stripped after install.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>no-debuginfo</option> (boolean)</term>
                    <listitem><para>If this is true (the default is false) and strip is not set then all ELF files will have their debug info extracted to a separate file.</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>arch</option> (object)</term>
                    <listitem><para>This is a dictionary defining for each arch a separate build options object that override the main one.</para></listitem>
                </varlistentry>
            </variablelist>
        </refsect2>
        <refsect2>
            <title>Module</title>
            <para>
                Each module specifies a source that has to be separately built and installed. It contains
                the build options and a list of sources to download and extract before building.
            </para>
            <para>
                These are the properties that are accepted:
            </para>
            <variablelist>
                <varlistentry>
                    <term><option>name</option> (string)</term>
                    <listitem><para>The name of the module, used in e.g. build logs</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>disabled</option> (boolean)</term>
                    <listitem><para>If true, skip this module</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>sources</option> (array of objects)</term>
                    <listitem><para>An array of objects defining sources that will be downloaded and extracted in order</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>config-opts</option> (array of strings)</term>
                    <listitem><para>An array of options that will be passed to configure</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>make-args</option> (array of strings)</term>
                    <listitem><para>An array of arguments that will be passed to make</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>make-install-args</option> (array of strings)</term>
                    <listitem><para>An array of arguments that will be passed to make install</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>rm-configure</option> (boolean)</term>
                    <listitem><para>If true, remove the configure script before starting build</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>no-autogen</option> (boolean)</term>
                    <listitem><para>Ignore the existence of an autogen script</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>no-parallel-make</option> (boolean)</term>
                    <listitem><para>Don't call make with arguments to build in parallel</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cmake</option> (boolean)</term>
                    <listitem><para>Use cmake instead of configure</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>builddir</option> (string)</term>
                    <listitem><para>Use a build directory that is separate from the source directory</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>subdir</option> (string)</term>
                    <listitem><para>Build inside this subdirectory of the extracted sources</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>build-options</option> (object)</term>
                    <listitem><para>A build options object that can override global options</para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>post-install</option> (array of strings)</term>
                    <listitem><para>An array of shell command that are run after the install phase. Can for example
                    clean up the install dir, or install extra files.
                    </para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cleanup</option> (array of strings)</term>
                    <listitem><para>An array of file patterns that should be removed at the end.
                    Patterns starting with / are taken to be full pathnames (without the /app prefix), otherwise they just match
                    the basename. Note that any patterns will only match files installed by this module.
                    </para></listitem>
                </varlistentry>
                <varlistentry>
                    <term><option>cleanup-platform</option> (array of strings)</term>
                    <listitem><para>Extra files to clean up in the platform.</para></listitem>
                </varlistentry>
            </variablelist>
        </refsect2>
        <refsect2>
            <title>Sources</title>
            <para>
                These contain a pointer to the source that will be extracted into the source directory before
                the build starts. They can be of several types, distiguished by the type property.
            </para>
            <refsect3>
                <title>Archive sources (tar, zip)</title>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"archive"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>path</option> (string)</term>
                        <listitem><para>The path of the archive</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>url</option> (string)</term>
                        <listitem><para>The url of a remote archive that will be downloaded. This overrides path if both are specified.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>sha256</option> (string)</term>
                        <listitem><para>The sha256 checksum of the file, verified after download</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>strip-components</option> (integer)</term>
                        <listitem><para>The number of initial pathname components to strip during extraction. Defaults to 1.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the archive will be extracted.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>Git sources</title>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"git"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>url</option> (string)</term>
                        <listitem><para>URL of the git repostiory</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>branch</option> (string)</term>
                        <listitem><para>The branch/tag/commit to use from the git repostiory</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the repository will be checked out.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>Bzr sources</title>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"bzr"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>url</option> (string)</term>
                        <listitem><para>URL of the bzr repostiory</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>revision</option> (string)</term>
                        <listitem><para>A specific revision to use in the branch</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the repository will be checked out.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>File sources</title>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"file"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>path</option> (string)</term>
                        <listitem><para>The path of a local file that will be copied into the source dir</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>url</option> (string)</term>
                        <listitem><para>The url of a remote file that will be downloaded and copied into the source dir. This overrides path if both are specified.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>sha256</option> (string)</term>
                        <listitem><para>The sha256 checksum of the file, verified after download. This is optional for local files.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest-filename</option> (string)</term>
                        <listitem><para>Filename to use inside the source dir, default to the basename of path.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the file will be copied.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>Script sources</title>
                <para>
                    This is a way to create a shell (/bin/sh) script from an inline set of commands.
                </para>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"script"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>commands</option> (array of strings)</term>
                        <listitem><para>An array of shell commands that will be put in a shellscript file</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest-filename</option> (string)</term>
                        <listitem><para>Filename to use inside the source dir, default to the basename of path.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the file will be copied.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>Shell sources</title>
                <para>
                    This is a to create/modify the sources by running shell commands.
                </para>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"shell"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>commands</option> (array of strings)</term>
                        <listitem><para>An array of shell commands that will be run during source extraction</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
            <refsect3>
                <title>Patch sources</title>
                <variablelist>
                    <varlistentry>
                        <term><option>type</option></term>
                        <listitem><para>"patch"</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>path</option> (string)</term>
                        <listitem><para>The path of a patch file that will be applied in the source dir</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>strip-components</option> (integer)</term>
                        <listitem><para>The value of the -p argument to patch, defaults to 1.</para></listitem>
                    </varlistentry>
                    <varlistentry>
                        <term><option>dest</option> (string)</term>
                        <listitem><para>Directory inside the source dir where the patch will be applied.</para></listitem>
                    </varlistentry>
                </variablelist>
            </refsect3>
        </refsect2>
    </refsect1>

    <refsect1>
        <title>Options</title>

        <para>The following options are understood:</para>

        <variablelist>
            <varlistentry>
                <term><option>-h</option></term>
                <term><option>--help</option></term>

                <listitem><para>
                    Show help options and exit.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>-v</option></term>
                <term><option>--verbose</option></term>

                <listitem><para>
                    Print debug information during command processing.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--version</option></term>

                <listitem><para>
                    Print version information and exit.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--arch=ARCH</option></term>

                <listitem><para>
                    Specify the machine architecture to build for. If no architecture is specified, the host architecture will be automatically detected. Only host compatible architectures can be specified.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--disable-cache</option></term>

                <listitem><para>
                    Don't look at the existing cache for a previous build, instead always rebuild modules.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--disable-download</option></term>

                <listitem><para>
                     Don't download any sources. This only works if some version of all sources are downloaded
                     already. This is useful if you want to guarantee that no network i/o is done. However, the
                     build will fail if some source is not locally available.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--disable-updates</option></term>

                <listitem><para>
                  Download missing sources, but don't update local mirrors of version control repos. This is useful
                  to rebuild things but without updating git or bzr repositories from the remote repository.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--run</option></term>

                <listitem><para>
                  Run a command in a sandbox based on the build dir. This starts flatpak build, with some extra
                  arguments to give the same environment as the build, and the same permissions the final app
                  will have. The command to run must be the last argument passed to
                  flatpak-builder, after the directory and the manifest.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--download-only</option></term>

                <listitem><para>
                     Exit successfully after downloading the required sources.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--build-only</option></term>

                <listitem><para>
                     Don't do the cleanup and finish stages, which is useful if you
                     want to build more things into the app.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--require-changes</option></term>

                <listitem><para>
                    Do nothing, leaving a non-existent <arg choice="plain">DIRECTORY</arg> if nothing changes since
                    last cached build. If this is not specified, the latest version from the cache will be put
                    into <arg choice="plain">DIRECTORY</arg>.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--keep-build-dirs</option></term>

                <listitem><para>
                    Don't remove the sources and build after having built and installed each module.
                    This also creates a symlink to the build directory with a stable name ("build-modulename").
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--ccache</option></term>

                <listitem><para>
                     Enable use of ccache in the build (needs ccache in the sdk)
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--repo=DIR</option></term>

                <listitem><para>
                    When build is done, run export the result to this repository.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>-s</option></term>
                <term><option>--subject=SUBJECT</option></term>

                <listitem><para>
                    One line subject for the commit message.
                    Used when exporting the build results.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>-b</option></term>
                <term><option>--body=BODY</option></term>

                <listitem><para>
                    Full description for the commit message.
                    Used when exporting the build results.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--gpg-sign=KEYID</option></term>

                <listitem><para>
                    Sign the commit with this GPG key.
                    Used when exporting the build results.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--gpg-homedir=PATH</option></term>

                <listitem><para>
                    GPG Homedir to use when looking for keyrings.
                    Used when exporting the build results.
                </para></listitem>
            </varlistentry>

            <varlistentry>
                <term><option>--force-clean</option></term>

                <listitem><para>
                    Erase the previous contents of DIRECTORY if it is
                    not empty.
                </para></listitem>
            </varlistentry>

          </variablelist>
    </refsect1>

    <refsect1>
        <title>Caching</title>

        <para>
            flatpak-builder caches sources and partial build results in
            the .flatpak-builder subdirectory of the current directory. If you
            use <option>--keep-build-dirs</option>, build directories for each
            module are also stored here.
        </para>

        <para>
            It is safe to remove the contents of the .flatpak-builder
            directory. This will force a full build the next time you build.
        </para>

    </refsect1>

    <refsect1>
        <title>Examples</title>

        <para>
            <command>$ flatpak-builder my-app-dir manifest.json</command>
        </para>

        <para>
            Example manifest file:
        </para>
<programlisting>
{
    "id": "org.test.TestApp",
    "runtime": "org.freedesktop.Platform",
    "runtime-version": "1.2",
    "sdk": "org.freedesktop.Sdk",
    "command": "test",
    "clean": [ "/include", "*.la" ],
    "build-options" : {
        "cflags": "-O2 -g",
        "cxxflags": "-O2 -g",
        "env": {
            "V": "1"
        },
        "arch": {
            "x86_64": {
                "cflags": "-O3 -g",
            }
        }
    },
    "modules": [
        {
            "name": "pygobject",
            "config-opts": [ "--disable-introspection" ],
            "sources": [
                {
                    "type": "archive",
                    "url": "http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.6.tar.xz",
                    "sha256": "fb8a1d4f665130a125011659bd347c7339c944232163dbb9a34fd0686577adb8"
                },
                {
                    "type": "patch",
                    "path": "required-pygobject-fix.patch"
                },
                {
                    "type": "file",
                    "path": "pygobject-extra-file",
                    "dest-filename": "extra-file"
                }
            ]
        },
        {
            "name": "babl",
            "build-options" : { "cxxflags": "-O2 -g -std=c++11" },
            "cleanup": [ "/bin" ],
            "sources": [
                {
                    "type": "git",
                    "url": "git://git.gnome.org/babl"
                }
            ]
        },
        {
            "name": "testapp",
            "sources": [
                {
                    "type": "bzr",
                    "url": "lp:testapp"
                }
            ]
        }
    ]
}
</programlisting>

    </refsect1>

    <refsect1>
        <title>See also</title>

        <para>
            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
            <citerefentry><refentrytitle>flatpak-build-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>
        </para>

    </refsect1>

</refentry>