George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 1 | # Copyright 2022 The Chromium OS Authors. All rights reserved. |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | |
| 4 | EAPI=7 |
| 5 | |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 6 | # shellcheck disable=SC2034 # Used by cros-rustc.eclass |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 7 | RUSTC_TARGET_TRIPLES=( |
| 8 | x86_64-pc-linux-gnu |
| 9 | ) |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 10 | # shellcheck disable=SC2034 # Used by cros-rustc.eclass |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 11 | RUSTC_BARE_TARGET_TRIPLES=() |
| 12 | |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 13 | # shellcheck disable=SC2034 |
| 14 | PYTHON_COMPAT=( python3_{6..9} ) |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 15 | inherit cros-rustc |
| 16 | |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 17 | KEYWORDS="*" |
| 18 | |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 19 | # dev-lang/rust-1.59.0 introduced the split between dev-lang/rust and |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 20 | # dev-lang/rust-host; note that here to work around file collisions. |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 21 | RDEPEND="!<dev-lang/rust-1.59.0" |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 22 | |
| 23 | src_install() { |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 24 | # shellcheck disable=SC2154 # defined in cros-rustc.eclass |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 25 | 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 Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame^] | 36 | insinto "/usr/lib/rustlib/src/rust/" |
| 37 | doins -r "${S}/library" |
| 38 | |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 39 | # 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 | } |