xref: /aosp_15_r20/external/mesa3d/Android.bp (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1// Mesa 3-D graphics library
2//
3// Copyright (C) 2010-2011 Chia-I Wu <[email protected]>
4// Copyright (C) 2010-2011 LunarG Inc.
5//
6// Permission is hereby granted, free of charge, to any person obtaining a
7// copy of this software and associated documentation files (the "Software"),
8// to deal in the Software without restriction, including without limitation
9// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10// and/or sell copies of the Software, and to permit persons to whom the
11// Software is furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice shall be included
14// in all copies or substantial portions of the Software.
15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE.
23
24// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
25//     CONSULT THE OWNERS AND [email protected] BEFORE
26//     DEPENDING ON IT IN YOUR PROJECT. ***
27
28package {
29    default_applicable_licenses: ["external_mesa3d_license"],
30}
31
32// Added automatically by a large-scale-change that took the approach of
33// 'apply every license found to every target'. While this makes sure we respect
34// every license restriction, it may not be entirely correct.
35//
36// e.g. GPL in an MIT project might only apply to the contrib/ directory.
37//
38// Please consider splitting the single license below into multiple licenses,
39// taking care not to lose any license_kind information, and overriding the
40// default license using the 'licenses: [...]' property on targets as needed.
41//
42// For unused files, consider creating a 'fileGroup' with "//visibility:private"
43// to attach the license to, and including a comment whether the files may be
44// used in the current project.
45// See: http://go/android-license-faq
46license {
47    name: "external_mesa3d_license",
48    visibility: [":__subpackages__"],
49    license_kinds: [
50        "SPDX-license-identifier-Apache-2.0",
51        "SPDX-license-identifier-BSD",
52        "SPDX-license-identifier-BSL-1.0",
53        "SPDX-license-identifier-GPL",
54        "SPDX-license-identifier-GPL-2.0",
55        "SPDX-license-identifier-ISC",
56        "SPDX-license-identifier-MIT",
57        "SPDX-license-identifier-Unlicense",
58        "legacy_by_exception_only", // by exception only
59        "legacy_notice",
60        "legacy_unencumbered",
61    ],
62    license_text: [
63        "LICENSE",
64    ],
65}
66
67cc_defaults {
68    name: "mesa_version_defaults",
69    cflags: ["-DPACKAGE_VERSION=\"24.2\""],
70}
71
72python_binary_host {
73    name: "git_sha1_gen",
74    main: "bin/git_sha1_gen.py",
75    srcs: [
76        "bin/git_sha1_gen.py",
77    ],
78}
79
80genrule {
81    name: "git_sha1_header",
82    out: ["git_sha1.h"],
83    tools: ["git_sha1_gen"],
84    cmd: "python3 $(location git_sha1_gen) " +
85        "--output $(location git_sha1.h)",
86}
87
88cc_library_headers {
89    name: "mesa_common_headers",
90    vendor_available: true,
91    host_supported: true,
92    export_include_dirs: [
93        "src",
94        "include",
95    ],
96    cflags: [
97        "-DVK_USE_PLATFORM_ANDROID_KHR",
98    ],
99    visibility: [":__subpackages__"],
100}
101
102// This needs to be kept in sync with Android.common.mk
103cc_defaults {
104    name: "mesa_common_defaults",
105    defaults: ["mesa_version_defaults"],
106    // uncomment to keep the debug symbols
107    // strip: { none: true, },
108    header_libs: ["mesa_common_headers"],
109    cflags: [
110        "-Wno-error",
111        "-Werror=incompatible-pointer-types",
112        "-Wno-unused-parameter",
113        "-Wno-pointer-arith",
114        "-Wno-missing-field-initializers",
115        "-Wno-initializer-overrides",
116        "-Wno-mismatched-tags",
117        // PACKAGE_VERSION is in mesa_version_defaults
118        "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"",
119        // XXX: The following __STDC_*_MACROS defines should not be needed.
120        // It's likely due to a bug elsewhere, but let's temporarily add them
121        // here to fix the radeonsi build.
122        "-DENABLE_SHADER_CACHE",
123        "-D__STDC_CONSTANT_MACROS",
124        "-D__STDC_LIMIT_MACROS",
125        "-DHAVE___BUILTIN_EXPECT",
126        "-DHAVE___BUILTIN_FFS",
127        "-DHAVE___BUILTIN_FFSLL",
128        "-DHAVE_DLFCN_H",
129        "-DHAVE_FUNC_ATTRIBUTE_FLATTEN",
130        "-DHAVE_FUNC_ATTRIBUTE_UNUSED",
131        "-DHAVE_FUNC_ATTRIBUTE_FORMAT",
132        "-DHAVE_FUNC_ATTRIBUTE_PACKED",
133        "-DHAVE_FUNC_ATTRIBUTE_ALIAS",
134        "-DHAVE_FUNC_ATTRIBUTE_NORETURN",
135        "-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL",
136        "-DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT",
137        "-DHAVE___BUILTIN_CTZ",
138        "-DHAVE___BUILTIN_POPCOUNT",
139        "-DHAVE___BUILTIN_POPCOUNTLL",
140        "-DHAVE___BUILTIN_CLZ",
141        "-DHAVE___BUILTIN_CLZLL",
142        "-DHAVE___BUILTIN_UNREACHABLE",
143        "-DHAVE_PTHREAD=1",
144        "-DHAVE_DLADDR",
145        "-DHAVE_DL_ITERATE_PHDR",
146        "-DHAVE_LINUX_FUTEX_H",
147        "-DHAVE_ENDIAN_H",
148        "-DMAJOR_IN_SYSMACROS",
149        "-DVK_USE_PLATFORM_ANDROID_KHR",
150        "-fvisibility=hidden",
151        "-fno-math-errno",
152        "-fno-trapping-math",
153        "-Werror",
154        "-Wno-#warnings",
155        "-Wno-asm-operand-widths",
156        "-Wno-cast-calling-convention",
157        "-Wno-constant-logical-operand",
158        "-Wno-enum-conversion",
159        "-Wno-format",
160        "-Wno-gnu-variable-sized-type-not-at-end",
161        "-Wno-implicit-fallthrough",
162        "-Wno-implicit-int",
163        "-Wno-incompatible-pointer-types",
164        "-Wno-missing-braces",
165        "-Wno-overloaded-virtual",
166        "-Wno-self-assign",
167        "-Wno-shift-negative-value",
168        "-Wno-sign-compare",
169        "-Wno-sometimes-uninitialized",
170        "-Wno-switch",
171        "-Wno-typedef-redefinition",
172        "-Wno-uninitialized",
173        "-Wno-implicit-const-int-float-conversion",
174        "-Wno-sync-alignment",
175        "-Wno-implicit-function-declaration",
176        "-Wno-constant-conversion",
177        "-DHAVE_TIMESPEC_GET",
178        "-DHAVE_STRUCT_TIMESPEC",
179    ],
180    c_std: "c11",
181    cppflags: [
182        "-D__STDC_CONSTANT_MACROS",
183        "-D__STDC_FORMAT_MACROS",
184        "-D__STDC_LIMIT_MACROS",
185        "-Wno-error=non-virtual-dtor",
186        "-Wno-non-virtual-dtor",
187    ],
188    arch: {
189        arm: {
190            cflags: ["-DNO_FORMAT_ASM"],
191        },
192        arm64: {
193            cflags: ["-DNO_FORMAT_ASM"],
194        },
195    },
196    multilib: {
197        lib32: {
198            cflags: ["-DDEFAULT_DRIVER_DIR=\"/vendor/lib/dri\""],
199        },
200        lib64: {
201            cflags: ["-DDEFAULT_DRIVER_DIR=\"/vendor/lib64/dri\""],
202        },
203    },
204    product_variables: {
205        platform_sdk_version: {
206            cflags: ["-DANDROID_API_LEVEL=%d"],
207        },
208    },
209    target: {
210        host: {
211            cflags: [
212                "-D_GNU_SOURCE",
213                "-DHAVE_LIBDRM",
214                "-DHAVE_SECURE_GETENV",
215            ],
216            shared_libs: ["libdrm"],
217        },
218    },
219}
220