table of contents
other versions
- jessie-backports 0.8.9-0+deb9u1~bpo8+1
- stretch 0.8.9-0+deb9u1
- testing 1.0.4-1
- stretch-backports 1.0.3-1~bpo9+1
- unstable 1.0.5-1
FLATPAK-BUILDER(1) | flatpak builder | FLATPAK-BUILDER(1) |
NAME¶
flatpak-builder - Help build application dependenciesSYNOPSIS¶
flatpak-builder [OPTION...] DIRECTORY MANIFEST
flatpak-builder --run [OPTION...] DIRECTORY MANIFEST
COMMAND
flatpak-builder --show-deps [OPTION...] MANIFEST
DESCRIPTION¶
flatpak-builder is a wrapper around the flatpak build command that automates the building of applications and their dependencies. It is one option you can use to build applications. The goal of flatpak-builder 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 ./configure && make && make install 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. An invocation of flatpak-builder proceeds in these stages, each being specified in detail in json format in MANIFEST:•Download all sources
•Initialize the application directory with
flatpak build-init
•Build and install each module with flatpak
build
•Clean up the final build tree by removing
unwanted files and e.g. stripping binaries
•Finish the application directory with flatpak
build-finish
After this you will end up with a build of the application in DIRECTORY, which
you can export to a repository with the flatpak build-export command.
If you use the --repo 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 'resolved', i.e. git branch names are replaced by the actual
commit IDs that were used in the build.
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.
MANIFEST FORMAT¶
Toplevel¶
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. These are the properties that are accepted: id or app-id (string)A string defining the application id.
branch (string)
The branch of the application, defaults to master.
runtime (string)
The name of the runtime that the application uses.
runtime-version (string)
The version of the runtime that the application uses,
defaults to master.
sdk (string)
The name of the development runtime that the application
builds with.
var (string)
Initialize the (otherwise empty) writable /var in the
build with a copy of this runtime.
metadata (string)
Use this file as the base metadata file when
finishing.
command (string)
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.
build-runtime (boolean)
Build a new runtime instead of an application.
separate-locales (boolean)
Separate out locale files and translations to an
extension runtime. Defaults to true.
id-platform (string)
When building a runtime sdk, also create a platform based
on it with this id.
metadata-platform (string)
The metadata file to use for the platform we
create.
writable-sdk (boolean)
If true, use a writable copy of the sdk for /usr.
Defaults to true if --build-runtime is specified.
appstream-compose (boolean)
Run appstream-compose during cleanup phase. Defaults to
true.
sdk-extensions (array of strings)
Install these extra sdk extensions in /usr.
platform-extensions (array of strings)
Install these extra sdk extensions when creating the
platform.
base (string)
Start with the files from the specified application. This
can be used to create applications that extend another application.
base-version (string)
Use this specific version of the application specified in
base. If unspecified, this uses the value specified in branch
base-extensions (array of strings)
Install these extra extensions from the base application
when initializing the application directory.
tags (array of strings)
Add these tags to the metadata file.
build-options (object)
Object specifying the build environment. See below for
details.
modules (array of objects or string)
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.
cleanup (array of strings)
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.
cleanup-commands (array of strings)
An array of commandlines that are run during the cleanup
phase.
cleanup-platform (array of strings)
Extra files to clean up in the platform.
finish-args (array of strings)
An array of arguments passed to the flatpak
build-finish command.
rename-desktop-file (string)
Any desktop file with this name will be renamed to a name
based on id during the cleanup phase.
rename-appdata-file (string)
Any appdata file with this name will be renamed to a name
based on id during the cleanup phase.
rename-icon (string)
Any icon with this name will be renamed to a name based
on id during the cleanup phase.
copy-icon (boolean)
If rename-icon is set, keep a copy of the old icon
file.
desktop-file-name-prefix (string)
This string will be prefixed to the Name key in the main
application desktop file.
desktop-file-name-suffix (string)
This string will be suffixed to the Name key in the main
application desktop file.
Build Options¶
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. These are the properties that are accepted: cflags (string)This is set in the environment variable CFLAGS during the
build.
cxxflags (string)
This is set in the environment variable CXXFLAGS during
the build.
prefix (string)
The build prefix for the modules (defaults to /app for
applications and /usr for runtimes).
env (object)
This is a dictionary defining environment variables to be
set during the build.
build-args (array of strings)
This is an array containing extra options to pass to
flatpak build.
config-opts (array of strings)
This is an array containing extra options to pass to
configure.
strip (boolean)
If this is true (the default is false) then all ELF files
will be stripped after install.
no-debuginfo (boolean)
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.
arch (object)
This is a dictionary defining for each arch a separate
build options object that override the main one.
Module¶
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. Modules can be nested, in order to turn related modules on and off with a single key. These are the properties that are accepted: name (string)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 '/' in this string is a bad idea.
disabled (boolean)
If true, skip this module
sources (array of objects)
An array of objects defining sources that will be
downloaded and extracted in order
config-opts (array of strings)
An array of options that will be passed to
configure
make-args (array of strings)
An array of arguments that will be passed to make
make-install-args (array of strings)
An array of arguments that will be passed to make
install
rm-configure (boolean)
If true, remove the configure script before starting
build
no-autogen (boolean)
Ignore the existence of an autogen script
no-parallel-make (boolean)
Don't call make with arguments to build in parallel
no-python-timestamp-fix (boolean)
Don't fix up the *.py[oc] header timestamps for ostree
use.
cmake (boolean)
Use cmake instead of configure (deprecated: use
buildsystem instead)
buildsystem (string)
Build system to use: autotools, cmake, meson
builddir (boolean)
Use a build directory that is separate from the source
directory
subdir (string)
Build inside this subdirectory of the extracted
sources
build-options (object)
A build options object that can override global
options
post-install (array of strings)
An array of shell commands that are run after the install
phase. Can for example clean up the install dir, or install extra files.
cleanup (array of strings)
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.
cleanup-platform (array of strings)
Extra files to clean up in the platform.
modules (array of objects or strings)
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.
Sources¶
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.
type
"archive"
path (string)
The path of the archive
url (string)
The URL of a remote archive that will be downloaded. This
overrides path if both are specified.
sha256 (string)
The sha256 checksum of the file, verified after
download
strip-components (integer)
The number of initial pathname components to strip during
extraction. Defaults to 1.
dest (string)
Directory inside the source dir where the archive will be
extracted.
type
"git"
path (string)
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:///...
url (string)
URL of the git repository. This overrides path if both
are specified.
branch (string)
The branch/tag/commit to use from the git
repository
dest (string)
Directory inside the source dir where the repository will
be checked out.
type
"bzr"
url (string)
URL of the bzr repository
revision (string)
A specific revision to use in the branch
dest (string)
Directory inside the source dir where the repository will
be checked out.
type
"file"
path (string)
The path of a local file that will be copied into the
source dir
url (string)
The URL of a remote file that will be downloaded and
copied into the source dir. This overrides path if both are specified.
sha256 (string)
The sha256 checksum of the file, verified after download.
This is optional for local files.
dest-filename (string)
Filename to use inside the source dir, default to the
basename of path.
dest (string)
Directory inside the source dir where the file will be
copied.
This is a way to create a shell (/bin/sh) script from an inline set of commands.
type
"script"
commands (array of strings)
An array of shell commands that will be put in a
shellscript file
dest-filename (string)
Filename to use inside the source dir, default to the
basename of path.
dest (string)
Directory inside the source dir where the file will be
copied.
This is a way to create/modify the sources by running shell commands.
type
"shell"
commands (array of strings)
An array of shell commands that will be run during source
extraction
type
"patch"
path (string)
The path of a patch file that will be applied in the
source dir
strip-components (integer)
The value of the -p argument to patch, defaults to
1.
dest (string)
Directory inside the source dir where the patch will be
applied.
use-git (boolean)
Whether to use "git apply" rather than
"patch" to apply the patch, required when the patch file contains
binary diffs.
options (array of strings)
Extra options to pass to the patch command.
OPTIONS¶
The following options are understood: -h, --helpShow help options and exit.
-v, --verbose
Print debug information during command processing.
--version
Print version information and exit.
--arch=ARCH
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.
--disable-cache
Don't look at the existing cache for a previous build,
instead always rebuild modules.
--disable-download
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.
--disable-updates
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.
--run
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.
--show-deps
List all the (local) files that the manifest depends
on.
--download-only
Exit successfully after downloading the required
sources.
--build-only
Don't do the cleanup and finish stages, which is useful
if you want to build more things into the app.
--finish-only
Only do the cleanup, finish and export stages, picking up
where a --build-only command left off.
--require-changes
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.
--keep-build-dirs
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").
--ccache
Enable use of ccache in the build (needs ccache in the
sdk)
--stop-at=MODULENAME
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.
--repo=DIR
When build is done, run export the result to this
repository.
-s, --subject=SUBJECT
One line subject for the commit message. Used when
exporting the build results.
-b, --body=BODY
Full description for the commit message. Used when
exporting the build results.
--gpg-sign=KEYID
Sign the commit with this GPG key. Used when exporting
the build results. This option can be used multiple times.
--gpg-homedir=PATH
GPG Homedir to use when looking for keyrings. Used when
exporting the build results.
--jobs=JOBS
Limit the number of parallel jobs during the build. The
default is the number of CPUs on the machine.
--force-clean
Erase the previous contents of DIRECTORY if it is not
empty.
--sandbox
Disable the possibility to specify build-args that are
passed to flatpak build. This means the build process can't break out of its
sandbox, and is useful when building less trusted software.
--allow-missing-runtimes
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.
CACHING¶
flatpak-builder caches sources and partial build results in the .flatpak-builder subdirectory of the current directory. If you use --keep-build-dirs, build directories for each module are also stored here. It is safe to remove the contents of the .flatpak-builder directory. This will force a full build the next time you build.EXAMPLES¶
$ flatpak-builder my-app-dir manifest.json Example manifest file:{ "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" } ] } ] }
SEE ALSO¶
flatpak(1), flatpak-build-init(1), flatpak-build(1), flatpak-build-finish(1), flatpak-build-export(1)flatpak |