xref: /aosp_15_r20/external/e2fsprogs/misc/Android.bp (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
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.
5package {
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
17cc_library {
18    name: "libext2_misc",
19    host_supported: true,
20    recovery_available: true,
21    vendor_available: true,
22    defaults: ["e2fsprogs-defaults"],
23
24    target: {
25        windows: {
26            enabled: true,
27        },
28    },
29
30    srcs: [
31        "create_inode.c",
32    ],
33    shared_libs: [
34        "libext2fs",
35        "libext2_com_err",
36        "libext2_quota",
37    ],
38    export_include_dirs: ["."],
39}
40
41//########################################################################
42// Build mke2fs
43
44cc_defaults {
45    name: "mke2fs_defaults",
46    defaults: ["e2fsprogs-defaults"],
47
48    srcs: [
49        "mke2fs.c",
50        "util.c",
51        "mk_hugefiles.c",
52        "default_profile.c",
53    ],
54    stl: "libc++_static",
55    include_dirs: ["external/e2fsprogs/e2fsck"],
56}
57
58cc_defaults {
59    name: "mke2fs_device_defaults",
60    defaults: ["mke2fs_defaults"],
61    target: {
62        android: {
63            required: [
64                "mke2fs.conf",
65            ],
66            shared_libs: [
67                "libext2fs",
68                "libext2_blkid",
69                "libext2_misc",
70                "libext2_uuid",
71                "libext2_quota",
72                "libext2_com_err",
73                "libext2_e2p",
74            ],
75            symlinks: [
76                "mkfs.ext2",
77                "mkfs.ext3",
78                "mkfs.ext4",
79            ],
80        },
81    },
82}
83
84cc_binary {
85    name: "mke2fs",
86    host_supported: true,
87    vendor_available: true,
88    defaults: ["mke2fs_device_defaults"],
89    target: {
90        host: {
91            static_libs: [
92                "libext2_blkid",
93                "libext2_misc",
94                "libext2_uuid",
95                "libext2_quota",
96                "libext2_com_err",
97                "libext2_e2p",
98                "libext2fs",
99                "libsparse",
100                "libbase",
101                "libz",
102            ],
103        },
104        not_windows: {
105            required: [
106                "mke2fs.conf",
107            ],
108        },
109        windows: {
110            ldflags: ["-static"],
111            enabled: true,
112        },
113    },
114}
115
116cc_binary {
117    name: "mke2fs.recovery",
118    defaults: ["mke2fs_device_defaults"],
119    recovery: true,
120    stem: "mke2fs",
121}
122
123cc_binary {
124    name: "mke2fs.microdroid",
125    defaults: ["mke2fs_defaults"],
126    recovery_available: true,
127    bootstrap: true,
128    target: {
129        android: {
130            required: [
131                "mke2fs.conf",
132            ],
133            shared_libs: [
134                "libext2fs",
135                "libext2_blkid",
136                "libext2_misc",
137                "libext2_uuid",
138                "libext2_quota",
139                "libext2_com_err",
140                "libext2_e2p",
141            ],
142            symlinks: ["mkfs.ext4.microdroid"],
143        },
144    },
145    no_full_install: true,
146    stem: "mke2fs",
147    visibility: ["//packages/modules/Virtualization/build/microdroid"],
148}
149
150//##########################################################################
151// Build tune2fs
152
153cc_defaults {
154    name: "tune2fs-defaults",
155    defaults: ["e2fsprogs-defaults"],
156    srcs: [
157        "tune2fs.c",
158        "util.c",
159    ],
160    cflags: ["-DNO_RECOVERY"],
161    include_dirs: ["external/e2fsprogs/e2fsck"],
162}
163
164tune2fs_libs = [
165    "libext2_blkid",
166    "libext2_com_err",
167    "libext2_quota",
168    "libext2_uuid",
169    "libext2_e2p",
170    "libext2fs",
171]
172
173cc_binary {
174    name: "tune2fs",
175    host_supported: true,
176    vendor_ramdisk_available: true,
177    defaults: ["tune2fs-defaults"],
178
179    shared_libs: tune2fs_libs,
180}
181
182cc_binary {
183    name: "tune2fs_static",
184    static_executable: true,
185    defaults: ["tune2fs-defaults"],
186
187    static_libs: tune2fs_libs,
188}
189
190cc_binary {
191    name: "tune2fs_ramdisk",
192    stem: "tune2fs",
193    static_executable: true,
194    ramdisk: true,
195    defaults: ["tune2fs-defaults"],
196    static_libs: tune2fs_libs,
197}
198
199cc_library_static {
200    name: "libtune2fs",
201    defaults: ["tune2fs-defaults"],
202
203    cflags: ["-DBUILD_AS_LIB"],
204    static_libs: tune2fs_libs,
205}
206
207//########################################################################
208// Build badblocks
209
210cc_binary_host {
211    name: "badblocks",
212    defaults: ["e2fsprogs-defaults"],
213
214    srcs: ["badblocks.c"],
215    shared_libs: [
216        "libext2fs",
217        "libext2_com_err",
218        "libext2_uuid",
219        "libext2_blkid",
220        "libext2_e2p",
221    ],
222}
223
224//########################################################################
225// Build chattr
226
227cc_binary {
228    name: "chattr-e2fsprogs",
229    host_supported: true,
230    defaults: ["e2fsprogs-defaults"],
231
232    srcs: ["chattr.c"],
233    shared_libs: [
234        "libext2_com_err",
235        "libext2_e2p",
236    ],
237}
238
239//########################################################################
240// Build lsattr
241
242cc_defaults {
243    name: "lsattr-defaults",
244    srcs: ["lsattr.c"],
245    defaults: ["e2fsprogs-defaults"],
246}
247
248lsattr_libs = [
249    "libext2_com_err",
250    "libext2_e2p",
251]
252
253cc_binary {
254    name: "lsattr-e2fsprogs",
255    host_supported: true,
256    defaults: ["lsattr-defaults"],
257
258    shared_libs: lsattr_libs,
259}
260
261cc_binary {
262    name: "lsattr_static",
263    static_executable: true,
264    defaults: ["lsattr-defaults"],
265
266    static_libs: lsattr_libs,
267}
268
269//########################################################################
270// Build blkid
271
272cc_binary {
273    name: "blkid",
274    host_supported: true,
275    defaults: ["e2fsprogs-defaults"],
276
277    srcs: ["blkid.c"],
278    shared_libs: [
279        "libext2fs",
280        "libext2_blkid",
281        "libext2_com_err",
282        "libext2_e2p",
283    ],
284}
285
286cc_binary {
287    name: "blkid_static",
288    host_supported: true,
289    static_executable: true,
290    defaults: ["e2fsprogs-defaults"],
291
292    srcs: ["blkid.c"],
293    static_libs: [
294        "libext2fs",
295        "libext2_blkid",
296        "libext2_com_err",
297        "libext2_e2p",
298        "libext2_uuid",
299    ],
300}
301
302//########################################################################
303// Build e4crypt
304
305cc_binary {
306    name: "e4crypt",
307    host_supported: true,
308    defaults: ["e2fsprogs-defaults"],
309
310    srcs: ["e4crypt.c"],
311    shared_libs: [
312        "libext2fs",
313        "libext2_uuid",
314    ],
315
316    target: {
317        darwin: {
318            enabled: false,
319        },
320    },
321}
322
323//##########################################################################
324// Build e2image
325
326cc_binary {
327    name: "e2image",
328    host_supported: true,
329    defaults: ["e2fsprogs-defaults"],
330
331    srcs: ["e2image.c"],
332    shared_libs: [
333        "libext2fs",
334        "libext2_blkid",
335        "libext2_com_err",
336        "libext2_quota",
337    ],
338}
339
340//##########################################################################
341// Build filefrag
342
343cc_binary {
344    name: "filefrag",
345    host_supported: true,
346    defaults: ["e2fsprogs-defaults"],
347
348    srcs: ["filefrag.c"],
349    shared_libs: [
350        "libext2fs",
351    ],
352}
353
354//##########################################################################
355// Build e2freefrag
356
357cc_binary {
358    name: "e2freefrag",
359    host_supported: true,
360    defaults: ["e2fsprogs-defaults"],
361
362    srcs: [
363        "e2freefrag.c",
364    ],
365    header_libs: ["libext2-headers"],
366    shared_libs: [
367        "libext2fs",
368        "libext2_com_err",
369    ],
370}
371