1#
2# Copyright 2020 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17#
18# This makefile exports
19#
20# NATIVE_BRIDGE_PRODUCT_PACKAGES: Add this to PRODUCT_PACKAGES for your project to facilitate
21# native bridge support.
22#
23# NATIVE_BRIDGE_PRODUCT_PACKAGES_ARM: arm32-only product packages.
24#
25# NATIVE_BRIDGE_PRODUCT_PACKAGES_RISCV64_READY: products packages ready for riscv64 translation.
26# Currently same as NATIVE_BRIDGE_PRODUCT_PACKAGES excluding render script.
27#
28# NATIVE_BRIDGE_MODIFIED_GUEST_LIBS: List of modified guest libraries that require host counterpart.
29#
30
31# Note: keep in sync with `berberis_all_riscv64_to_x86_64_defaults` in
32#       frameworks/libs/binary_translation/Android.bp.
33NATIVE_BRIDGE_PRODUCT_PACKAGES := \
34    libnative_bridge_vdso.native_bridge \
35    native_bridge_guest_app_process.native_bridge \
36    native_bridge_guest_linker.native_bridge
37
38# TODO(b/141167717): using "bootstrap" to make APEX libraries compatible with native bridge:
39#
40# If library is APEX-enabled:
41#
42#   Then "libraryname" is not installed in the  /system/lib since it's
43#   supposed to be installed into APEX.
44#
45#   However, "libraryname.bootstrap" goes into /system/lib/bootstrap.
46#
47#   Native bridge isn't compatible with APEX yet thus "libraryname.native_bridge"
48#   is not installed anywhere at all.
49#
50#   However, "libraryname.bootstrap.native_bridge" gets installed into
51#   /system/lib/$GUEST_ARCH/ - as we need for native bridge.
52#
53# Note: this doesn't affect native libraries at all.
54#
55# These two libs cannot be built directly since they are not part of the official NDK,
56# but they are poperly built as the requirements for libicu.bootstrap:
57# libicui18n.bootstrap
58# libicuuc.bootstrap
59
60# Original guest libraries.
61# Note: keep in sync with `berberis_all_riscv64_to_x86_64_defaults` in
62#       frameworks/libs/binary_translation/Android.bp.
63NATIVE_BRIDGE_ORIG_GUEST_LIBS := \
64    libandroidicu.bootstrap \
65    libcompiler_rt \
66    libcrypto \
67    libcutils \
68    libdl.bootstrap \
69    libdl_android.bootstrap \
70    libicu.bootstrap \
71    liblog \
72    libm.bootstrap \
73    libsqlite \
74    libssl \
75    libstdc++ \
76    libsync \
77    libutils \
78    libz
79
80# These libraries need special support on the native bridge implementation side.
81# Note: keep in sync with `berberis_all_riscv64_to_x86_64_defaults` in
82#       frameworks/libs/binary_translation/Android.bp.
83NATIVE_BRIDGE_MODIFIED_GUEST_LIBS := \
84    libaaudio \
85    libamidi \
86    libandroid \
87    libandroid_runtime \
88    libbinder_ndk \
89    libc \
90    libcamera2ndk \
91    libEGL \
92    libGLESv1_CM \
93    libGLESv2 \
94    libGLESv3 \
95    libjnigraphics \
96    libmediandk \
97    libnativehelper \
98    libnativewindow \
99    libneuralnetworks \
100    libOpenMAXAL \
101    libOpenSLES \
102    libvulkan \
103    libwebviewchromium_plat_support
104
105# Original guest libraries are built for native_bridge
106NATIVE_BRIDGE_PRODUCT_PACKAGES += \
107    $(addsuffix .native_bridge,$(NATIVE_BRIDGE_ORIG_GUEST_LIBS))
108
109# Modified guest libraries are built for native_bridge and
110# have special build target prefix
111NATIVE_BRIDGE_PRODUCT_PACKAGES += \
112    $(addprefix libnative_bridge_guest_,$(addsuffix .native_bridge,$(NATIVE_BRIDGE_MODIFIED_GUEST_LIBS)))
113
114# TODO(b/277625560): Deprecate after we deside what to do with renderscript
115NATIVE_BRIDGE_PRODUCT_PACKAGES_RISCV64_READY := $(NATIVE_BRIDGE_PRODUCT_PACKAGES)
116
117# Renderscript specific files/libraries
118NATIVE_BRIDGE_PRODUCT_PACKAGES += \
119    libclcore.bc
120
121# libclcore_neon.bc is arm32 only.
122NATIVE_BRIDGE_PRODUCT_PACKAGES_ARM := \
123    libclcore_neon.bc
124
125NATIVE_BRIDGE_RS_ORIG_GUEST_LIBS += \
126    libRS \
127    libRSDriver \
128    libnative_bridge_guest_libRSSupport
129
130NATIVE_BRIDGE_PRODUCT_PACKAGES += \
131    $(addsuffix .native_bridge,$(NATIVE_BRIDGE_RS_ORIG_GUEST_LIBS))
132
133NATIVE_BRIDGE_ORIG_GUEST_LIBS :=
134NATIVE_BRIDGE_RS_ORIG_GUEST_LIBS :=
135