blob: 564d7e8bf551859f86df82f76f84f2f77963526a [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
CROS_WORKON_COMMIT="72b2a5da2c0a1de5a6a282a6ff8c8bf2a8b3b9d1"
CROS_WORKON_TREE="e1fbc0b762f507ba1963cda2ce4366dfea33e381"
CROS_WORKON_LOCALNAME="../platform2"
CROS_WORKON_PROJECT="chromiumos/platform2"
CROS_WORKON_OUTOFTREE_BUILD=1
CROS_WORKON_INCREMENTAL_BUILD=1
CROS_WORKON_SUBTREE="vm_tools/p9"
inherit cros-fuzzer cros-sanitizers cros-workon cros-rust
DESCRIPTION="Server implementation of the 9P file system protocol"
HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform2/+/master/vm_tools/p9/"
LICENSE="BSD-Google"
SLOT="${PV}/${PR}"
KEYWORDS="*"
IUSE="fuzzer test"
DEPEND="
dev-rust/libc:=
~dev-rust/proc-macro2-0.2.3:=
~dev-rust/quote-0.4.2:=
~dev-rust/syn-0.12.15:=
"
get_crate_version() {
local crate="$1"
awk '/^version = / { print $3 }' "$1/Cargo.toml" | head -n1 | tr -d '"'
}
src_unpack() {
cros-workon_src_unpack
S+="/vm_tools/p9"
cros-rust_src_unpack
}
src_configure() {
sanitizers-setup-env
}
src_compile() {
use test && ecargo_test --no-run
if use fuzzer; then
cd fuzz
ecargo_build_fuzzer
fi
}
src_test() {
if ! use x86 && ! use amd64 ; then
elog "Skipping unit tests on non-x86 platform"
else
ecargo_test
fi
}
src_install() {
pushd wire_format_derive > /dev/null
local version="$(get_crate_version .)"
cros-rust_publish wire_format_derive "${version}"
popd > /dev/null
version="$(get_crate_version .)"
cros-rust_publish p9 "${version}"
if use fuzzer; then
fuzzer_install "${S}/fuzz/OWNERS" \
"${CARGO_TARGET_DIR}/${CHOST}/debug/p9_tframe_decode_fuzzer"
fi
}