Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 1 | // Copyright (C) 2007 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 | |
| 15 | // |
| 16 | // Definitions for building the native code needed for the core library. |
| 17 | // |
| 18 | |
| 19 | // Defaults that apply to all of the modules |
| 20 | |
| 21 | cc_defaults { |
| 22 | name: "core_native_default_flags", |
| 23 | host_supported: true, |
| 24 | local_include_dirs: ["include"], |
| 25 | cflags: [ |
| 26 | "-Wall", |
| 27 | "-Wextra", |
| 28 | "-Werror", |
| 29 | ], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 30 | cppflags: ["-DU_USING_ICU_NAMESPACE=0"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 31 | |
| 32 | target: { |
| 33 | darwin: { |
| 34 | enabled: false, |
| 35 | }, |
| 36 | }, |
| 37 | } |
| 38 | |
| 39 | cc_defaults { |
| 40 | name: "core_native_default_libs", |
| 41 | static_libs: [ |
| 42 | "libbase", |
| 43 | "libfdlibm", |
| 44 | ], |
| 45 | |
| 46 | shared_libs: [ |
| 47 | "liblog", |
| 48 | "libnativehelper", |
| 49 | ], |
| 50 | } |
| 51 | |
| 52 | cc_library_shared { |
| 53 | name: "libjavacore", |
| 54 | defaults: [ |
| 55 | "core_native_default_flags", |
| 56 | "core_native_default_libs", |
| 57 | ], |
| 58 | srcs: [ |
| 59 | ":luni_native_srcs", |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 60 | "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 61 | ], |
| 62 | |
| 63 | shared_libs: [ |
| 64 | "libcrypto", |
| 65 | "libexpat", |
| 66 | "libicuuc", |
| 67 | "libicui18n", |
| 68 | "libnativehelper", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 69 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 70 | ], |
| 71 | static_libs: [ |
| 72 | "libziparchive", |
| 73 | "libbase", |
| 74 | ], |
| 75 | target: { |
| 76 | android: { |
| 77 | shared_libs: [ |
| 78 | "libutils", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 79 | ], |
| 80 | }, |
| 81 | }, |
| 82 | } |
| 83 | |
| 84 | cc_defaults { |
| 85 | name: "libopenjdk_native_defaults", |
| 86 | defaults: [ |
| 87 | "core_native_default_flags", |
| 88 | "core_native_default_libs", |
| 89 | ], |
| 90 | srcs: [":libopenjdk_native_srcs"], |
| 91 | cflags: [ |
| 92 | // TODO(narayan): Prune down this list of exclusions once the underlying |
| 93 | // issues have been fixed. Most of these are small changes except for |
| 94 | // -Wunused-parameter. |
| 95 | "-Wno-unused-parameter", |
| 96 | "-Wno-unused-variable", |
| 97 | "-Wno-parentheses-equality", |
| 98 | "-Wno-constant-logical-operand", |
| 99 | "-Wno-sometimes-uninitialized", |
| 100 | |
| 101 | // TODO(http://b/64362645): remove when upstream replaces readdir_r with readdir. |
| 102 | "-Wno-deprecated-declarations", |
| 103 | ], |
| 104 | |
| 105 | shared_libs: [ |
| 106 | "libcrypto", |
| 107 | "libicuuc", |
| 108 | "libssl", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 109 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 110 | |
| 111 | "libnativehelper", |
| 112 | ], |
| 113 | static_libs: ["libfdlibm"], |
| 114 | |
| 115 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 116 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 117 | cflags: [ // Sigh. |
| 118 | "-D_LARGEFILE64_SOURCE", |
| 119 | "-D_GNU_SOURCE", |
| 120 | "-DLINUX", |
| 121 | "-D__GLIBC__", |
| 122 | ], |
| 123 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 124 | }, |
| 125 | |
| 126 | notice: "ojluni/NOTICE", |
| 127 | } |
| 128 | |
| 129 | cc_library_shared { |
| 130 | name: "libopenjdk", |
| 131 | defaults: ["libopenjdk_native_defaults"], |
| 132 | shared_libs: [ |
| 133 | "libopenjdkjvm", |
| 134 | ], |
| 135 | } |
| 136 | |
| 137 | // Debug version of libopenjdk. Depends on libopenjdkjvmd. |
| 138 | cc_library_shared { |
| 139 | name: "libopenjdkd", |
| 140 | defaults: ["libopenjdk_native_defaults"], |
| 141 | shared_libs: [ |
| 142 | "libopenjdkjvmd", |
| 143 | ], |
| 144 | } |
| 145 | |
| 146 | // Test JNI library. |
| 147 | cc_library_shared { |
| 148 | name: "libjavacoretests", |
| 149 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 150 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 151 | |
| 152 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 153 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 154 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 155 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 156 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 157 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 158 | ], |
| 159 | target: { |
| 160 | android: { |
| 161 | shared_libs: ["libnativehelper_compat_libc++"], |
| 162 | }, |
| 163 | host: { |
| 164 | shared_libs: ["libnativehelper"], |
| 165 | }, |
| 166 | }, |
| 167 | |
| 168 | strip: { |
| 169 | keep_symbols: true, |
| 170 | }, |
| 171 | } |
| 172 | |
| 173 | // Set of gtest unit tests. |
| 174 | cc_test { |
| 175 | name: "libjavacore-unit-tests", |
| 176 | defaults: ["core_native_default_flags"], |
| 177 | |
| 178 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 179 | // memcpy calls that are not really aligned. |
| 180 | cflags: ["-fno-builtin"], |
| 181 | srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], |
| 182 | |
| 183 | shared_libs: ["libnativehelper"], |
| 184 | } |
| 185 | |
| 186 | // Set of benchmarks for libjavacore functions. |
| 187 | cc_benchmark { |
| 188 | name: "libjavacore-benchmarks", |
| 189 | defaults: ["core_native_default_flags"], |
| 190 | |
| 191 | srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], |
| 192 | test_suites: ["device-tests"], |
| 193 | |
| 194 | shared_libs: ["libnativehelper"], |
| 195 | } |
| 196 | |
| 197 | subdirs = [ |
| 198 | "luni/src/main/native", |
| 199 | "ojluni/src/main/native", |
| 200 | ] |