blob: e0ff1087103df887937037ef1ba2a5e3cc669fb0 [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=7
CROS_WORKON_COMMIT=("b05e4a6b92b2cfe608b6cd8d5d37168680fc080e" "e9ef20b988f629406f6a8d7fe22ae5f006abdbd2" "c1e30221aa92e7979cf0a0ee65914849db8b2dcb" "e2ccff249b3be3583ffb0e9be35db7be54715ec9" "08495901b78c7c3d9a1a81e541897c2ec114fe34" "f0356097d584b884e24b67c789b4800ec6895bd2" "83caf7c58917b971de049e882ec9b23816f12ca1" "59f317632862d15b59278a0235eb901270c2889d")
CROS_WORKON_TREE=("52a8a8b6d3bbca5e90d4761aa308a5541d52b1bb" "febb5c918e5047e2dd8a2bd416944894f76e41b3" "e7dba8c91c1f3257c34d4a7ffff0ea2537aeb6bb" "53a4656104a89df4072d3101327f51fcf6c9cbb2" "b4147760c8f1da9f6749f61748d2cacf89237717" "078088f837cd0a9b1c3123b5d93904f4ec2f2af6" "cbb1596cd3157db5ffe44d03d24c30cc9ed53e38" "6d3d9da9942b38f318bc49866e0dca5ffefd99c8" "95bef85dda5cf0836566c16c6b0651ae91cca7e2" "2ea48bccbe24f13f304b13776b86028ca6022818")
inherit cros-constants
CROS_WORKON_PROJECT=(
"chromiumos/platform2"
"aosp/platform/frameworks/native"
"aosp/platform/system/core/libcutils"
"aosp/platform/system/core/libutils"
"aosp/platform/system/libbase"
"aosp/platform/system/libfmq"
"aosp/platform/system/libhidl"
"aosp/platform/system/logging"
)
CROS_WORKON_REPO=(
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
"${CROS_GIT_HOST_URL}"
)
CROS_WORKON_LOCALNAME=(
"platform2"
"aosp/frameworks/native"
"aosp/system/core/libcutils"
"aosp/system/core/libutils"
"aosp/system/libbase"
"aosp/system/libfmq"
"aosp/system/libhidl"
"aosp/system/logging"
)
CROS_WORKON_DESTDIR=(
"${S}/platform2"
"${S}/platform2/aosp/frameworks/native"
"${S}/platform2/aosp/system/core/libcutils"
"${S}/platform2/aosp/system/core/libutils"
"${S}/platform2/aosp/system/libbase"
"${S}/platform2/aosp/system/libfmq"
"${S}/platform2/aosp/system/libhidl"
"${S}/platform2/aosp/system/logging"
)
CROS_WORKON_SUBTREE=(
"common-mk nnapi .gn"
""
""
""
""
""
""
""
)
PLATFORM_SUBDIR="nnapi"
inherit cros-workon platform
DESCRIPTION="Chrome OS support utils for Android Neural Network API"
HOMEPAGE="https://developer.android.com/ndk/guides/neuralnetworks"
LICENSE="BSD-Google Apache-2.0"
KEYWORDS="*"
IUSE=""
RDEPEND="
"
DEPEND="
${RDEPEND}
"
PATCHES=(
"${FILESDIR}/00001-libbase-fix-stderr-logging.patch"
"${FILESDIR}/00002-libhidl-callstack.patch"
"${FILESDIR}/00003-libutils-callstack.patch"
"${FILESDIR}/00004-libfmq-page-size.patch"
"${FILESDIR}/00005-libcutils-ashmemtests.patch"
"${FILESDIR}/00006-libhidl-cast-interface.patch"
"${FILESDIR}/00007-libbase-get-property-from-envvar.patch"
"${FILESDIR}/00008-libutils-memory-leak.patch"
)
src_prepare() {
# The workdir is platform2/nnapi - we need to pop up one level in the stack
# to apply our patches.
pushd .. || exit
eapply -p2 "${FILESDIR}/00001-libbase-fix-stderr-logging.patch"
eapply -p2 "${FILESDIR}/00002-libhidl-callstack.patch"
eapply -p2 "${FILESDIR}/00003-libutils-callstack.patch"
eapply -p2 "${FILESDIR}/00004-libfmq-page-size.patch"
eapply -p2 "${FILESDIR}/00005-libcutils-ashmemtests.patch"
eapply -p2 "${FILESDIR}/00006-libhidl-cast-interface.patch"
eapply -p2 "${FILESDIR}/00007-libbase-get-property-from-envvar.patch"
eapply -p2 "${FILESDIR}/00008-libutils-memory-leak.patch"
popd || exit
eapply_user
}
src_install() {
einfo "Installing Android headers."
insinto /usr/include/aosp
doins -r includes/*
doins -r ../aosp/frameworks/native/libs/arect/include/*
doins -r ../aosp/frameworks/native/libs/nativewindow/include/*
doins -r ../aosp/system/core/libcutils/include/*
doins -r ../aosp/system/core/libutils/include/*
doins -r ../aosp/system/libbase/include/*
doins -r ../aosp/system/libfmq/include/*
doins -r ../aosp/system/libfmq/base/*
doins -r ../aosp/system/libhidl/base/include/*
doins -r ../aosp/system/libhidl/libhidlmemory/include/*
doins -r ../aosp/system/logging/liblog/include/*
# Selectively install one off headers
insinto /usr/include/aosp/android
doins ../aosp/frameworks/native/include/android/sharedmem.h
einfo "Installing the shared library."
dolib.so "${OUT}/lib/libnnapi-support.so"
insinto "/usr/$(get_libdir)/pkgconfig"
doins "${OUT}/obj/nnapi/libnnapi-support.pc"
}
platform_pkg_test() {
local tests=(
base cutils fmq hidl hwbuf log utils
)
# When running in qemu, these tests freeze the emulator when hitting
# EventFlag::wake from libfmq. The error printed is:
# Error in event flag wake attempt: Function not implemented
# This is a known issue, see:
# https://chromium.googlesource.com/chromiumos/docs/+/master/testing/running_unit_tests.md#caveats
local qemu_gtest_excl_filter="-"
qemu_gtest_excl_filter+="BlockingReadWrites.SmallInputTest1:"
local gtest_excl_filter="-"
if use asan; then
# The sharedbuffer tests deliberately allocate too much memory:
# AddressSanitizer: requested allocation size 0xfffffffffffffffe
# We can't use allocator_may_return_null=1 as it prints a warning that the
# toolchain considers an error.
gtest_excl_filter+="SharedBufferTest.TestAlloc:"
gtest_excl_filter+="SharedBufferTest.TestEditResize:"
# ForkSafe leaves some threads running which results in warning printed:
# ==26==Running thread 23 was not suspended. False leaks are possible.
# Toolchain considers anything in the asan output as an error.
gtest_excl_filter+="logging.ForkSafe:"
# The queue created in this test cannot be deleted without crashing in
# the hidl library. lsan_suppressions doesn't work due to the lack of
# /usr/bin/llvm-symbolizer, so just exclude the test.
gtest_excl_filter+="BadQueueConfig.QueueSizeTooLarge:"
fi
local test_target
for test_target in "${tests[@]}"; do
platform_test "run" "${OUT}/lib${test_target}_testrunner" "0" "${gtest_excl_filter}" "${qemu_gtest_excl_filter}"
done
}