Whamcloud - gitweb
AOSP: [LSC] Add LOCAL_LICENSE_KINDS to external/e2fsprogs
[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     system_shared_libs: ["libc", "libdl"],
41     export_include_dirs: ["."],
42 }
43
44 //########################################################################
45 // Build mke2fs
46
47 cc_binary {
48     name: "mke2fs",
49     host_supported: true,
50     recovery_available: true,
51     defaults: ["e2fsprogs-defaults"],
52
53     srcs: [
54         "mke2fs.c",
55         "util.c",
56         "mk_hugefiles.c",
57         "default_profile.c",
58     ],
59     cflags: [
60         "-Wno-error=format",
61         "-Wno-error=type-limits",
62         "-Wno-format-extra-args",
63     ],
64     target: {
65         host: {
66             static_libs: [
67                 "libext2_blkid",
68                 "libext2_misc",
69                 "libext2_uuid",
70                 "libext2_quota",
71                 "libext2_com_err",
72                 "libext2_e2p",
73                 "libext2fs",
74                 "libsparse",
75                 "libbase",
76                 "libz",
77             ],
78         },
79         not_windows: {
80             required: [
81                 "mke2fs.conf",
82             ],
83         },
84         windows: {
85             include_dirs: [ "external/e2fsprogs/include/mingw" ],
86             cflags: [
87                 "-D_POSIX",
88                 "-D__USE_MINGW_ALARM",
89                 // mke2fs.c has a warning from gcc which cannot be suppressed:
90                 // passing argument 3 of 'ext2fs_get_device_size' from
91                 // incompatible pointer type
92                 "-Wno-error"
93             ],
94             ldflags: ["-static"],
95             host_ldlibs: ["-lws2_32"],
96             enabled: true
97         },
98         android: {
99             required: [
100                 "mke2fs.conf",
101             ],
102             shared_libs: [
103                 "libext2fs",
104                 "libext2_blkid",
105                 "libext2_misc",
106                 "libext2_uuid",
107                 "libext2_quota",
108                 "libext2_com_err",
109                 "libext2_e2p",
110             ],
111             symlinks: ["mkfs.ext2", "mkfs.ext3", "mkfs.ext4"],
112         },
113     },
114     stl: "libc++_static",
115     include_dirs: ["external/e2fsprogs/e2fsck"],
116 }
117
118 //##########################################################################
119 // Build tune2fs
120
121 cc_defaults {
122     name: "tune2fs-defaults",
123     defaults: ["e2fsprogs-defaults"],
124     srcs: [
125         "tune2fs.c",
126         "util.c",
127     ],
128     cflags: ["-DNO_RECOVERY"],
129     include_dirs: ["external/e2fsprogs/e2fsck"],
130 }
131
132 tune2fs_libs = [
133     "libext2_blkid",
134     "libext2_com_err",
135     "libext2_quota",
136     "libext2_uuid",
137     "libext2_e2p",
138     "libext2fs",
139 ]
140
141 cc_binary {
142     name: "tune2fs",
143     host_supported: true,
144     vendor_ramdisk_available: true,
145     defaults: ["tune2fs-defaults"],
146
147     shared_libs: tune2fs_libs,
148     system_shared_libs: ["libc", "libdl"],
149 }
150
151 cc_binary {
152     name: "tune2fs_static",
153     static_executable: true,
154     defaults: ["tune2fs-defaults"],
155
156     static_libs: tune2fs_libs,
157 }
158
159 cc_binary {
160     name: "tune2fs_ramdisk",
161     stem: "tune2fs",
162     static_executable: true,
163     ramdisk: true,
164     defaults: ["tune2fs-defaults"],
165     system_shared_libs: [],
166     static_libs: tune2fs_libs,
167 }
168
169 cc_library_static {
170     name: "libtune2fs",
171     defaults: ["tune2fs-defaults"],
172
173     cflags: ["-DBUILD_AS_LIB"],
174     static_libs: tune2fs_libs,
175 }
176
177 //########################################################################
178 // Build badblocks
179
180 cc_binary {
181     name: "badblocks",
182     host_supported: true,
183     defaults: ["e2fsprogs-defaults"],
184
185     srcs: ["badblocks.c"],
186     shared_libs: [
187         "libext2fs",
188         "libext2_com_err",
189         "libext2_uuid",
190         "libext2_blkid",
191         "libext2_e2p",
192     ],
193     system_shared_libs: ["libc", "libdl"],
194 }
195
196 //########################################################################
197 // Build chattr
198
199 cc_binary {
200     name: "chattr-e2fsprogs",
201     host_supported: true,
202     defaults: ["e2fsprogs-defaults"],
203
204     srcs: ["chattr.c"],
205     shared_libs: [
206         "libext2_com_err",
207         "libext2_e2p",
208     ],
209     system_shared_libs: ["libc", "libdl"],
210 }
211
212 //########################################################################
213 // Build lsattr
214
215 cc_defaults {
216     name: "lsattr-defaults",
217     srcs: ["lsattr.c"],
218     defaults: ["e2fsprogs-defaults"],
219 }
220
221 lsattr_libs = [
222     "libext2_com_err",
223     "libext2_e2p",
224 ]
225
226 cc_binary {
227     name: "lsattr-e2fsprogs",
228     host_supported: true,
229     defaults: ["lsattr-defaults"],
230
231     shared_libs: lsattr_libs,
232     system_shared_libs: ["libc", "libdl"],
233 }
234
235 cc_binary {
236     name: "lsattr_static",
237     static_executable: true,
238     defaults: ["lsattr-defaults"],
239
240     static_libs: lsattr_libs,
241 }
242
243 //########################################################################
244 // Build blkid
245
246 cc_binary {
247     name: "blkid",
248     defaults: ["e2fsprogs-defaults"],
249
250     srcs: ["blkid.c"],
251     shared_libs: [
252         "libext2fs",
253         "libext2_blkid",
254         "libext2_com_err",
255         "libext2_e2p",
256     ],
257     system_shared_libs: ["libc", "libdl"],
258 }
259
260 //########################################################################
261 // Build e4crypt
262
263 cc_binary {
264     name: "e4crypt",
265     host_supported: true,
266     defaults: ["e2fsprogs-defaults"],
267
268     srcs: ["e4crypt.c"],
269     shared_libs: [
270         "libext2fs",
271         "libext2_uuid",
272     ],
273     system_shared_libs: ["libc", "libdl"],
274
275     target: {
276         darwin: {
277             enabled: false,
278         },
279     },
280 }
281
282 //##########################################################################
283 // Build e2image
284
285 cc_binary {
286     name: "e2image",
287     host_supported: true,
288     defaults: ["e2fsprogs-defaults"],
289
290     srcs: ["e2image.c"],
291     shared_libs: [
292         "libext2fs",
293         "libext2_blkid",
294         "libext2_com_err",
295         "libext2_quota",
296     ],
297     system_shared_libs: ["libc", "libdl"],
298 }
299
300 //##########################################################################
301 // Build filefrag
302
303 cc_binary {
304     name: "filefrag",
305     host_supported: true,
306     defaults: ["e2fsprogs-defaults"],
307
308     srcs: ["filefrag.c"],
309     shared_libs: [
310         "libext2fs",
311     ],
312     system_shared_libs: ["libc", "libdl"],
313 }
314
315 //##########################################################################
316 // Build e2freefrag
317
318 cc_binary {
319     name: "e2freefrag",
320     host_supported: true,
321     defaults: ["e2fsprogs-defaults"],
322
323     srcs: [
324         "e2freefrag.c",
325     ],
326     header_libs: ["libext2-headers"],
327     shared_libs: [
328         "libext2fs",
329         "libext2_com_err",
330     ],
331     system_shared_libs: ["libc", "libdl"],
332 }