blob: 606f5ae3242df9b42ab25712c60751047e5932cc [file] [log] [blame]
George Burgess IV2961b6f2022-03-30 00:08:04 -07001# Copyright 2022 The Chromium OS Authors. All rights reserved.
2# Distributed under the terms of the GNU General Public License v2
3
4EAPI=7
5
Bob Haarmanb5128bf2022-04-11 11:27:38 -07006# shellcheck disable=SC2034 # Used by cros-rustc.eclass
George Burgess IV2961b6f2022-03-30 00:08:04 -07007RUSTC_TARGET_TRIPLES=(
8 x86_64-pc-linux-gnu
9)
Bob Haarmanb5128bf2022-04-11 11:27:38 -070010# shellcheck disable=SC2034 # Used by cros-rustc.eclass
George Burgess IV2961b6f2022-03-30 00:08:04 -070011RUSTC_BARE_TARGET_TRIPLES=()
12
Bob Haarmanb5128bf2022-04-11 11:27:38 -070013# shellcheck disable=SC2034
14PYTHON_COMPAT=( python3_{6..9} )
George Burgess IV2961b6f2022-03-30 00:08:04 -070015inherit cros-rustc
16
George Burgess IV2961b6f2022-03-30 00:08:04 -070017KEYWORDS="*"
18
Bob Haarmanb5128bf2022-04-11 11:27:38 -070019# dev-lang/rust-1.59.0 introduced the split between dev-lang/rust and
George Burgess IV2961b6f2022-03-30 00:08:04 -070020# dev-lang/rust-host; note that here to work around file collisions.
Bob Haarmanb5128bf2022-04-11 11:27:38 -070021RDEPEND="!<dev-lang/rust-1.59.0"
George Burgess IV2961b6f2022-03-30 00:08:04 -070022
23src_install() {
Bob Haarmanb5128bf2022-04-11 11:27:38 -070024 # shellcheck disable=SC2154 # defined in cros-rustc.eclass
George Burgess IV2961b6f2022-03-30 00:08:04 -070025 local obj="${CROS_RUSTC_BUILD_DIR}/x86_64-unknown-linux-gnu/stage2"
26 local tools="${obj}-tools/x86_64-unknown-linux-gnu/release/"
27 dobin "${obj}/bin/rustc" "${obj}/bin/rustdoc"
28 dobin "${tools}/cargo"
29 dobin "${tools}/rustfmt" "${tools}/cargo-fmt"
30 dobin "${tools}/clippy-driver" "${tools}/cargo-clippy"
31 dobin src/etc/rust-gdb src/etc/rust-lldb
32 insinto "/usr/$(get_libdir)"
33 doins -r "${obj}/lib/"*
34 doins -r "${obj}/lib64/"*
35
Bob Haarmanb5128bf2022-04-11 11:27:38 -070036 insinto "/usr/lib/rustlib/src/rust/"
37 doins -r "${S}/library"
38
George Burgess IV2961b6f2022-03-30 00:08:04 -070039 # Install miscellaneous LLVM tools.
40 #
41 # These tools are already provided in the SDK, but they're built with
42 # the version of LLVM built by sys-devel/llvm. Rust uses an independent
43 # version of LLVM, so the use of these tools is sometimes necessary to
44 # produce artifacts that work with `rustc` and such.
45 #
46 # Our long-term plan is to have Rust using the same version of LLVM as
47 # sys-devel/llvm. When that happens, all of the below will be removed, with
48 # the expectation that users will migrate to the LLVM tools on `$PATH`.
49 local llvm_tools="${CROS_RUSTC_BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/bin"
50 exeinto "/usr/libexec/rust"
51 doexe "${llvm_tools}/llvm-profdata"
52}