blob: a5e070bca392e5263357384ea477309e7da26f54 [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=6
CROS_WORKON_COMMIT=("e0111498f44234609ad36837d4395ddc7d112ddf" "eff5277a2445e2078a94aeeb73450b713c496c64")
CROS_WORKON_TREE=("eec5ce9cfadd268344b02efdbec7465fbc391a9e" "a33168fa557115c13e015436ab410a6f2038cb5e")
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"
""
)
MESON_AUTO_DEPEND=no
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"
KEYWORDS="*"
IUSE="generated_cros_config unibuild"
RDEPEND="unibuild? (
!generated_cros_config? ( chromeos-base/chromeos-config )
generated_cros_config? ( chromeos-base/chromeos-config-bsp:= )
)
dev-util/cmocka
>=sys-apps/flashmap-0.3-r4
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)
-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
)
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
}