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.
5cc_library {
6    name: "libext2_misc",
7    host_supported: true,
8    recovery_available: true,
9    defaults: ["e2fsprogs-defaults"],
10
11    target: {
12        windows: {
13            include_dirs: [ "external/e2fsprogs/include/mingw" ],
14            enabled: true,
15            cflags: ["-Wno-unused-variable"],
16        },
17    },
18
19    srcs: [
20        "create_inode.c",
21    ],
22    cflags: ["-Wno-error=format-extra-args"],
23    shared_libs: [
24        "libext2fs",
25        "libext2_com_err",
26        "libext2_quota",
27    ],
28    system_shared_libs: ["libc", "libdl"],
29    export_include_dirs: ["."],
30}
31
32//########################################################################
33// Build mke2fs
34
35cc_binary {
36    name: "mke2fs",
37    host_supported: true,
38    recovery_available: true,
39    defaults: ["e2fsprogs-defaults"],
40
41    srcs: [
42        "mke2fs.c",
43        "util.c",
44        "mk_hugefiles.c",
45        "default_profile.c",
46    ],
47    cflags: [
48        "-Wno-error=format",
49        "-Wno-error=type-limits",
50        "-Wno-format-extra-args",
51    ],
52    target: {
53        host: {
54            static_libs: [
55                "libext2_blkid",
56                "libext2_misc",
57                "libext2_uuid",
58                "libext2_quota",
59                "libext2_com_err",
60                "libext2_e2p",
61                "libext2fs",
62                "libsparse",
63                "libbase",
64                "libz",
65            ],
66        },
67        not_windows: {
68            required: [
69                "mke2fs.conf",
70            ],
71        },
72        windows: {
73            include_dirs: [ "external/e2fsprogs/include/mingw" ],
74            cflags: [
75                "-D_POSIX",
76                "-D__USE_MINGW_ALARM",
77                // mke2fs.c has a warning from gcc which cannot be suppressed:
78                // passing argument 3 of 'ext2fs_get_device_size' from
79                // incompatible pointer type
80                "-Wno-error"
81            ],
82            ldflags: ["-static"],
83            host_ldlibs: ["-lws2_32"],
84            enabled: true
85        },
86        android: {
87            required: [
88                "mke2fs.conf",
89            ],
90            shared_libs: [
91                "libext2fs",
92                "libext2_blkid",
93                "libext2_misc",
94                "libext2_uuid",
95                "libext2_quota",
96                "libext2_com_err",
97                "libext2_e2p",
98            ],
99            symlinks: ["mkfs.ext2", "mkfs.ext3", "mkfs.ext4"],
100        },
101    },
102    stl: "libc++_static",
103    include_dirs: ["external/e2fsprogs/e2fsck"],
104}
105
106//##########################################################################
107// Build tune2fs
108
109cc_defaults {
110    name: "tune2fs-defaults",
111    defaults: ["e2fsprogs-defaults"],
112    srcs: [
113        "tune2fs.c",
114        "util.c",
115    ],
116    cflags: ["-DNO_RECOVERY"],
117    include_dirs: ["external/e2fsprogs/e2fsck"],
118}
119
120tune2fs_libs = [
121    "libext2_blkid",
122    "libext2_com_err",
123    "libext2_quota",
124    "libext2_uuid",
125    "libext2_e2p",
126    "libext2fs",
127]
128
129cc_binary {
130    name: "tune2fs",
131    host_supported: true,
132    defaults: ["tune2fs-defaults"],
133
134    shared_libs: tune2fs_libs,
135    system_shared_libs: ["libc", "libdl"],
136}
137
138cc_binary {
139    name: "tune2fs_static",
140    static_executable: true,
141    defaults: ["tune2fs-defaults"],
142
143    static_libs: tune2fs_libs,
144}
145
146cc_library_static {
147    name: "libtune2fs",
148    defaults: ["tune2fs-defaults"],
149
150    cflags: ["-DBUILD_AS_LIB"],
151    static_libs: tune2fs_libs,
152}
153
154//########################################################################
155// Build badblocks
156
157cc_binary {
158    name: "badblocks",
159    host_supported: true,
160    defaults: ["e2fsprogs-defaults"],
161
162    srcs: ["badblocks.c"],
163    shared_libs: [
164        "libext2fs",
165        "libext2_com_err",
166        "libext2_uuid",
167        "libext2_blkid",
168        "libext2_e2p",
169    ],
170    system_shared_libs: ["libc", "libdl"],
171}
172
173//########################################################################
174// Build chattr
175
176cc_binary {
177    name: "chattr",
178    host_supported: true,
179    defaults: ["e2fsprogs-defaults"],
180
181    srcs: ["chattr.c"],
182    shared_libs: [
183        "libext2_com_err",
184        "libext2_e2p",
185    ],
186    system_shared_libs: ["libc", "libdl"],
187}
188
189//########################################################################
190// Build lsattr
191
192cc_defaults {
193    name: "lsattr-defaults",
194    srcs: ["lsattr.c"],
195    defaults: ["e2fsprogs-defaults"],
196}
197
198lsattr_libs = [
199    "libext2_com_err",
200    "libext2_e2p",
201]
202
203cc_binary {
204    name: "lsattr",
205    host_supported: true,
206    defaults: ["lsattr-defaults"],
207
208    shared_libs: lsattr_libs,
209    system_shared_libs: ["libc", "libdl"],
210}
211
212cc_binary {
213    name: "lsattr_static",
214    static_executable: true,
215    defaults: ["lsattr-defaults"],
216
217    static_libs: lsattr_libs,
218}
219
220//########################################################################
221// Build blkid
222
223cc_binary {
224    name: "blkid",
225    defaults: ["e2fsprogs-defaults"],
226
227    srcs: ["blkid.c"],
228    shared_libs: [
229        "libext2fs",
230        "libext2_blkid",
231        "libext2_com_err",
232        "libext2_e2p",
233    ],
234    system_shared_libs: ["libc", "libdl"],
235}
236
237//########################################################################
238// Build e4crypt
239
240cc_binary {
241    name: "e4crypt",
242    host_supported: true,
243    defaults: ["e2fsprogs-defaults"],
244
245    srcs: ["e4crypt.c"],
246    shared_libs: [
247        "libext2fs",
248        "libext2_uuid",
249    ],
250    system_shared_libs: ["libc", "libdl"],
251
252    target: {
253        darwin: {
254            enabled: false,
255        },
256    },
257}
258
259//##########################################################################
260// Build e2image
261
262cc_binary {
263    name: "e2image",
264    host_supported: true,
265    defaults: ["e2fsprogs-defaults"],
266
267    srcs: ["e2image.c"],
268    shared_libs: [
269        "libext2fs",
270        "libext2_blkid",
271        "libext2_com_err",
272        "libext2_quota",
273    ],
274    system_shared_libs: ["libc", "libdl"],
275}
276
277//##########################################################################
278// Build filefrag
279
280cc_binary {
281    name: "filefrag",
282    host_supported: true,
283    defaults: ["e2fsprogs-defaults"],
284
285    srcs: ["filefrag.c"],
286    shared_libs: [
287        "libext2fs",
288    ],
289    system_shared_libs: ["libc", "libdl"],
290}
291