Mike Frysinger | 51a0a6b | 2022-09-09 09:21:07 -0400 | [diff] [blame] | 1 | # Copyright 2022 The ChromiumOS Authors |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 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 | |
Michael Benfield | e2e2bed | 2022-08-13 17:49:04 +0000 | [diff] [blame] | 19 | BDEPEND="sys-devel/llvm" |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame] | 20 | # 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] | 21 | # dev-lang/rust-host; note that here to work around file collisions. |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame] | 22 | RDEPEND="!<dev-lang/rust-1.59.0" |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 23 | |
| 24 | src_install() { |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame] | 25 | # shellcheck disable=SC2154 # defined in cros-rustc.eclass |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 26 | local obj="${CROS_RUSTC_BUILD_DIR}/x86_64-unknown-linux-gnu/stage2" |
Michael Benfield | 5fab1f2 | 2022-11-14 05:30:11 +0000 | [diff] [blame] | 27 | local tools="${obj}-tools/x86_64-unknown-linux-gnu/release" |
| 28 | dobin "${obj}/bin/rustc" |
Michael Benfield | b6b2033 | 2022-09-15 23:54:36 +0000 | [diff] [blame] | 29 | dobin "${tools}/cargo" "${obj}/bin/rust-toolchain-version" |
Michael Benfield | ab6a03d | 2022-05-26 18:29:30 +0000 | [diff] [blame] | 30 | if ! use rust_profile_frontend_generate && ! use rust_profile_llvm_generate; then |
| 31 | # These won't be built for an instrumented build. |
| 32 | dobin "${tools}/rustfmt" "${tools}/cargo-fmt" |
| 33 | dobin "${tools}/clippy-driver" "${tools}/cargo-clippy" |
Michael Benfield | 5fab1f2 | 2022-11-14 05:30:11 +0000 | [diff] [blame] | 34 | dobin "${obj}/bin/rustdoc" |
Michael Benfield | ab6a03d | 2022-05-26 18:29:30 +0000 | [diff] [blame] | 35 | fi |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 36 | dobin src/etc/rust-gdb src/etc/rust-lldb |
| 37 | insinto "/usr/$(get_libdir)" |
| 38 | doins -r "${obj}/lib/"* |
| 39 | doins -r "${obj}/lib64/"* |
| 40 | |
Bob Haarman | b5128bf | 2022-04-11 11:27:38 -0700 | [diff] [blame] | 41 | insinto "/usr/lib/rustlib/src/rust/" |
| 42 | doins -r "${S}/library" |
| 43 | |
George Burgess IV | 2961b6f | 2022-03-30 00:08:04 -0700 | [diff] [blame] | 44 | # Install miscellaneous LLVM tools. |
| 45 | # |
| 46 | # These tools are already provided in the SDK, but they're built with |
| 47 | # the version of LLVM built by sys-devel/llvm. Rust uses an independent |
| 48 | # version of LLVM, so the use of these tools is sometimes necessary to |
| 49 | # produce artifacts that work with `rustc` and such. |
| 50 | # |
| 51 | # Our long-term plan is to have Rust using the same version of LLVM as |
| 52 | # sys-devel/llvm. When that happens, all of the below will be removed, with |
| 53 | # the expectation that users will migrate to the LLVM tools on `$PATH`. |
| 54 | local llvm_tools="${CROS_RUSTC_BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/bin" |
| 55 | exeinto "/usr/libexec/rust" |
| 56 | doexe "${llvm_tools}/llvm-profdata" |
| 57 | } |