Whamcloud - gitweb
misc/util.c: enable MinGW alarm() when building for Windows
[tools/e2fsprogs.git] / misc / Android.bp
1 // Copyright 2017 The Android Open Source Project
2
3 // Library used to export files from this directory to other programs in this
4 // project.
5 package {
6     // See: http://go/android-license-faq
7     // A large-scale-change added 'default_applicable_licenses' to import
8     // all of the 'license_kinds' from "external_e2fsprogs_license"
9     // to get the below license kinds:
10     //   SPDX-license-identifier-GPL
11     //   SPDX-license-identifier-LGPL
12     //   SPDX-license-identifier-LGPL-2.1
13     //   SPDX-license-identifier-LGPL-3.0
14     default_applicable_licenses: ["external_e2fsprogs_license"],
15 }
16
17 cc_library {
18     name: "libext2_misc",
19     host_supported: true,
20     recovery_available: true,
21     defaults: ["e2fsprogs-defaults"],
22
23     target: {
24         windows: {
25             include_dirs: [ "external/e2fsprogs/include/mingw" ],
26             enabled: true,
27             cflags: ["-Wno-unused-variable"],
28         },
29     },
30
31     srcs: [
32         "create_inode.c",
33     ],
34     cflags: ["-Wno-error=format-extra-args"],
35     shared_libs: [
36         "libext2fs",
37         "libext2_com_err",
38         "libext2_quota",
39     ],
40     export_include_dirs: ["."],
41 }
42
43 //########################################################################
44 // Build mke2fs
45
46 cc_binary {
47     name: "mke2fs",
48     host_supported: true,
49     recovery_available: true,
50     defaults: ["e2fsprogs-defaults"],
51
52     srcs: [
53         "mke2fs.c",
54         "util.c",
55         "mk_hugefiles.c",
56         "default_profile.c",
57     ],
58     cflags: [
59         "-Wno-error=format",
60         "-Wno-error=type-limits",
61         "-Wno-format-extra-args",
62     ],
63     target: {
64         host: {
65             static_libs: [
66                 "libext2_blkid",
67                 "libext2_misc",
68                 "libext2_uuid",
69                 "libext2_quota",
70                 "libext2_com_err",
71                 "libext2_e2p",
72                 "libext2fs",
73                 "libsparse",
74                 "libbase",
75                 "libz",
76             ],
77         },
78         not_windows: {
79             required: [
80                 "mke2fs.conf",
81             ],
82         },
83         windows: {
84             include_dirs: [ "external/e2fsprogs/include/mingw" ],
85             cflags: [
86                 // mke2fs.c has a warning from gcc which cannot be suppressed:
87                 // passing argument 3 of 'ext2fs_get_device_size' from
88                 // incompatible pointer type
89                 "-Wno-error"
90             ],
91             ldflags: ["-static"],
92             enabled: true
93         },
94         android: {
95             required: [
96                 "mke2fs.conf",
97             ],
98             shared_libs: [
99                 "libext2fs",
100                 "libext2_blkid",
101                 "libext2_misc",
102                 "libext2_uuid",
103                 "libext2_quota",
104                 "libext2_com_err",
105                 "libext2_e2p",
106             ],
107             symlinks: ["mkfs.ext2", "mkfs.ext3", "mkfs.ext4"],
108         },
109     },
110     stl: "libc++_static",
111     include_dirs: ["external/e2fsprogs/e2fsck"],
112 }
113
114 //##########################################################################
115 // Build tune2fs
116
117 cc_defaults {
118     name: "tune2fs-defaults",
119     defaults: ["e2fsprogs-defaults"],
120     srcs: [
121         "tune2fs.c",
122         "util.c",
123     ],
124     cflags: ["-DNO_RECOVERY"],
125     include_dirs: ["external/e2fsprogs/e2fsck"],
126 }
127
128 tune2fs_libs = [
129     "libext2_blkid",
130     "libext2_com_err",
131     "libext2_quota",
132     "libext2_uuid",
133     "libext2_e2p",
134     "libext2fs",
135 ]
136
137 cc_binary {
138     name: "tune2fs",
139     host_supported: true,
140     vendor_ramdisk_available: true,
141     defaults: ["tune2fs-defaults"],
142
143     shared_libs: tune2fs_libs,
144 }
145
146 cc_binary {
147     name: "tune2fs_static",
148     static_executable: true,
149     defaults: ["tune2fs-defaults"],
150
151     static_libs: tune2fs_libs,
152 }
153
154 cc_binary {
155     name: "tune2fs_ramdisk",
156     stem: "tune2fs",
157     static_executable: true,
158     ramdisk: true,
159     defaults: ["tune2fs-defaults"],
160     static_libs: tune2fs_libs,
161 }
162
163 cc_library_static {
164     name: "libtune2fs",
165     defaults: ["tune2fs-defaults"],
166
167     cflags: ["-DBUILD_AS_LIB"],
168     static_libs: tune2fs_libs,
169 }
170
171 //########################################################################
172 // Build badblocks
173
174 cc_binary {
175     name: "badblocks",
176     host_supported: true,
177     defaults: ["e2fsprogs-defaults"],
178
179     srcs: ["badblocks.c"],
180     shared_libs: [
181         "libext2fs",
182         "libext2_com_err",
183         "libext2_uuid",
184         "libext2_blkid",
185         "libext2_e2p",
186     ],
187 }
188
189 //########################################################################
190 // Build chattr
191
192 cc_binary {
193     name: "chattr-e2fsprogs",
194     host_supported: true,
195     defaults: ["e2fsprogs-defaults"],
196
197     srcs: ["chattr.c"],
198     shared_libs: [
199         "libext2_com_err",
200         "libext2_e2p",
201     ],
202 }
203
204 //########################################################################
205 // Build lsattr
206
207 cc_defaults {
208     name: "lsattr-defaults",
209     srcs: ["lsattr.c"],
210     defaults: ["e2fsprogs-defaults"],
211 }
212
213 lsattr_libs = [
214     "libext2_com_err",
215     "libext2_e2p",
216 ]
217
218 cc_binary {
219     name: "lsattr-e2fsprogs",
220     host_supported: true,
221     defaults: ["lsattr-defaults"],
222
223     shared_libs: lsattr_libs,
224 }
225
226 cc_binary {
227     name: "lsattr_static",
228     static_executable: true,
229     defaults: ["lsattr-defaults"],
230
231     static_libs: lsattr_libs,
232 }
233
234 //########################################################################
235 // Build blkid
236
237 cc_binary {
238     name: "blkid",
239     defaults: ["e2fsprogs-defaults"],
240
241     srcs: ["blkid.c"],
242     shared_libs: [
243         "libext2fs",
244         "libext2_blkid",
245         "libext2_com_err",
246         "libext2_e2p",
247     ],
248 }
249
250 //########################################################################
251 // Build e4crypt
252
253 cc_binary {
254     name: "e4crypt",
255     host_supported: true,
256     defaults: ["e2fsprogs-defaults"],
257
258     srcs: ["e4crypt.c"],
259     shared_libs: [
260         "libext2fs",
261         "libext2_uuid",
262     ],
263
264     target: {
265         darwin: {
266             enabled: false,
267         },
268     },
269 }
270
271 //##########################################################################
272 // Build e2image
273
274 cc_binary {
275     name: "e2image",
276     host_supported: true,
277     defaults: ["e2fsprogs-defaults"],
278
279     srcs: ["e2image.c"],
280     shared_libs: [
281         "libext2fs",
282         "libext2_blkid",
283         "libext2_com_err",
284         "libext2_quota",
285     ],
286 }
287
288 //##########################################################################
289 // Build filefrag
290
291 cc_binary {
292     name: "filefrag",
293     host_supported: true,
294     defaults: ["e2fsprogs-defaults"],
295
296     srcs: ["filefrag.c"],
297     shared_libs: [
298         "libext2fs",
299     ],
300 }
301
302 //##########################################################################
303 // Build e2freefrag
304
305 cc_binary {
306     name: "e2freefrag",
307     host_supported: true,
308     defaults: ["e2fsprogs-defaults"],
309
310     srcs: [
311         "e2freefrag.c",
312     ],
313     header_libs: ["libext2-headers"],
314     shared_libs: [
315         "libext2fs",
316         "libext2_com_err",
317     ],
318 }