1// 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 15package { 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 58genrule { 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 66cc_library { 67 name: "libffi", 68 host_supported: true, 69 vendor_available: true, 70 cflags: [ 71 "-Wall", 72 "-Werror", 73 74 "-Wno-error=incompatible-pointer-types", 75 "-Wno-incompatible-pointer-types", 76 77 "-Wno-deprecated-declarations", 78 "-Wno-missing-field-initializers", 79 "-Wno-null-pointer-arithmetic", 80 "-Wno-pointer-arith", 81 "-Wno-sign-compare", 82 "-Wno-unused-parameter", 83 "-Wno-unused-result", 84 ], 85 local_include_dirs: ["include"], 86 generated_headers: ["ffi_header"], 87 export_generated_headers: ["ffi_header"], 88 srcs: [ 89 "src/closures.c", 90 "src/debug.c", 91 "src/java_raw_api.c", 92 "src/prep_cif.c", 93 "src/raw_api.c", 94 "src/types.c", 95 ], 96 arch: { 97 arm: { 98 srcs: [ 99 "src/arm/sysv.S", 100 "src/arm/ffi.c", 101 ], 102 export_include_dirs: ["linux-arm"], 103 }, 104 arm64: { 105 srcs: [ 106 "src/aarch64/sysv.S", 107 "src/aarch64/ffi.c", 108 ], 109 export_include_dirs: ["linux-arm64"], 110 }, 111 x86: { 112 srcs: [ 113 "src/x86/ffi.c", 114 "src/x86/sysv.S", 115 ], 116 asflags: [ 117 "-DHAVE_AS_X86_PCREL", 118 "-DHAVE_AS_ASCII_PSEUDO_OP", 119 ], 120 export_include_dirs: ["linux-x86"], 121 }, 122 x86_64: { 123 srcs: [ 124 "src/x86/ffi64.c", 125 "src/x86/ffiw64.c", 126 "src/x86/unix64.S", 127 "src/x86/win64.S", 128 ], 129 asflags: [ 130 "-DHAVE_AS_X86_PCREL", 131 "-DHAVE_AS_ASCII_PSEUDO_OP", 132 ], 133 export_include_dirs: ["linux-x86_64"], 134 }, 135 }, 136 apex_available: [ 137 "//apex_available:platform", 138 "com.android.virt", 139 ], 140} 141