1FLATPAK BUILD(1) flatpak build FLATPAK BUILD(1)
2
3
4
6 flatpak-build - Build in a directory
7
9 flatpak build [OPTION...] DIRECTORY [COMMAND [ARG...]]
10
12 Runs a build command in a directory. DIRECTORY must have been
13 initialized with flatpak build-init.
14
15 The sdk that is specified in the metadata file in the directory is
16 mounted at /usr and the files and var subdirectories are mounted at
17 /app and /var, respectively. They are writable, and their contents are
18 preserved between build commands, to allow accumulating build artifacts
19 there.
20
22 The following options are understood:
23
24 -h, --help
25 Show help options and exit.
26
27 -v, --verbose
28 Print debug information during command processing.
29
30 --ostree-verbose
31 Print OSTree debug information during command processing.
32
33 -r, --runtime
34 Use the non-devel runtime that is specified in the application
35 metadata instead of the devel runtime.
36
37 -p, --die-with-parent
38 Kill the build process and all children when the launching process
39 dies.
40
41 --bind-mount=DEST=SOURCE
42 Add a custom bind mount in the build namespace. Can be specified
43 multiple times.
44
45 --build-dir=PATH
46 Start the build in this directory (default is in the current
47 directory).
48
49 --share=SUBSYSTEM
50 Share a subsystem with the host session. This overrides the Context
51 section from the application metadata. SUBSYSTEM must be one of:
52 network, ipc. This option can be used multiple times.
53
54 --unshare=SUBSYSTEM
55 Don't share a subsystem with the host session. This overrides the
56 Context section from the application metadata. SUBSYSTEM must be
57 one of: network, ipc. This option can be used multiple times.
58
59 --socket=SOCKET
60 Expose a well-known socket to the application. This overrides to
61 the Context section from the application metadata. SOCKET must be
62 one of: x11, wayland, fallback-x11, pulseaudio, system-bus,
63 session-bus, ssh-auth, pcsc. This option can be used multiple
64 times.
65
66 --nosocket=SOCKET
67 Don't expose a well-known socket to the application. This overrides
68 to the Context section from the application metadata. SOCKET must
69 be one of: x11, wayland, fallback-x11, pulseaudio, system-bus,
70 session-bus, ssh-auth, pcsc. This option can be used multiple
71 times.
72
73 --device=DEVICE
74 Expose a device to the application. This overrides to the Context
75 section from the application metadata. DEVICE must be one of: dri,
76 kvm, all. This option can be used multiple times.
77
78 --nodevice=DEVICE
79 Don't expose a device to the application. This overrides to the
80 Context section from the application metadata. DEVICE must be one
81 of: dri, kvm, all. This option can be used multiple times.
82
83 --allow=FEATURE
84 Allow access to a specific feature. This updates the [Context]
85 group in the metadata. FEATURE must be one of: devel, multiarch,
86 bluetooth, canbus. This option can be used multiple times.
87
88 See flatpak-build-finish(1) for the meaning of the various
89 features.
90
91 --disallow=FEATURE
92 Disallow access to a specific feature. This updates the [Context]
93 group in the metadata. FEATURE must be one of: devel, multiarch,
94 bluetooth, canbus. This option can be used multiple times.
95
96 --filesystem=FILESYSTEM[:ro|:create]
97 Allow the application access to a subset of the filesystem. This
98 overrides to the Context section from the application metadata.
99 FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents,
100 xdg-download, xdg-music, xdg-pictures, xdg-public-share,
101 xdg-templates, xdg-videos, xdg-run, xdg-config, xdg-cache,
102 xdg-data, an absolute path, or a homedir-relative path like ~/dir
103 or paths relative to the xdg dirs, like xdg-download/subdir. The
104 optional :ro suffix indicates that the location will be read-only.
105 The optional :create suffix indicates that the location will be
106 read-write and created if it doesn't exist. This option can be used
107 multiple times.
108
109 --nofilesystem=FILESYSTEM
110 Remove access to the specified subset of the filesystem from the
111 application. This overrides to the Context section from the
112 application metadata. FILESYSTEM can be one of: home, host,
113 xdg-desktop, xdg-documents, xdg-download, xdg-music, xdg-pictures,
114 xdg-public-share, xdg-templates, xdg-videos, an absolute path, or a
115 homedir-relative path like ~/dir. This option can be used multiple
116 times.
117
118 --with-appdir
119 Expose and configure access to the per-app storage directory in
120 $HOME/.var/app. This is not normally useful when building, but
121 helps when testing built apps.
122
123 --add-policy=SUBSYSTEM.KEY=VALUE
124 Add generic policy option. For example,
125 "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would
126 map to this metadata:
127
128 [Policy subsystem]
129 key=v1;v2;
130
131
132 This option can be used multiple times.
133
134 --remove-policy=SUBSYSTEM.KEY=VALUE
135 Remove generic policy option. This option can be used multiple
136 times.
137
138 --env=VAR=VALUE
139 Set an environment variable in the application. This overrides to
140 the Context section from the application metadata. This option can
141 be used multiple times.
142
143 --own-name=NAME
144 Allow the application to own the well-known name NAME on the
145 session bus. This overrides to the Context section from the
146 application metadata. This option can be used multiple times.
147
148 --talk-name=NAME
149 Allow the application to talk to the well-known name NAME on the
150 session bus. This overrides to the Context section from the
151 application metadata. This option can be used multiple times.
152
153 --system-own-name=NAME
154 Allow the application to own the well-known name NAME on the system
155 bus. This overrides to the Context section from the application
156 metadata. This option can be used multiple times.
157
158 --system-talk-name=NAME
159 Allow the application to talk to the well-known name NAME on the
160 system bus. This overrides to the Context section from the
161 application metadata. This option can be used multiple times.
162
163 --persist=FILENAME
164 If the application doesn't have access to the real homedir, make
165 the (homedir-relative) path FILENAME a bind mount to the
166 corresponding path in the per-application directory, allowing that
167 location to be used for persistent data. This overrides to the
168 Context section from the application metadata. This option can be
169 used multiple times.
170
171 --sdk-dir=DIR
172 Normally if there is a usr directory in the build dir, this is used
173 for the runtime files (this can be created by --writable-sdk or
174 --type=runtime arguments to build-init). If you specify --sdk-dir,
175 this directory will be used instead. Use this if you passed
176 --sdk-dir to build-init.
177
178 --readonly
179 Mount the normally writable destination directories read-only. This
180 can be useful if you want to run something in the sandbox but
181 guarantee that it doesn't affect the build results. For example
182 tests.
183
184 --metadata=FILE
185 Use the specified filename as metadata in the exported app instead
186 of the default file (called metadata). This is useful if you build
187 multiple things from a single build tree (such as both a platform
188 and a sdk).
189
190 --log-session-bus
191 Log session bus traffic. This can be useful to see what access you
192 need to allow in your D-Bus policy.
193
194 --log-system-bus
195 Log system bus traffic. This can be useful to see what access you
196 need to allow in your D-Bus policy.
197
199 $ flatpak build /build/my-app rpmbuild my-app.src.rpm
200
202 flatpak(1), flatpak-build-init(1), flatpak-build-finish(1), flatpak-
203 build-export(1)
204
205
206
207flatpak FLATPAK BUILD(1)