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. This option can be used multiple times.
64
65 --nosocket=SOCKET
66 Don't expose a well-known socket to the application. This overrides
67 to the Context section from the application metadata. SOCKET must
68 be one of: x11, wayland, fallback-x11, pulseaudio, system-bus,
69 session-bus, ssh-auth. This option can be used multiple times.
70
71 --device=DEVICE
72 Expose a device to the application. This overrides to the Context
73 section from the application metadata. DEVICE must be one of: dri,
74 kvm, all. This option can be used multiple times.
75
76 --nodevice=DEVICE
77 Don't expose a device to the application. This overrides to the
78 Context section from the application metadata. DEVICE must be one
79 of: dri, kvm, all. This option can be used multiple times.
80
81 --allow=FEATURE
82 Allow access to a specific feature. This updates the [Context]
83 group in the metadata. FEATURE must be one of: devel, multiarch,
84 bluetooth, canbus. This option can be used multiple times.
85
86 See flatpak-build-finish(1) for the meaning of the various
87 features.
88
89 --disallow=FEATURE
90 Disallow access to a specific feature. This updates the [Context]
91 group in the metadata. FEATURE must be one of: devel, multiarch,
92 bluetooth, canbus. This option can be used multiple times.
93
94 --filesystem=FILESYSTEM[:ro|:create]
95 Allow the application access to a subset of the filesystem. This
96 overrides to the Context section from the application metadata.
97 FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents,
98 xdg-download xdg-music, xdg-pictures, xdg-public-share,
99 xdg-templates, xdg-videos, xdg-run, xdg-config, xdg-cache,
100 xdg-data, an absolute path, or a homedir-relative path like ~/dir
101 or paths relative to the xdg dirs, like xdg-download/subdir. The
102 optional :ro suffix indicates that the location will be read-only.
103 The optional :create suffix indicates that the location will be
104 read-write and created if it doesn't exist. This option can be used
105 multiple times.
106
107 --nofilesystem=FILESYSTEM
108 Remove access to the specified subset of the filesystem from the
109 application. This overrides to the Context section from the
110 application metadata. FILESYSTEM can be one of: home, host,
111 xdg-desktop, xdg-documents, xdg-download xdg-music, xdg-pictures,
112 xdg-public-share, xdg-templates, xdg-videos, an absolute path, or a
113 homedir-relative path like ~/dir. This option can be used multiple
114 times.
115
116 --with-appdir
117 Expose and configure access to the per-app storage directory in
118 $HOME/.var/app. This is not normally useful when building, but
119 helps when testing built apps.
120
121 --add-policy=SUBSYSTEM.KEY=VALUE
122 Add generic policy option. For example,
123 "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would
124 map to this metadata:
125
126 [Policy subsystem]
127 key=v1;v2;
128
129
130 This option can be used multiple times.
131
132 --remove-policy=SUBSYSTEM.KEY=VALUE
133 Remove generic policy option. This option can be used multiple
134 times.
135
136 --env=VAR=VALUE
137 Set an environment variable in the application. This overrides to
138 the Context section from the application metadata. This option can
139 be used multiple times.
140
141 --own-name=NAME
142 Allow the application to own the well-known name NAME on the
143 session bus. This overrides to the Context section from the
144 application metadata. This option can be used multiple times.
145
146 --talk-name=NAME
147 Allow the application to talk to the well-known name NAME on the
148 session bus. This overrides to the Context section from the
149 application metadata. This option can be used multiple times.
150
151 --system-own-name=NAME
152 Allow the application to own the well-known name NAME on the system
153 bus. This overrides to the Context section from the application
154 metadata. This option can be used multiple times.
155
156 --system-talk-name=NAME
157 Allow the application to talk to the well-known name NAME on the
158 system bus. This overrides to the Context section from the
159 application metadata. This option can be used multiple times.
160
161 --persist=FILENAME
162 If the application doesn't have access to the real homedir, make
163 the (homedir-relative) path FILENAME a bind mount to the
164 corresponding path in the per-application directory, allowing that
165 location to be used for persistent data. This overrides to the
166 Context section from the application metadata. This option can be
167 used multiple times.
168
169 --sdk-dir=DIR
170 Normally if there is a usr directory in the build dir, this is used
171 for the runtime files (this can be created by --writable-sdk or
172 --type=runtime arguments to build-init). If you specify --sdk-dir
173 this directoryname will be used instead. Use this if you passed
174 --sdk-dir to build-init.
175
176 --readonly
177 Mount the normally writable destination directories read-only. This
178 can be useful if you want to run something in the sandbox but
179 guarantee that it doesn't affect the build results. For example
180 tests.
181
182 --metadata=FILE
183 Use the specified filename as metadata in the exported app instead
184 of the default file (called metadata). This is useful if you build
185 multiple things from a single build tree (such as both a platform
186 and a sdk).
187
188 --log-session-bus
189 Log session bus traffic. This can be useful to see what access you
190 need to allow in your D-Bus policy.
191
192 --log-system-bus
193 Log system bus traffic. This can be useful to see what access you
194 need to allow in your D-Bus policy.
195
197 $ flatpak build /build/my-app rpmbuild my-app.src.rpm
198
200 flatpak(1), flatpak-build-init(1), flatpak-build-finish(1), flatpak-
201 build-export(1)
202
203
204
205flatpak FLATPAK BUILD(1)