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