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, cups, gpg-agent. This option can be
64 used multiple 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, cups, gpg-agent. This option can be
71 used multiple 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 input, kvm, shm, 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, input, kvm, shm, all. This option can be used multiple
82 times.
83
84 --allow=FEATURE
85 Allow access to a specific feature. This updates the [Context]
86 group in the metadata. FEATURE must be one of: devel, multiarch,
87 bluetooth, canbus, per-app-dev-shm. This option can be used
88 multiple times.
89
90 See flatpak-build-finish(1) for the meaning of the various
91 features.
92
93 --disallow=FEATURE
94 Disallow access to a specific feature. This updates the [Context]
95 group in the metadata. FEATURE must be one of: devel, multiarch,
96 bluetooth, canbus, per-app-dev-shm. This option can be used
97 multiple times.
98
99 --filesystem=FILESYSTEM[:ro|:create]
100 Allow the application access to a subset of the filesystem. This
101 overrides to the Context section from the application metadata.
102 FILESYSTEM can be one of: home, host, host-os, host-etc,
103 xdg-desktop, xdg-documents, xdg-download, xdg-music, xdg-pictures,
104 xdg-public-share, xdg-templates, xdg-videos, xdg-run, xdg-config,
105 xdg-cache, xdg-data, an absolute path, or a homedir-relative path
106 like ~/dir or paths relative to the xdg dirs, like
107 xdg-download/subdir. The optional :ro suffix indicates that the
108 location will be read-only. The optional :create suffix indicates
109 that the location will be read-write and created if it doesn't
110 exist. This option can be used multiple times. See the "[Context]
111 filesystems" list in flatpak-metadata(5) for details of the
112 meanings of these filesystems.
113
114 --nofilesystem=FILESYSTEM
115 Remove access to the specified subset of the filesystem from the
116 application. This overrides to the Context section from the
117 application metadata. FILESYSTEM can be one of: home, host,
118 host-os, host-etc, xdg-desktop, xdg-documents, xdg-download,
119 xdg-music, xdg-pictures, xdg-public-share, xdg-templates,
120 xdg-videos, an absolute path, or a homedir-relative path like
121 ~/dir. This option can be used multiple times.
122
123 --with-appdir
124 Expose and configure access to the per-app storage directory in
125 $HOME/.var/app. This is not normally useful when building, but
126 helps when testing built apps.
127
128 --add-policy=SUBSYSTEM.KEY=VALUE
129 Add generic policy option. For example,
130 "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would
131 map to this metadata:
132
133 [Policy subsystem]
134 key=v1;v2;
135
136
137 This option can be used multiple times.
138
139 --remove-policy=SUBSYSTEM.KEY=VALUE
140 Remove generic policy option. This option can be used multiple
141 times.
142
143 --env=VAR=VALUE
144 Set an environment variable in the application. This overrides to
145 the Context section from the application metadata. This option can
146 be used multiple times.
147
148 --unset-env=VAR
149 Unset an environment variable in the application. This overrides
150 the unset-environment entry in the [Context] group of the metadata,
151 and the [Environment] group. This option can be used multiple
152 times.
153
154 --env-fd=FD
155 Read environment variables from the file descriptor FD, and set
156 them as if via --env. This can be used to avoid environment
157 variables and their values becoming visible to other users.
158
159 Each environment variable is in the form VAR=VALUE followed by a
160 zero byte. This is the same format used by env -0 and
161 /proc/*/environ.
162
163 --own-name=NAME
164 Allow the application to own the well-known name NAME on the
165 session bus. This overrides to the Context section from the
166 application metadata. This option can be used multiple times.
167
168 --talk-name=NAME
169 Allow the application to talk to the well-known name NAME on the
170 session bus. This overrides to the Context section from the
171 application metadata. This option can be used multiple times.
172
173 --system-own-name=NAME
174 Allow the application to own the well-known name NAME on the system
175 bus. This overrides to the Context section from the application
176 metadata. This option can be used multiple times.
177
178 --system-talk-name=NAME
179 Allow the application to talk to the well-known name NAME on the
180 system bus. This overrides to the Context section from the
181 application metadata. This option can be used multiple times.
182
183 --persist=FILENAME
184 If the application doesn't have access to the real homedir, make
185 the (homedir-relative) path FILENAME a bind mount to the
186 corresponding path in the per-application directory, allowing that
187 location to be used for persistent data. This overrides to the
188 Context section from the application metadata. This option can be
189 used multiple times.
190
191 --sdk-dir=DIR
192 Normally if there is a usr directory in the build dir, this is used
193 for the runtime files (this can be created by --writable-sdk or
194 --type=runtime arguments to build-init). If you specify --sdk-dir,
195 this directory will be used instead. Use this if you passed
196 --sdk-dir to build-init.
197
198 --readonly
199 Mount the normally writable destination directories read-only. This
200 can be useful if you want to run something in the sandbox but
201 guarantee that it doesn't affect the build results. For example
202 tests.
203
204 --metadata=FILE
205 Use the specified filename as metadata in the exported app instead
206 of the default file (called metadata). This is useful if you build
207 multiple things from a single build tree (such as both a platform
208 and a sdk).
209
210 --log-session-bus
211 Log session bus traffic. This can be useful to see what access you
212 need to allow in your D-Bus policy.
213
214 --log-system-bus
215 Log system bus traffic. This can be useful to see what access you
216 need to allow in your D-Bus policy.
217
219 $ flatpak build /build/my-app rpmbuild my-app.src.rpm
220
222 flatpak(1), flatpak-build-init(1), flatpak-build-finish(1), flatpak-
223 build-export(1)
224
225
226
227flatpak FLATPAK BUILD(1)