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