flatpak-builder/doc/flatpak-manifest.xml

656 lines
35 KiB
XML
Raw Normal View History

<?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-manifest">
<refentryinfo>
<title>flatpak manifest</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 manifest</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>
<refnamediv>
<refname>flatpak-manifest</refname>
<refpurpose>Information for building an application</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Flatpak uses manifest, or recipe, files in a json format to describe how an
application and its bundled dependencies can be built from sources. The manifest
gets used by flatpak-builder.
</para>
</refsect1>
<refsect1>
<title>File format</title>
<para>
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.
</para>
<refsect2>
<title>Toplevel properties</title>
<para>
These are the properties that are accepted:
</para>
<variablelist>
<varlistentry>
<term><option>id</option> or <option>app-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>var</option> (string)</term>
<listitem><para>Initialize the (otherwise empty) writable /var in the build with a copy of this runtime.</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. 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.</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>build-extension</option> (boolean)</term>
<listitem><para>Build an extension.</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>base</option> (string)</term>
<listitem><para>Start with the files from the specified application. This can be
used to create applications that extend another application.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>base-version</option> (string)</term>
<listitem><para>Use this specific version of the application specified in base.
If unspecified, this uses the value specified in branch</para></listitem>
</varlistentry>
<varlistentry>
<term><option>base-extensions</option> (array of strings)</term>
<listitem><para>Install these extra extensions from the base application when initializing
the application directory.</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 or string)</term>
<listitem><para>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.</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>cleanup-platform-commands</option> (array of strings)</term>
<listitem><para>An array of commandlines that are run during the cleanup phase of 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. Note that this is the icon name, not the full filenames, so it should not include a filename extension. </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-suffix</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. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>cxxflags</option> (string)</term>
<listitem><para>This is set in the environment variable CXXFLAGS during the build. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>ldflags</option> (string)</term>
<listitem><para>This is set in the environment variable LDFLAGS during the build. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</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. Elements in this override the properties that set the environment, like cflags and ldflags.</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>config-opts</option> (array of strings)</term>
<listitem><para>This is an array containing extra options to pass to configure.</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>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.</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>
Modules can be nested, in order to turn related modules on and off with a single key.
</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. The name is also used for constructing filenames and commandline arguments, therefore using spaces or '/' in this string is a bad idea.</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>install-rule</option> (string)</term>
<listitem><para>Name of the rule passed to make for the install phase, default is install</para></listitem>
</varlistentry>
<varlistentry>
<term><option>no-make-install</option> (boolean)</term>
<listitem><para>Don't run the make install (or equivalent) stage</para></listitem>
</varlistentry>
<varlistentry>
<term><option>no-python-timestamp-fix</option> (boolean)</term>
<listitem><para>Don't fix up the *.py[oc] header timestamps for ostree use.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>cmake</option> (boolean)</term>
<listitem><para>Use cmake instead of configure (deprecated: use buildsystem instead)</para></listitem>
</varlistentry>
<varlistentry>
<term><option>buildsystem</option> (string)</term>
<listitem><para>Build system to use: autotools, cmake, cmake-ninja, meson, simple</para></listitem>
</varlistentry>
<varlistentry>
<term><option>builddir</option> (boolean)</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>build-commands</option> (array of strings)</term>
<listitem><para>An array of commands to run during build (between make and make install if those are used).
This is primarily useful when using the "simple" buildsystem.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>post-install</option> (array of strings)</term>
<listitem><para>An array of shell commands 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>ensure-writable</option> (array of strings)</term>
<listitem><para>The way the builder works is that files in the install directory
are hard-links to the cached files, so you're not allowed to modify them in-place.
If you list a file in this then the hardlink will be broken and you can modify it.
This is a workaround, ideally installing files should replace files, not modify
existing ones.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>only-arches</option> (array of strings)</term>
<listitem><para>If non-empty, only build the module on the arches listed.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>skip-arches</option> (array of strings)</term>
<listitem><para>Don't build on any of the arches listed.</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>modules</option> (array of objects or strings)</term>
<listitem><para>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.</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, distinguished by the type property.
</para>
<refsect3>
<title>All sources</title>
<variablelist>
<varlistentry>
<term><option>only-arches</option> (array of strings)</term>
<listitem><para>If non-empty, only build the module on the arches listed.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>skip-arches</option> (array of strings)</term>
<listitem><para>Don't build on any of the arches listed.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>dest</option> (string)</term>
<listitem><para>Directory inside the source dir where this source will be extracted.</para></listitem>
</varlistentry>
</variablelist>
</refsect3>
<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>
</variablelist>
</refsect3>
<refsect3>
<title>Git sources</title>
<variablelist>
<varlistentry>
<term><option>type</option></term>
<listitem><para>"git"</para></listitem>
</varlistentry>
<varlistentry>
<term><option>path</option> (string)</term>
<listitem><para>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:///...</para></listitem>
</varlistentry>
<varlistentry>
<term><option>url</option> (string)</term>
<listitem><para>URL of the git repository. This overrides path if both are specified.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>branch</option> (string)</term>
<listitem><para>The branch/tag to use from the git repository</para></listitem>
</varlistentry>
<varlistentry>
<term><option>commit</option> (string)</term>
<listitem><para>The commit to use from the git repository. If branch is also specified, then it is verified that the branch/tag is at this specific commit. This is
a readable way to document that you're using a particular tag, but verify that it does not change.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>disable-fsckobjects</option> (boolean)</term>
<listitem><para>Don't use transfer.fsckObjects=1 to mirror git repository. This may be needed for some (broken) repositories.</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 repository</para></listitem>
</varlistentry>
<varlistentry>
<term><option>revision</option> (string)</term>
<listitem><para>A specific revision to use in the branch</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>
</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>
</variablelist>
</refsect3>
<refsect3>
<title>Shell sources</title>
<para>
This is a way 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>use-git</option> (boolean)</term>
<listitem><para>Whether to use "git apply" rather than "patch" to apply the patch, required when the patch file contains binary diffs.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>options</option> (array of strings)</term>
<listitem><para>Extra options to pass to the patch command.</para></listitem>
</varlistentry>
</variablelist>
</refsect3>
</refsect2>
</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-builder</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>