blob: 32c473b3331dee864a9ceed0f8f2beadaa472a89 [file] [log] [blame]
Garfield Tan51060f92017-10-11 10:39:03 -07001// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badourda05a0f2021-02-12 19:50:01 -080015package {
16 default_applicable_licenses: ["external_libffi_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32//
33// large-scale-change included anything that looked like it might be a license
34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
35//
36// Please consider removing redundant or irrelevant files from 'license_text:'.
37// See: http://go/android-license-faq
38license {
39 name: "external_libffi_license",
40 visibility: [":__subpackages__"],
41 license_kinds: [
42 "SPDX-license-identifier-Apache-2.0",
43 "SPDX-license-identifier-GPL",
44 "SPDX-license-identifier-GPL-2.0",
45 "SPDX-license-identifier-GPL-3.0",
46 "SPDX-license-identifier-LGPL",
47 "SPDX-license-identifier-LGPL-2.1",
48 "SPDX-license-identifier-MIT",
49 "SPDX-license-identifier-MPL",
50 "legacy_unencumbered",
51 ],
52 license_text: [
53 "LICENSE",
54 "LICENSE-BUILDTOOLS",
55 ],
56}
57
Garfield Tan51060f92017-10-11 10:39:03 -070058genrule {
59 name: "ffi_header",
60 cmd: "$(location gen_ffi_header.sh) < $(in) > $(out)",
61 srcs: ["include/ffi.h.in"],
62 out: ["ffi_gen.h"],
63 tool_files: ["gen_ffi_header.sh"],
64}
65
Stephen Hines1b454c42020-08-06 08:25:43 -070066cc_library {
Garfield Tan51060f92017-10-11 10:39:03 -070067 name: "libffi",
Ivan Lozano60c5e002019-08-05 10:20:26 -070068 host_supported: true,
Ben Linc82cc182018-04-25 10:33:27 -070069 vendor_available: true,
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070070 cflags: [
71 "-Wall",
72 "-Werror",
Elliott Hughesc3184992020-03-26 14:21:32 -070073
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070074 "-Wno-error=incompatible-pointer-types",
Dan Willemsen46504e92019-10-22 17:58:27 -070075 "-Wno-incompatible-pointer-types",
Elliott Hughesc3184992020-03-26 14:21:32 -070076
77 "-Wno-deprecated-declarations",
78 "-Wno-missing-field-initializers",
Dan Willemsen46504e92019-10-22 17:58:27 -070079 "-Wno-null-pointer-arithmetic",
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070080 "-Wno-pointer-arith",
81 "-Wno-sign-compare",
82 "-Wno-unused-parameter",
Dan Willemsen46504e92019-10-22 17:58:27 -070083 "-Wno-unused-result",
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070084 ],
Garfield Tan51060f92017-10-11 10:39:03 -070085 local_include_dirs: ["include"],
86 generated_headers: ["ffi_header"],
87 export_generated_headers: ["ffi_header"],
88 srcs: [
Dan Willemsen46504e92019-10-22 17:58:27 -070089 "src/closures.c",
Garfield Tan51060f92017-10-11 10:39:03 -070090 "src/debug.c",
91 "src/java_raw_api.c",
92 "src/prep_cif.c",
93 "src/raw_api.c",
94 "src/types.c",
95 ],
Garfield Tan51060f92017-10-11 10:39:03 -070096 arch: {
97 arm: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070098 srcs: [
99 "src/arm/sysv.S",
100 "src/arm/ffi.c",
101 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700102 export_include_dirs: ["linux-arm"],
103 },
Garfield Tan872ed7e2017-10-17 11:13:15 -0700104 arm64: {
105 srcs: [
106 "src/aarch64/sysv.S",
107 "src/aarch64/ffi.c",
108 ],
109 export_include_dirs: ["linux-arm64"],
110 },
Garfield Tan51060f92017-10-11 10:39:03 -0700111 x86: {
Garfield Tan872ed7e2017-10-17 11:13:15 -0700112 srcs: [
113 "src/x86/ffi.c",
114 "src/x86/sysv.S",
Garfield Tan872ed7e2017-10-17 11:13:15 -0700115 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700116 asflags: [
117 "-DHAVE_AS_X86_PCREL",
118 "-DHAVE_AS_ASCII_PSEUDO_OP",
119 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700120 export_include_dirs: ["linux-x86"],
121 },
122 x86_64: {
Garfield Tan872ed7e2017-10-17 11:13:15 -0700123 srcs: [
124 "src/x86/ffi64.c",
Elliott Hughesc3184992020-03-26 14:21:32 -0700125 "src/x86/ffiw64.c",
Garfield Tan872ed7e2017-10-17 11:13:15 -0700126 "src/x86/unix64.S",
Elliott Hughesc3184992020-03-26 14:21:32 -0700127 "src/x86/win64.S",
Garfield Tan872ed7e2017-10-17 11:13:15 -0700128 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700129 asflags: [
130 "-DHAVE_AS_X86_PCREL",
131 "-DHAVE_AS_ASCII_PSEUDO_OP",
132 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700133 export_include_dirs: ["linux-x86_64"],
134 },
135 },
Jiyong Park7d2db952020-12-07 15:09:07 +0900136 apex_available: [
137 "//apex_available:platform",
138 "com.android.virt",
139 ],
Garfield Tan51060f92017-10-11 10:39:03 -0700140}