blob: f4d7122e212b38b415503753fcfad778fee0dcb2 [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=7
CROS_WORKON_COMMIT=("5bbbe52a139486abcbd802b9bd3f6763dac479b3" "ed22531607e5d69a99369b675eebcbdd486efaaa")
CROS_WORKON_TREE=("ef118ceb3e8ebcc8b8a4ae6577a71d7ad210a722" "b63af68c544d220e9ac4fec05fcdd8001237667d")
CROS_WORKON_PROJECT=(
"chromiumos/platform2"
"chromiumos/platform/mosys"
)
CROS_WORKON_LOCALNAME=(
"../platform2"
"../platform/mosys"
)
CROS_WORKON_DESTDIR=(
"${S}/platform2"
"${S}/platform/mosys"
)
CROS_WORKON_INCREMENTAL_BUILD=1
CROS_WORKON_SUBTREE=(
"common-mk"
""
)
WANT_LIBCHROME="no"
WANT_LIBBRILLO="no"
inherit meson flag-o-matic toolchain-funcs cros-unibuild cros-workon platform
DESCRIPTION="Utility for obtaining various bits of low-level system info"
HOMEPAGE="http://mosys.googlecode.com/"
LICENSE="BSD-Google BSD Apache-2.0 MIT ISC Unlicense"
SLOT="0/0"
KEYWORDS="*"
IUSE="unibuild vpd_file_cache"
RDEPEND="
vpd_file_cache? ( chromeos-base/vpd )
dev-util/cmocka
chromeos-base/minijail:="
DEPEND="${RDEPEND}"
src_unpack() {
cros-workon_src_unpack
PLATFORM_TOOLDIR="${S}/platform2/common-mk"
S+="/platform/mosys"
}
src_configure() {
local platform_intf=""
local emesonargs=(
$(meson_use unibuild use_cros_config)
"$(meson_use vpd_file_cache use_vpd_file_cache)"
-Darch=$(tc-arch)
)
if use unibuild; then
emesonargs+=(
"-Dcros_config_data_src=${SYSROOT}${UNIBOARD_C_CONFIG}"
)
platform_intf="$(cros_config_host get-mosys-platform)"
else
# TODO(jrosenth): hard code some board to platform_intf
# mappings here for legacy non-unibuild boards. For now, this
# feature is unibuild only.
true
fi
if [[ -n "${platform_intf}" ]]; then
emesonargs+=(
"-Dplatform_intf=${platform_intf}"
)
fi
# Necessary to enable LTO. See crbug.com/1082378.
append-ldflags "-O2"
meson_src_configure
}
src_compile() {
meson_src_compile
}
platform_pkg_test() {
local tests=(
file_unittest
math_unittest
platform_unittest
vpd_unittest
)
local test_bin
for test_bin in "${tests[@]}"; do
platform_test "run" \
"${BUILD_DIR}/unittests/${test_bin}"
done
}
src_install() {
dosbin "${BUILD_DIR}/mains/mosys"
insinto /usr/share/policy
newins "seccomp/mosys-seccomp-${ARCH}.policy" mosys-seccomp.policy
dodoc README
}