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