xref: /aosp_15_r20/external/gptfdisk/Android.bp (revision 57696d54d05c64fd1b1787f8371dbcf104911cfb)
1package {
2    default_applicable_licenses: ["external_gptfdisk_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20    name: "external_gptfdisk_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-GPL",
24        "SPDX-license-identifier-GPL-2.0",
25        "SPDX-license-identifier-LGPL",
26    ],
27    license_text: [
28        "COPYING",
29    ],
30}
31
32cc_defaults {
33    name: "gptfdisk_default_flags",
34    cflags: [
35        "-Wno-unused-parameter",
36        "-Wno-macro-redefined",
37        "-Wno-pragma-pack",
38        "-Werror",
39        "-fPIC",
40        "-D_FILE_OFFSET_BITS=64",
41    ],
42    // This project requires _FILE_OFFSET_BITS=64, which isn't globally
43    // true for 32-bit Android builds. It's safe here because the libraries
44    // built by this build file aren't exported. If that changes, you'll
45    // need to come up with a plan (probably either upstreaming better 32-bit
46    // support, or waiting until we no longer support 32-bit either).
47    visibility: [":__subpackages__"],
48}
49
50cc_binary {
51    name: "sgdisk",
52    defaults: ["gptfdisk_default_flags"],
53    host_supported: true,
54
55    srcs: [
56        "sgdisk.cc",
57    ],
58
59    shared_libs: ["libext2_uuid"],
60    static_libs: ["libgptf"],
61    visibility: ["//visibility:any_system_partition"],
62}
63
64lib_common_srcs = [
65    "gptcl.cc",
66    "crc32.cc",
67    "support.cc",
68    "guid.cc",
69    "gptpart.cc",
70    "mbrpart.cc",
71    "basicmbr.cc",
72    "mbr.cc",
73    "gpt.cc",
74    "bsd.cc",
75    "parttypes.cc",
76    "attributes.cc",
77    "diskio.cc",
78    "android_popt.cc",
79]
80
81cc_library_static {
82    name: "libgptf",
83    defaults: ["gptfdisk_default_flags"],
84    host_supported: true,
85
86    export_include_dirs: ["."],
87    srcs: lib_common_srcs + ["diskio-unix.cc"],
88
89    shared_libs: ["libext2_uuid"],
90}
91
92cc_library_static {
93    name: "libgptf_fuzzer_lib",
94    defaults: ["gptfdisk_default_flags"],
95    host_supported: true,
96
97    export_include_dirs: ["."],
98    srcs: lib_common_srcs + ["diskio-heap.cc"],
99    cflags: ["-DENABLE_HEAP_DISKIO"],
100
101    shared_libs: ["libext2_uuid"],
102}
103