1// Copyright (C) 2023 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
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_library_headers {
21    name: "libberberis_base_headers",
22    defaults: ["berberis_all_hosts_defaults"],
23    native_bridge_supported: true,
24    host_supported: true,
25    export_include_dirs: ["include"],
26    header_libs: ["libbase_headers"],
27    export_header_lib_headers: ["libbase_headers"],
28    arch: {
29        arm: {
30            enabled: true,
31        },
32        arm64: {
33            enabled: true,
34        },
35        riscv64: {
36            enabled: true,
37        },
38        x86: {
39            enabled: true,
40        },
41        x86_64: {
42            enabled: true,
43        },
44    },
45}
46
47cc_library_static {
48    name: "libberberis_base",
49    defaults: ["berberis_all_hosts_defaults"],
50    host_supported: true,
51    srcs: [
52        "config_globals.cc",
53        "config_globals_custom.cc",
54        "exec_region.cc",
55        "format_buffer.cc",
56        "large_mmap.cc",
57        "maps_snapshot.cc",
58        "mapped_file_fragment.cc",
59        "memfd_backed_mmap.cc",
60        "mmap_posix.cc",
61        "prctl_helpers.cc",
62        "tracing.cc",
63    ],
64    arch: {
65        arm64: {
66            srcs: ["raw_syscall_arm64.S"],
67        },
68        x86: {
69            srcs: ["raw_syscall_x86_32.S"],
70        },
71        x86_64: {
72            srcs: ["raw_syscall_x86_64.S"],
73        },
74        riscv64: {
75            srcs: ["raw_syscall_riscv64.S"],
76        },
77    },
78
79    header_libs: ["libberberis_base_headers"],
80    export_header_lib_headers: ["libberberis_base_headers"],
81}
82
83cc_test_library {
84    name: "libberberis_base_unit_tests",
85    defaults: ["berberis_test_library_defaults"],
86    srcs: [
87        "arena_test.cc",
88        "arena_zeroed_array_test.cc",
89        "bit_util_test.cc",
90        "forever_alloc_test.cc",
91        "forever_pool_test.cc",
92        "format_buffer_test.cc",
93        "lock_free_stack_test.cc",
94        "large_mmap_test.cc",
95        "maps_snapshot_test.cc",
96        "memfd_backed_mmap_test.cc",
97        "mmap_pool_test.cc",
98        "mmap_test.cc",
99        "pointer_and_counter_test.cc",
100    ],
101    header_libs: ["libberberis_base_headers"],
102}
103