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