2020-05-03 20:36:19 +01:00
|
|
|
# Copyright 1999-2019 Gentoo Foundation
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
EAPI=7
|
|
|
|
|
2020-07-14 20:09:29 +01:00
|
|
|
inherit flag-o-matic eutils git-r3 llvm rust-toolchain
|
2020-05-03 20:36:19 +01:00
|
|
|
|
|
|
|
DESCRIPTION="Systems programming language from Mozilla"
|
|
|
|
HOMEPAGE="https://www.rust-lang.org/"
|
|
|
|
|
|
|
|
# MRUSTC_VERSION="0.9"
|
2020-05-09 10:21:47 +01:00
|
|
|
EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
|
2020-07-14 20:09:29 +01:00
|
|
|
EGIT_COMMIT="fbb5da8f43d8ebd0afaf0485a8137f868f9b809c"
|
2020-05-03 20:36:19 +01:00
|
|
|
|
|
|
|
SRC_URI="
|
|
|
|
https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz"
|
|
|
|
# https://github.com/thepowersgang/mrustc/archive/v${MRUSTC_VERSION}.tar.gz
|
|
|
|
|
|
|
|
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
|
|
|
|
SLOT="stable/1.29"
|
2020-05-05 01:37:55 +01:00
|
|
|
KEYWORDS="amd64"
|
2020-05-03 20:36:19 +01:00
|
|
|
DEPEND="dev-util/cmake"
|
|
|
|
RDEPEND=""
|
|
|
|
|
|
|
|
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
|
|
|
|
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
|
|
|
|
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
|
|
|
|
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
|
|
|
|
|
|
|
|
IUSE="${ALL_LLVM_TARGETS[*]}"
|
|
|
|
|
|
|
|
S=${WORKDIR}/mrustc-${MRUSTC_VERSION}
|
|
|
|
|
|
|
|
src_unpack() {
|
2020-05-15 13:19:48 +01:00
|
|
|
git-r3_fetch "${EGIT_REPO_URI}" "${EGIT_COMMIT}"
|
|
|
|
git-r3_checkout "${EGIT_REPO_URI}" "${S}"
|
2020-05-03 20:36:19 +01:00
|
|
|
unpack ${A}
|
|
|
|
mv rustc-${PV}-src ${S}
|
|
|
|
}
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
cd ${S}
|
|
|
|
sed -i 's/\$Vtime/\$V/' run_rustc/Makefile
|
|
|
|
|
|
|
|
cd ${S}/rustc-${PV}-src
|
|
|
|
eapply -p0 ${S}/rustc-${PV}-src.patch
|
|
|
|
|
|
|
|
eapply_user
|
|
|
|
}
|
|
|
|
|
|
|
|
src_configure() {
|
|
|
|
default
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
2020-07-14 20:09:29 +01:00
|
|
|
emake RUSTC_TARGET=$(rust_abi) -f minicargo.mk || die "compile problem"
|
|
|
|
emake RUSTC_TARGET=$(rust_abi) -f minicargo.mk output/cargo || die "compile problem"
|
2020-05-03 20:36:19 +01:00
|
|
|
cd run_rustc
|
2020-07-14 20:09:29 +01:00
|
|
|
emake RUSTC_TARGET=$(rust_abi) || die "compile problem"
|
2020-05-03 20:36:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
|
|
|
mkdir -p "${D}/usr/bin/"
|
2020-05-05 01:37:55 +01:00
|
|
|
rustc_wrapper=${S}/run_rustc/output/prefix/bin/rustc
|
2020-07-14 20:09:29 +01:00
|
|
|
sed -i '/LD_LIBRARY_PATH/c\LD_LIBRARY_PATH="$d\/..\/lib\/rustlib\/$(rust_abi)\/lib" $d\/rustc_binary $@' ${rustc_wrapper}
|
2020-05-05 01:37:55 +01:00
|
|
|
cp -R "${rustc_wrapper}" "${D}/usr/bin/rustc-${PV}" || die "Install failed!"
|
|
|
|
cp -R "${S}/run_rustc/output/prefix/bin/rustc_binary" "${D}/usr/bin/rustc_binary" || die "Install failed!"
|
2020-06-20 13:22:52 +01:00
|
|
|
cp -R "${S}/run_rustc/output/prefix/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die "Install failed!"
|
2020-05-05 01:37:55 +01:00
|
|
|
cp -R "${S}/run_rustc/output/prefix/lib" "${D}/usr" || die "Install failed!"
|
2020-05-03 20:36:19 +01:00
|
|
|
mkdir -p "${D}/etc/env.d/rust/"
|
|
|
|
echo /usr/bin/cargo >> "${D}/etc/env.d/rust/provider-rust-${PV}"
|
|
|
|
}
|