FLATPAK MANIFEST(5)

NAME
flatpak-manifest - Information for building an application

DESCRIPTION

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.

FILE FORMAT

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.

  Toplevel properties

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.

cleanup-platform-commands (array of strings)
    An array of commandlines that are run during the cleanup phase of 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. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.

cxxflags (string)
    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.

ldflags (string)
    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.

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-make-install (boolean)
    Don't run the make install (or equivalent) stage

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, cmake-ninja, meson, simple

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

build-commands (array of strings)
    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.

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.

ensure-writable (array of strings)
    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.

only-arches (array of strings)
    If non-empty, only build the module on the arches listed.

skip-arches (array of strings)
    Don't build on any of the arches listed.

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.

All sources

    only-arches (array of strings)
        If non-empty, only build the module on the arches listed.

    skip-arches (array of strings)
        Don't build on any of the arches listed.

    dest (string)
        Directory inside the source dir where this source will be extracted.

Archive sources (tar, zip)

    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.

Git sources

    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 to use from the git repository

    commit (string)
        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.

    disable-fsckobjects (boolean)
        Don't use transfer.fsckObjects=1 to mirror git repository. This may be needed for some (broken) repositories.

Bzr sources

    type
        "bzr"

    url (string)
        URL of the bzr repository

    revision (string)
        A specific revision to use in the branch

File sources

    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.

Script sources

    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.

Shell sources

    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

Patch sources

    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.

    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.

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-builder(1)