• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 The Android Open Source Project
2
3package {
4    default_applicable_licenses: ["external_f2fs-tools_license"],
5}
6
7// Added automatically by a large-scale-change that took the approach of
8// 'apply every license found to every target'. While this makes sure we respect
9// every license restriction, it may not be entirely correct.
10//
11// e.g. GPL in an MIT project might only apply to the contrib/ directory.
12//
13// Please consider splitting the single license below into multiple licenses,
14// taking care not to lose any license_kind information, and overriding the
15// default license using the 'licenses: [...]' property on targets as needed.
16//
17// For unused files, consider creating a 'fileGroup' with "//visibility:private"
18// to attach the license to, and including a comment whether the files may be
19// used in the current project.
20//
21// large-scale-change included anything that looked like it might be a license
22// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
23//
24// Please consider removing redundant or irrelevant files from 'license_text:'.
25// See: http://go/android-license-faq
26license {
27    name: "external_f2fs-tools_license",
28    visibility: [":__subpackages__"],
29    license_kinds: [
30        "SPDX-license-identifier-BSD",
31        "SPDX-license-identifier-GPL",
32        "SPDX-license-identifier-GPL-2.0",
33        "SPDX-license-identifier-LGPL",
34        "SPDX-license-identifier-LGPL-2.1",
35    ],
36    license_text: [
37        "COPYING",
38        "NOTICE",
39    ],
40}
41
42cc_defaults {
43    name: "f2fs-tools-defaults",
44    cflags: [
45        "-DF2FS_MAJOR_VERSION=1",
46        "-DF2FS_MINOR_VERSION=16",
47        "-DF2FS_TOOLS_VERSION=\"1.16.0\"",
48        "-DF2FS_TOOLS_DATE=\"2023-04-11\"",
49        "-DWITH_ANDROID",
50        "-Wall",
51        "-Werror",
52        "-Wno-macro-redefined",
53        "-Wno-missing-field-initializers",
54        "-Wno-pointer-arith",
55        "-Wno-sign-compare",
56    ],
57    local_include_dirs: [
58        "include",
59        "mkfs",
60        "fsck",
61    ],
62    target: {
63        windows: {
64            enabled: false,
65        },
66    },
67}
68
69cc_defaults {
70    name: "libf2fs_src_files",
71    cflags: ["-DWITH_BLKDISCARD"],
72    srcs: [
73        "lib/libf2fs.c",
74        "mkfs/f2fs_format.c",
75        "mkfs/f2fs_format_utils.c",
76        "lib/libf2fs_zoned.c",
77        "lib/nls_utf8.c",
78    ],
79    static_libs: [
80        "libext2_uuid",
81    ],
82}
83
84cc_defaults {
85    name: "make_f2fs_src_files",
86    srcs: [
87        "lib/libf2fs_io.c",
88        "mkfs/f2fs_format_main.c",
89    ],
90}
91
92cc_defaults {
93    name: "fsck_main_src_files",
94    srcs: [
95        "fsck/dir.c",
96        "fsck/dict.c",
97        "fsck/mkquota.c",
98        "fsck/quotaio.c",
99        "fsck/quotaio_tree.c",
100        "fsck/quotaio_v2.c",
101        "fsck/node.c",
102        "fsck/segment.c",
103        "fsck/xattr.c",
104        "fsck/main.c",
105        "fsck/mount.c",
106        "lib/libf2fs.c",
107        "lib/libf2fs_io.c",
108        "lib/libf2fs_zoned.c",
109        "lib/nls_utf8.c",
110        "fsck/dump.c",
111    ],
112}
113
114cc_library_static {
115    name: "libf2fs_fmt",
116    recovery_available: true,
117    defaults: [
118        "f2fs-tools-defaults",
119        "libf2fs_src_files"
120    ],
121}
122
123cc_library_host_static {
124    name: "libf2fs_fmt_host",
125    defaults: [
126        "f2fs-tools-defaults",
127        "libf2fs_src_files"
128    ],
129    target: {
130        windows: {
131            include_dirs: [ "external/e2fsprogs/include/mingw" ],
132            cflags: [
133                "-DANDROID_WINDOWS_HOST",
134                "-Wno-typedef-redefinition",
135                "-Wno-unused-parameter",
136            ],
137            enabled: true
138        },
139    },
140}
141
142cc_defaults {
143    name: "make_f2fs_defaults",
144    defaults: [
145        "f2fs-tools-defaults",
146        "make_f2fs_src_files",
147    ],
148    host_supported: true,
149    recovery_available: true,
150    target: {
151        android: {
152            static_libs: [
153                "libf2fs_fmt",
154            ],
155            shared_libs: [
156                "libext2_uuid",
157                "libsparse",
158                "libbase",
159            ],
160        },
161        host: {
162            static_libs: [
163                "libf2fs_fmt_host",
164                "libext2_uuid",
165                "libsparse",
166                "libbase",
167                "libz",
168            ],
169        },
170        windows: {
171            include_dirs: [ "external/e2fsprogs/include/mingw" ],
172            cflags: ["-DANDROID_WINDOWS_HOST"],
173            ldflags: ["-static"],
174            host_ldlibs: ["-lws2_32"],
175            enabled: true
176        },
177    },
178}
179
180cc_binary {
181    name: "make_f2fs",
182    defaults: [
183        "make_f2fs_defaults",
184    ],
185}
186
187cc_binary_host {
188    name: "make_f2fs_casefold",
189    defaults: [
190        "make_f2fs_defaults",
191    ],
192    target: {
193        host: {
194            cflags: ["-DCONF_CASEFOLD", "-DCONF_PROJID"],
195        },
196        windows: {
197            cflags: ["-DCONF_CASEFOLD", "-DCONF_PROJID"],
198        },
199    },
200}
201
202cc_binary_host {
203    name: "make_f2fs.static",
204    defaults: [
205        "make_f2fs_defaults",
206    ],
207    static_executable: true,
208    stl: "libc++_static",
209}
210
211cc_binary {
212    name: "fsck.f2fs",
213    defaults: [
214        "f2fs-tools-defaults",
215        "fsck_main_src_files",
216    ],
217    host_supported: true,
218    recovery_available: true,
219    cflags: ["-DWITH_RESIZE", "-DWITH_DEFRAG", "-DWITH_DUMP"],
220    srcs: ["fsck/fsck.c", "fsck/resize.c", "fsck/defrag.c"],
221    shared_libs: [
222        "libext2_uuid",
223        "libsparse",
224        "libbase",
225    ],
226    symlinks: ["resize.f2fs", "defrag.f2fs", "dump.f2fs"],
227    vendor_ramdisk_available: true,
228}
229
230cc_binary {
231    name: "sload_f2fs",
232    defaults: [
233        "f2fs-tools-defaults",
234        "fsck_main_src_files",
235    ],
236    host_supported: true,
237    recovery_available: true,
238    cflags: ["-DWITH_SLOAD"],
239    srcs: [
240        "fsck/fsck.c",
241        "fsck/sload.c",
242        "fsck/compress.c",
243        ],
244    target: {
245        android: {
246            shared_libs: [
247                "libext2_uuid",
248                "libsparse",
249                "libbase",
250                "libcrypto",
251                "libselinux",
252                "libcutils",
253                "liblog",
254                "liblz4",
255            ],
256        },
257        host: {
258            static_libs: [
259                "libext2_uuid",
260                "libsparse",
261                "libbase",
262                "libcrypto",
263                "libselinux",
264                "libcutils",
265                "liblog",
266                "libz",
267                "liblz4",
268            ],
269        },
270    },
271    stl: "libc++_static",
272}
273
274cc_binary {
275    name: "check_f2fs",
276    host_supported: false,
277    cflags: [
278        "--static",
279        "-U_FORTIFY_SOURCE",
280	"-Wall",
281	"-Werror",
282    ],
283    srcs: ["tools/check_f2fs.c"],
284    product_specific: true,
285}
286
287cc_defaults {
288    name: "tools-defaults",
289    cflags: [
290	"-Wall",
291	"-Werror",
292    ],
293    local_include_dirs: [
294        "include",
295    ],
296    target: {
297        windows: {
298            enabled: false,
299        },
300        darwin: {
301            enabled: false,
302        },
303    },
304    product_specific: true,
305}
306
307cc_binary {
308    name: "f2fscrypt",
309    defaults: [
310        "tools-defaults",
311    ],
312    shared_libs: [
313        "libext2_uuid",
314    ],
315    srcs: [
316        "tools/f2fscrypt.c",
317        "tools/sha512.c",
318    ],
319}
320
321cc_binary {
322    name: "f2fs.fibmap",
323    defaults: [
324        "tools-defaults",
325    ],
326    srcs: [
327        "tools/fibmap.c",
328    ],
329}
330