'\" t .\" Title: flatpak-builder .\" Author: Alexander Larsson .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 03/26/2019 .\" Manual: flatpak builder .\" Source: flatpak .\" Language: English .\" .TH "FLATPAK\-BUILDER" "1" "" "flatpak" "flatpak builder" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" flatpak-builder \- Help build application dependencies .SH "SYNOPSIS" .HP \w'\fBflatpak\-builder\fR\ 'u \fBflatpak\-builder\fR [OPTION...] DIRECTORY MANIFEST .HP \w'\fBflatpak\-builder\fR\ 'u \fBflatpak\-builder\fR \-\-run [OPTION...] DIRECTORY MANIFEST COMMAND .HP \w'\fBflatpak\-builder\fR\ 'u \fBflatpak\-builder\fR \-\-show\-deps [OPTION...] MANIFEST .SH "DESCRIPTION" .PP \fBflatpak\-builder\fR is a wrapper around the \fBflatpak build\fR command that automates the building of applications and their dependencies\&. It is one option you can use to build applications\&. .PP The goal of \fBflatpak\-builder\fR 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 \fB\&./configure && make && make install\fR 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\&. .PP An invocation of \fBflatpak\-builder\fR proceeds in these stages, each being specified in detail in json format in MANIFEST: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Download all sources .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Initialize the application directory with \fBflatpak build\-init\fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Build and install each module with \fBflatpak build\fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Clean up the final build tree by removing unwanted files and e\&.g\&. stripping binaries .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Finish the application directory with \fBflatpak build\-finish\fR .RE .sp After this you will end up with a build of the application in DIRECTORY, which you can export to a repository with the \fBflatpak build\-export\fR command\&. If you use the \fB\-\-repo\fR option, flatpack\-builder will do the export for you at the end of the build process\&. When flatpak\-builder does the export, it also stores the manifest that was used for the build in /app/manifest\&.json\&. The manifest is \*(Aqresolved\*(Aq, i\&.e\&. git branch names are replaced by the actual commit IDs that were used in the build\&. .PP At each of the above steps flatpak caches the result, and if you build the same file again, it will start 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 MANIFEST file caused the build environment to change\&. This makes flatpak\-builder very efficient for incremental builds\&. .SH "MANIFEST FORMAT" .SS "Toplevel" .PP The top level of the json file describes global attributes of the application, how it can be built, and the list of modules that need to be built\&. .PP These are the properties that are accepted: .PP \fBid\fR or \fBapp\-id\fR (string) .RS 4 A string defining the application id\&. .RE .PP \fBbranch\fR (string) .RS 4 The branch of the application, defaults to master\&. .RE .PP \fBruntime\fR (string) .RS 4 The name of the runtime that the application uses\&. .RE .PP \fBruntime\-version\fR (string) .RS 4 The version of the runtime that the application uses, defaults to master\&. .RE .PP \fBsdk\fR (string) .RS 4 The name of the development runtime that the application builds with\&. .RE .PP \fBvar\fR (string) .RS 4 Initialize the (otherwise empty) writable /var in the build with a copy of this runtime\&. .RE .PP \fBmetadata\fR (string) .RS 4 Use this file as the base metadata file when finishing\&. .RE .PP \fBcommand\fR (string) .RS 4 The filename or path to the main binary of the application\&. Note that this is really just a single file, not a commandline\&. If you want to pass arguments, install a shell script wrapper and use that as the command\&. .RE .PP \fBbuild\-runtime\fR (boolean) .RS 4 Build a new runtime instead of an application\&. .RE .PP \fBseparate\-locales\fR (boolean) .RS 4 Separate out locale files and translations to an extension runtime\&. Defaults to true\&. .RE .PP \fBid\-platform\fR (string) .RS 4 When building a runtime sdk, also create a platform based on it with this id\&. .RE .PP \fBmetadata\-platform\fR (string) .RS 4 The metadata file to use for the platform we create\&. .RE .PP \fBwritable\-sdk\fR (boolean) .RS 4 If true, use a writable copy of the sdk for /usr\&. Defaults to true if \-\-build\-runtime is specified\&. .RE .PP \fBappstream\-compose\fR (boolean) .RS 4 Run appstream\-compose during cleanup phase\&. Defaults to true\&. .RE .PP \fBsdk\-extensions\fR (array of strings) .RS 4 Install these extra sdk extensions in /usr\&. .RE .PP \fBplatform\-extensions\fR (array of strings) .RS 4 Install these extra sdk extensions when creating the platform\&. .RE .PP \fBbase\fR (string) .RS 4 Start with the files from the specified application\&. This can be used to create applications that extend another application\&. .RE .PP \fBbase\-version\fR (string) .RS 4 Use this specific version of the application specified in base\&. If unspecified, this uses the value specified in branch .RE .PP \fBbase\-extensions\fR (array of strings) .RS 4 Install these extra extensions from the base application when initializing the application directory\&. .RE .PP \fBtags\fR (array of strings) .RS 4 Add these tags to the metadata file\&. .RE .PP \fBbuild\-options\fR (object) .RS 4 Object specifying the build environment\&. See below for details\&. .RE .PP \fBmodules\fR (array of objects or string) .RS 4 An array of objects specifying the modules to be built in order\&. String members in the array are interpreted as the name of a separate json file that contains a module\&. See below for details\&. .RE .PP \fBcleanup\fR (array of strings) .RS 4 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\&. .RE .PP \fBcleanup\-commands\fR (array of strings) .RS 4 An array of commandlines that are run during the cleanup phase\&. .RE .PP \fBcleanup\-platform\fR (array of strings) .RS 4 Extra files to clean up in the platform\&. .RE .PP \fBfinish\-args\fR (array of strings) .RS 4 An array of arguments passed to the \fBflatpak build\-finish\fR command\&. .RE .PP \fBrename\-desktop\-file\fR (string) .RS 4 Any desktop file with this name will be renamed to a name based on id during the cleanup phase\&. .RE .PP \fBrename\-appdata\-file\fR (string) .RS 4 Any appdata file with this name will be renamed to a name based on id during the cleanup phase\&. .RE .PP \fBrename\-icon\fR (string) .RS 4 Any icon with this name will be renamed to a name based on id during the cleanup phase\&. .RE .PP \fBcopy\-icon\fR (boolean) .RS 4 If rename\-icon is set, keep a copy of the old icon file\&. .RE .PP \fBdesktop\-file\-name\-prefix\fR (string) .RS 4 This string will be prefixed to the Name key in the main application desktop file\&. .RE .PP \fBdesktop\-file\-name\-suffix\fR (string) .RS 4 This string will be suffixed to the Name key in the main application desktop file\&. .RE .SS "Build Options" .PP 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\&. .PP These are the properties that are accepted: .PP \fBcflags\fR (string) .RS 4 This is set in the environment variable CFLAGS during the build\&. .RE .PP \fBcxxflags\fR (string) .RS 4 This is set in the environment variable CXXFLAGS during the build\&. .RE .PP \fBprefix\fR (string) .RS 4 The build prefix for the modules (defaults to /app for applications and /usr for runtimes)\&. .RE .PP \fBenv\fR (object) .RS 4 This is a dictionary defining environment variables to be set during the build\&. .RE .PP \fBbuild\-args\fR (array of strings) .RS 4 This is an array containing extra options to pass to flatpak build\&. .RE .PP \fBconfig\-opts\fR (array of strings) .RS 4 This is an array containing extra options to pass to configure\&. .RE .PP \fBstrip\fR (boolean) .RS 4 If this is true (the default is false) then all ELF files will be stripped after install\&. .RE .PP \fBno\-debuginfo\fR (boolean) .RS 4 By default (if strip is not true) flatpak\-builder extracts all debug info in ELF files to a separate files and puts this in an extension\&. If you want to disable this, set no\-debuginfo to true\&. .RE .PP \fBarch\fR (object) .RS 4 This is a dictionary defining for each arch a separate build options object that override the main one\&. .RE .SS "Module" .PP 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\&. .PP Modules can be nested, in order to turn related modules on and off with a single key\&. .PP These are the properties that are accepted: .PP \fBname\fR (string) .RS 4 The name of the module, used in e\&.g\&. build logs\&. The name is also used for constructing filenames and commandline arguments, therefore using spaces or \*(Aq/\*(Aq in this string is a bad idea\&. .RE .PP \fBdisabled\fR (boolean) .RS 4 If true, skip this module .RE .PP \fBsources\fR (array of objects) .RS 4 An array of objects defining sources that will be downloaded and extracted in order .RE .PP \fBconfig\-opts\fR (array of strings) .RS 4 An array of options that will be passed to configure .RE .PP \fBmake\-args\fR (array of strings) .RS 4 An array of arguments that will be passed to make .RE .PP \fBmake\-install\-args\fR (array of strings) .RS 4 An array of arguments that will be passed to make install .RE .PP \fBrm\-configure\fR (boolean) .RS 4 If true, remove the configure script before starting build .RE .PP \fBno\-autogen\fR (boolean) .RS 4 Ignore the existence of an autogen script .RE .PP \fBno\-parallel\-make\fR (boolean) .RS 4 Don\*(Aqt call make with arguments to build in parallel .RE .PP \fBno\-python\-timestamp\-fix\fR (boolean) .RS 4 Don\*(Aqt fix up the *\&.py[oc] header timestamps for ostree use\&. .RE .PP \fBcmake\fR (boolean) .RS 4 Use cmake instead of configure (deprecated: use buildsystem instead) .RE .PP \fBbuildsystem\fR (string) .RS 4 Build system to use: autotools, cmake, meson .RE .PP \fBbuilddir\fR (boolean) .RS 4 Use a build directory that is separate from the source directory .RE .PP \fBsubdir\fR (string) .RS 4 Build inside this subdirectory of the extracted sources .RE .PP \fBbuild\-options\fR (object) .RS 4 A build options object that can override global options .RE .PP \fBpost\-install\fR (array of strings) .RS 4 An array of shell commands that are run after the install phase\&. Can for example clean up the install dir, or install extra files\&. .RE .PP \fBcleanup\fR (array of strings) .RS 4 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\&. .RE .PP \fBcleanup\-platform\fR (array of strings) .RS 4 Extra files to clean up in the platform\&. .RE .PP \fBmodules\fR (array of objects or strings) .RS 4 An array of objects specifying nested modules to be built before this one\&. String members in the array are interpreted as names of a separate json file that contains a module\&. .RE .SS "Sources" .PP 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, distinguished by the type property\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBArchive sources (tar, zip)\fR .RS 4 .PP \fBtype\fR .RS 4 "archive" .RE .PP \fBpath\fR (string) .RS 4 The path of the archive .RE .PP \fBurl\fR (string) .RS 4 The URL of a remote archive that will be downloaded\&. This overrides path if both are specified\&. .RE .PP \fBsha256\fR (string) .RS 4 The sha256 checksum of the file, verified after download .RE .PP \fBstrip\-components\fR (integer) .RS 4 The number of initial pathname components to strip during extraction\&. Defaults to 1\&. .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the archive will be extracted\&. .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBGit sources\fR .RS 4 .PP \fBtype\fR .RS 4 "git" .RE .PP \fBpath\fR (string) .RS 4 The path to a local checkout of the git repository\&. Due to how git\-clone works, this will be much faster than specifying a URL of file:///\&.\&.\&. .RE .PP \fBurl\fR (string) .RS 4 URL of the git repository\&. This overrides path if both are specified\&. .RE .PP \fBbranch\fR (string) .RS 4 The branch/tag/commit to use from the git repository .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the repository will be checked out\&. .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBBzr sources\fR .RS 4 .PP \fBtype\fR .RS 4 "bzr" .RE .PP \fBurl\fR (string) .RS 4 URL of the bzr repository .RE .PP \fBrevision\fR (string) .RS 4 A specific revision to use in the branch .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the repository will be checked out\&. .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBFile sources\fR .RS 4 .PP \fBtype\fR .RS 4 "file" .RE .PP \fBpath\fR (string) .RS 4 The path of a local file that will be copied into the source dir .RE .PP \fBurl\fR (string) .RS 4 The URL of a remote file that will be downloaded and copied into the source dir\&. This overrides path if both are specified\&. .RE .PP \fBsha256\fR (string) .RS 4 The sha256 checksum of the file, verified after download\&. This is optional for local files\&. .RE .PP \fBdest\-filename\fR (string) .RS 4 Filename to use inside the source dir, default to the basename of path\&. .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the file will be copied\&. .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBScript sources\fR .RS 4 .PP This is a way to create a shell (/bin/sh) script from an inline set of commands\&. .PP \fBtype\fR .RS 4 "script" .RE .PP \fBcommands\fR (array of strings) .RS 4 An array of shell commands that will be put in a shellscript file .RE .PP \fBdest\-filename\fR (string) .RS 4 Filename to use inside the source dir, default to the basename of path\&. .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the file will be copied\&. .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBShell sources\fR .RS 4 .PP This is a way to create/modify the sources by running shell commands\&. .PP \fBtype\fR .RS 4 "shell" .RE .PP \fBcommands\fR (array of strings) .RS 4 An array of shell commands that will be run during source extraction .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBPatch sources\fR .RS 4 .PP \fBtype\fR .RS 4 "patch" .RE .PP \fBpath\fR (string) .RS 4 The path of a patch file that will be applied in the source dir .RE .PP \fBstrip\-components\fR (integer) .RS 4 The value of the \-p argument to patch, defaults to 1\&. .RE .PP \fBdest\fR (string) .RS 4 Directory inside the source dir where the patch will be applied\&. .RE .PP \fBuse\-git\fR (boolean) .RS 4 Whether to use "git apply" rather than "patch" to apply the patch, required when the patch file contains binary diffs\&. .RE .PP \fBoptions\fR (array of strings) .RS 4 Extra options to pass to the patch command\&. .RE .RE .SH "OPTIONS" .PP The following options are understood: .PP \fB\-h\fR, \fB\-\-help\fR .RS 4 Show help options and exit\&. .RE .PP \fB\-v\fR, \fB\-\-verbose\fR .RS 4 Print debug information during command processing\&. .RE .PP \fB\-\-version\fR .RS 4 Print version information and exit\&. .RE .PP \fB\-\-arch=ARCH\fR .RS 4 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\&. .RE .PP \fB\-\-disable\-cache\fR .RS 4 Don\*(Aqt look at the existing cache for a previous build, instead always rebuild modules\&. .RE .PP \fB\-\-disable\-download\fR .RS 4 Don\*(Aqt 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\&. .RE .PP \fB\-\-disable\-updates\fR .RS 4 Download missing sources, but don\*(Aqt update local mirrors of version control repos\&. This is useful to rebuild things but without updating git or bzr repositories from the remote repository\&. .RE .PP \fB\-\-run\fR .RS 4 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\&. .RE .PP \fB\-\-show\-deps\fR .RS 4 List all the (local) files that the manifest depends on\&. .RE .PP \fB\-\-download\-only\fR .RS 4 Exit successfully after downloading the required sources\&. .RE .PP \fB\-\-build\-only\fR .RS 4 Don\*(Aqt do the cleanup and finish stages, which is useful if you want to build more things into the app\&. .RE .PP \fB\-\-finish\-only\fR .RS 4 Only do the cleanup, finish and export stages, picking up where a \-\-build\-only command left off\&. .RE .PP \fB\-\-require\-changes\fR .RS 4 Do nothing, leaving a non\-existent DIRECTORY if nothing changes since last cached build\&. If this is not specified, the latest version from the cache will be put into DIRECTORY\&. .RE .PP \fB\-\-keep\-build\-dirs\fR .RS 4 Don\*(Aqt 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")\&. .RE .PP \fB\-\-ccache\fR .RS 4 Enable use of ccache in the build (needs ccache in the sdk) .RE .PP \fB\-\-stop\-at=MODULENAME\fR .RS 4 Stop at the specified module, ignoring it and all the following ones in both the "download" and "build" phases\&. This is useful for debugging and development\&. For instance, you can build all the dependencies, but stop at the main application so that you can then do a build from a pre\-existing checkout\&. Implies \-\-build\-only\&. .RE .PP \fB\-\-repo=DIR\fR .RS 4 When build is done, run export the result to this repository\&. .RE .PP \fB\-s\fR, \fB\-\-subject=SUBJECT\fR .RS 4 One line subject for the commit message\&. Used when exporting the build results\&. .RE .PP \fB\-b\fR, \fB\-\-body=BODY\fR .RS 4 Full description for the commit message\&. Used when exporting the build results\&. .RE .PP \fB\-\-gpg\-sign=KEYID\fR .RS 4 Sign the commit with this GPG key\&. Used when exporting the build results\&. This option can be used multiple times\&. .RE .PP \fB\-\-gpg\-homedir=PATH\fR .RS 4 GPG Homedir to use when looking for keyrings\&. Used when exporting the build results\&. .RE .PP \fB\-\-jobs=JOBS\fR .RS 4 Limit the number of parallel jobs during the build\&. The default is the number of CPUs on the machine\&. .RE .PP \fB\-\-force\-clean\fR .RS 4 Erase the previous contents of DIRECTORY if it is not empty\&. .RE .PP \fB\-\-sandbox\fR .RS 4 Disable the possibility to specify build\-args that are passed to flatpak build\&. This means the build process can\*(Aqt break out of its sandbox, and is useful when building less trusted software\&. .RE .PP \fB\-\-allow\-missing\-runtimes\fR .RS 4 Do not immediately fail if the sdk or platform runtimes are not installed on this system\&. Attempting to build any manifest modules will still fail if the sdk is missing, but may be useful for apps that install files without a sandbox build\&. .RE .SH "CACHING" .PP flatpak\-builder caches sources and partial build results in the \&.flatpak\-builder subdirectory of the current directory\&. If you use \fB\-\-keep\-build\-dirs\fR, build directories for each module are also stored here\&. .PP It is safe to remove the contents of the \&.flatpak\-builder directory\&. This will force a full build the next time you build\&. .SH "EXAMPLES" .PP \fB$ flatpak\-builder my\-app\-dir manifest\&.json\fR .PP Example manifest file: .sp .if n \{\ .RS 4 .\} .nf { "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" } ] } ] } .fi .if n \{\ .RE .\} .SH "SEE ALSO" .PP \fBflatpak\fR(1), \fBflatpak-build-init\fR(1), \fBflatpak-build\fR(1), \fBflatpak-build-finish\fR(1), \fBflatpak-build-export\fR(1)