• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_libusb_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//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23// See: http://go/android-license-faq
24license {
25    name: "external_libusb_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-GPL",
29        "SPDX-license-identifier-LGPL",
30        "SPDX-license-identifier-LGPL-2.1",
31        "SPDX-license-identifier-LGPL-3.0",
32        "SPDX-license-identifier-MIT",
33    ],
34    license_text: [
35        "COPYING",
36        "NOTICE",
37    ],
38}
39
40cc_library {
41    name: "libusb",
42    host_supported: true,
43    vendor_available: true,
44
45    srcs: [
46        "libusb/core.c",
47        "libusb/descriptor.c",
48        "libusb/hotplug.c",
49        "libusb/io.c",
50        "libusb/sync.c",
51        "libusb/strerror.c",
52    ],
53
54    local_include_dirs: [
55        "libusb",
56        "libusb/os",
57    ],
58
59    cflags: [
60        "-Wall",
61        "-Wno-error=sign-compare",
62        "-Wno-error=switch",
63        "-Wno-error=unused-function",
64        "-Wno-unused-parameter",
65    ],
66
67    target: {
68        linux: {
69            srcs: [
70                "libusb/os/events_posix.c",
71                "libusb/os/linux_usbfs.c",
72                "libusb/os/threads_posix.c",
73                "libusb/os/linux_netlink.c",
74            ],
75        },
76
77        android: {
78            local_include_dirs: [
79                "android",
80            ],
81
82            cflags: ["-Werror"],
83        },
84
85        darwin: {
86            srcs: [
87                "libusb/os/events_posix.c",
88                "libusb/os/darwin_usb.c",
89                "libusb/os/threads_posix.c",
90            ],
91
92            local_include_dirs: [
93                "darwin",
94            ],
95
96            host_ldlibs: [
97                "-framework CoreFoundation",
98                "-framework IOKit",
99                "-lobjc"
100            ],
101
102            cflags: [
103                "-Wno-deprecated-declarations",
104                "-Wno-unguarded-availability",
105            ],
106        },
107
108        linux_glibc: {
109            local_include_dirs: [
110                "linux",
111            ],
112
113            cflags: ["-Werror"],
114        },
115
116        linux_bionic: {
117            local_include_dirs: [
118                "linux",
119            ],
120
121            cflags: ["-Werror"],
122        },
123
124        windows: {
125            srcs: [
126                "libusb/os/events_windows.c",
127                "libusb/os/threads_windows.c",
128                "libusb/os/windows_common.c",
129                "libusb/os/windows_usbdk.c",
130                "libusb/os/windows_winusb.c",
131            ],
132
133            local_include_dirs: [
134                "windows",
135            ],
136
137            cflags: [
138                "-Wno-error=pragma-pack",
139                "-Wno-error=missing-field-initializers",
140                "-Wno-error=ignored-attributes",
141            ],
142
143            enabled: true,
144        },
145    },
146
147    shared_libs: ["liblog"],
148    export_include_dirs: ["include"],
149}
150