blob: ba5fb47d97152c9cbc3571491d9ea9e1c543e7f0 [file] [log] [blame]
# Copyright 2012 The ChromiumOS Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
CROS_WORKON_COMMIT=("8b6e11a069e490c761cdab7ab3ff59434806cd9c" "507f6e1e983df5fd04863f1bfeaa40f566b1df34")
CROS_WORKON_TREE=("41d899585b7a07ea908a0cca2944a7b8a4d13655" "abdfa83348ddbb4c1c595bc0df043b1539bd4f17")
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-workon platform
PLATFORM_NAMES=(
"Asurada"
"Cherry"
"Corsola"
"Generic"
"Geralt"
"Gru"
"Kukui"
"Oak"
"Trogdor"
)
PLATFORM_NAME_USE_FLAGS=()
for platform_name in "${PLATFORM_NAMES[@]}"; do
PLATFORM_NAME_USE_FLAGS+=("mosys_platform_${platform_name,,}")
done
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
${PLATFORM_NAME_USE_FLAGS[*]}
"
REQUIRED_USE="
unibuild
^^ ( ${PLATFORM_NAME_USE_FLAGS[*]} )
"
RDEPEND="
dev-util/cmocka
"
DEPEND="${RDEPEND}"
src_unpack() {
cros-workon_src_unpack
PLATFORM_TOOLDIR="${S}/platform2/common-mk"
S+="/platform/mosys"
}
src_configure() {
local platform_intf=""
local emesonargs=()
for ((i = 0; i < ${#PLATFORM_NAMES[@]}; i++)); do
if use "${PLATFORM_NAME_USE_FLAGS[${i}]}"; then
platform_intf="${PLATFORM_NAMES[${i}]}"
break
fi
done
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
)
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"
}