FLATPAK-BUILDER(1) | flatpak builder | FLATPAK-BUILDER(1) |
flatpak-builder - Help build application dependencies
flatpak-builder [OPTION...] DIRECTORY MANIFEST
flatpak-builder --run [OPTION...] DIRECTORY MANIFEST COMMAND
flatpak-builder --show-deps [OPTION...] MANIFEST
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:
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, flatpak-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.
When building a flatpak to be published to the internet, --collection-id=COLLECTION-ID should be specified as a globally unique reverse DNS value to identify the collection of flatpaks this will be added to. Setting a globally unique collection ID allows the apps in the repository to be shared over peer to peer systems without needing further configuration.
The manifest file is a json or yaml file whose format is described in detail in its own manual page.
The following options are understood:
-h, --help
-v, --verbose
--version
--arch=ARCH
--default-branch=BRANCH
--disable-cache
--disable-rofiles-fuse
--disable-download
--disable-updates
--disable-tests
--run
Only the --arch=ARCH, --ccache and --verbose options can be combined with this option.
--build-shell=MODULENAME
--show-deps
Only the --verbose option can be combined with this option.
--download-only
--bundle-sources
--build-only
--finish-only
--export-only
--require-changes
--state-dir=PATH
--keep-build-dirs
--delete-build-dirs
--ccache
--stop-at=MODULENAME
--repo=DIR
-s, --subject=SUBJECT
-b, --body=BODY
--collection-id=COLLECTION-ID
--gpg-sign=KEYID
--gpg-homedir=PATH
--jobs=JOBS
--force-clean
--sandbox
--allow-missing-runtimes
--rebuild-on-sdk-change
--skip-if-unchanged
--mirror-screenshots-url=URL
--extra-sources=SOURCE-DIR
--extra-sources-url=URL
--from-git=GIT
--from-git-branch=BRANCH
--no-shallow-clone
--add-tag=TAG
--remove-tag=TAG
--install-deps-from=REMOTE
--install-deps-only
--install
--user
--system
--installation=NAME
flatpak-builder caches sources and partial build results in the state directory (defaulting to 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 state directory. This will force a full build the next time you build.
$ 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",
"cleanup": [ "/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": "https://gitlab.gnome.org/GNOME/babl.git"
}
]
},
{
"name": "testapp",
"sources": [
{
"type": "bzr",
"url": "lp:testapp"
}
]
}
] }
flatpak(1), flatpak-manifest(5), flatpak-build-init(1), flatpak-build(1), flatpak-build-finish(1), flatpak-build-export(1)
flatpak |