• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2020 Gao Xiang
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_applicable_licenses: ["external_erofs-utils_license"],
18}
19
20// Added automatically by a large-scale-change that took the approach of
21// 'apply every license found to every target'. While this makes sure we respect
22// every license restriction, it may not be entirely correct.
23//
24// e.g. GPL in an MIT project might only apply to the contrib/ directory.
25//
26// Please consider splitting the single license below into multiple licenses,
27// taking care not to lose any license_kind information, and overriding the
28// default license using the 'licenses: [...]' property on targets as needed.
29//
30// For unused files, consider creating a 'fileGroup' with "//visibility:private"
31// to attach the license to, and including a comment whether the files may be
32// used in the current project.
33// See: http://go/android-license-faq
34license {
35    name: "external_erofs-utils_license",
36    visibility: [":__subpackages__"],
37    license_kinds: [
38        "SPDX-license-identifier-GPL",
39        "SPDX-license-identifier-GPL-2.0",
40        "SPDX-license-identifier-LGPL",
41    ],
42    license_text: [
43        "COPYING",
44    ],
45}
46
47genrule {
48    name: "erofs-utils-version.h",
49    srcs: ["VERSION"],
50    out: ["erofs-utils-version.h"],
51    cmd: "sed -n '1p' $(in) | tr -d '\n' | sed 's/\\(.*\\)/#define PACKAGE_VERSION \"\\1\"/' > $(out)",
52}
53
54cc_defaults {
55    name: "erofs-utils_export_defaults",
56
57    cflags: [
58        "-Wall",
59        "-Werror",
60        "-Wno-error=#warnings",
61        "-Wno-ignored-qualifiers",
62        "-Wno-pointer-arith",
63        "-Wno-unused-parameter",
64        "-Wno-unused-function",
65        "-DHAVE_FALLOCATE",
66        "-DHAVE_LINUX_TYPES_H",
67        "-DHAVE_LIBSELINUX",
68        "-DHAVE_LIBUUID",
69        "-DLZ4_ENABLED",
70        "-DLZ4HC_ENABLED",
71        "-DWITH_ANDROID",
72        "-DHAVE_MEMRCHR",
73        "-DHAVE_SYS_IOCTL_H",
74        "-DHAVE_LLISTXATTR",
75        "-DHAVE_LGETXATTR",
76        "-D_FILE_OFFSET_BITS=64",
77        "-DEROFS_MAX_BLOCK_SIZE=16384",
78    ],
79}
80
81cc_defaults {
82    name: "erofs-utils_defaults",
83    defaults: ["erofs-utils_export_defaults"],
84
85    cflags: [
86        "-include erofs-utils-version.h",
87    ],
88    local_include_dirs: [
89        "include",
90    ],
91    include_dirs: [
92        "external/e2fsprogs/lib/",
93    ],
94    generated_headers: ["erofs-utils-version.h"],
95    target: {
96        android: {
97            shared_libs: [
98                "libbase",
99                "libcutils",
100                "libext2_uuid",
101                "liblog",
102                "liblz4",
103                "libselinux",
104            ],
105        },
106        host: {
107            static_libs: [
108                "libbase",
109                "libcutils",
110                "libext2_uuid",
111                "liblog",
112                "liblz4",
113                "libselinux",
114            ],
115        },
116    },
117}
118
119cc_library {
120    host_supported: true,
121    recovery_available: true,
122    name: "liberofs",
123    defaults: ["erofs-utils_defaults"],
124    srcs: [
125        "lib/*.c",
126    ],
127    exclude_srcs: [
128        "lib/compressor_libdeflate.c",
129    ],
130    export_include_dirs: ["include"],
131
132    target: {
133        darwin: {
134            enabled: false,
135        },
136    },
137}
138
139cc_defaults {
140    name: "mkfs-erofs_defaults",
141
142    defaults: ["erofs-utils_defaults"],
143
144    srcs: [
145        "mkfs/*.c",
146    ],
147    static_libs: [
148        "liberofs",
149    ],
150
151    target: {
152        darwin: {
153            enabled: false,
154        },
155    },
156}
157
158cc_binary {
159    name: "mkfs.erofs",
160
161    defaults: ["mkfs-erofs_defaults"],
162    host_supported: true,
163    recovery_available: true,
164}
165
166cc_binary_host {
167    name: "make_erofs",
168
169    defaults: ["mkfs-erofs_defaults"],
170    stl: "libc++_static"
171}
172
173cc_binary {
174    name: "dump.erofs",
175    defaults: ["erofs-utils_defaults"],
176    host_supported: true,
177    recovery_available: true,
178    srcs: [
179        "dump/*.c",
180    ],
181    static_libs: [
182        "liberofs",
183    ],
184    target: {
185        darwin: {
186            enabled: false,
187        },
188    },
189}
190
191cc_binary {
192    name: "fsck.erofs",
193    defaults: ["erofs-utils_defaults"],
194    host_supported: true,
195    recovery_available: true,
196    srcs: [
197        "fsck/*.c",
198    ],
199    static_libs: [
200        "liberofs",
201    ],
202    target: {
203        darwin: {
204            enabled: false,
205        },
206    },
207}
208