gentoo-bootstrap/dev-lang/rust/rust-1.54.0.ebuild

87 lines
2.7 KiB
Bash
Raw Permalink Normal View History

# Copyright 1999-2024 Gentoo Authors
2021-11-14 18:01:10 +00:00
# Distributed under the terms of the GNU General Public License v2
2022-12-27 21:53:40 +00:00
EAPI=8
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
inherit flag-o-matic git-r3 llvm rust-toolchain
2021-11-14 18:01:10 +00:00
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
2024-03-01 20:29:11 +00:00
MRUSTC_VERSION="0.10.1"
2024-03-02 00:55:08 +00:00
EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
EGIT_COMMIT="666bda127d316e18cce5efc256742899ee2b23a4"
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
SRC_URI="
2024-03-02 00:55:08 +00:00
https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz"
#https://github.com/thepowersgang/mrustc/archive/v${MRUSTC_VERSION}.tar.gz"
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
SLOT="stable/1.54"
KEYWORDS="amd64"
DEPEND="
dev-build/cmake
2023-02-04 18:38:46 +00:00
sys-process/time
2024-03-01 20:29:11 +00:00
dev-libs/openssl:0=
2021-11-14 18:01:10 +00:00
"
2023-02-04 18:38:46 +00:00
RDEPEND=""
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
LLVM_TARGETS="AArch64;ARM;X86"
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
S=${WORKDIR}/mrustc-${MRUSTC_VERSION}
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
RUSTC_VERSION=1.54.0
MRUSTC_TARGET_VER=1.54
OUTDIR_SUF=
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
src_unpack() {
2024-03-02 00:55:08 +00:00
git-r3_fetch "${EGIT_REPO_URI}" "${EGIT_COMMIT}"
git-r3_checkout "${EGIT_REPO_URI}" "${S}"
2023-02-04 18:38:46 +00:00
unpack ${A}
mv rustc-${PV}-src ${S}
2021-11-14 18:01:10 +00:00
}
2023-02-04 18:38:46 +00:00
src_prepare() {
cd ${S}
2021-11-14 18:01:10 +00:00
2024-03-02 00:55:08 +00:00
pushd rustc-${PV}-src
2023-02-08 17:56:38 +00:00
rm "vendor/vte/vim10m_"{match,table}
2023-02-04 18:38:46 +00:00
eapply -p0 ${S}/rustc-${PV}-src.patch
sed -i 's/ $(RUSTC_SRC_DL)//' "${S}/minicargo.mk"
2024-03-01 20:29:11 +00:00
cd src/llvm-project
2023-02-08 17:56:38 +00:00
popd
2021-11-14 18:01:10 +00:00
2023-02-04 18:38:46 +00:00
eapply_user
2021-11-14 18:01:10 +00:00
}
src_configure() {
2023-02-04 18:38:46 +00:00
default
2021-11-14 18:01:10 +00:00
}
src_compile() {
2023-02-08 17:56:38 +00:00
local -a make_opts
make_opts=(RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi))
emake ${make_opts[@]} || die "compile problem"
emake -j1 ${make_opts[@]} -f minicargo.mk LIBS || die "compile problem"
2023-02-04 18:38:46 +00:00
RUSTC_TARGET=$(rust_abi) || die "compile problem"
2023-02-08 17:56:38 +00:00
emake -j1 ${make_opts[@]} test || die "compile problem"
emake -j1 ${make_opts[@]} local_tests || die "compile problem"
emake -j1 ${make_opts[@]} RUSTC_INSTALL_BINDIR=bin -f minicargo.mk "output/rustc" || die "compile problem"
emake -j1 ${make_opts[@]} LIBGIT2_SYS_USE_PKG_CONFIG=1 -f minicargo.mk "output${OUTDIR_SUF}/cargo" || die "compile problem"
2023-02-04 18:38:46 +00:00
2023-02-08 17:56:38 +00:00
emake -C run_rustc -j1 ${make_opts[@]} || die "compile problem"
2021-11-14 18:01:10 +00:00
}
src_install() {
2023-02-04 18:38:46 +00:00
mkdir -p "${D}/usr/"{bin,lib}/
rustc_wrapper="${S}/run_rustc/output/prefix/bin/rustc"
sed -i '/LD_LIBRARY_PATH/c\LD_LIBRARY_PATH="$d\/..\/lib\/rustlib\/'$(rust_abi)'\/lib" $d\/rustc_binary $@' ${rustc_wrapper}
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!"
cp -R "${S}/run_rustc/output/prefix/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die "Install failed!"
cp -R "${S}/run_rustc/output/prefix/lib/rustlib" "${D}/usr/lib/rustlib" || die "Install failed!"
mkdir -p "${D}/etc/env.d/rust/"
echo /usr/bin/cargo >> "${D}/etc/env.d/rust/provider-rust-${PV}"
2021-11-14 18:01:10 +00:00
}