Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 139 lines (104 sloc) 3.95 KB
#! /bin/bash
PKG=rustc
VERSION=1.66.1
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi
set -xe
umask 022
BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp
test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home
exec </dev/null
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
LD_LIBRARY_PATH=$PREFIX/lib:\$LD_LIBRARY_PATH
export PATH LD_LIBRARY_PATH
if [ -d /pkg/${PKG}-${VERSION}-${BUILD}/.compatlibs ]; then LD_LIBRARY_PATH=${PREFIX}/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi
EOF
. $PREFIX/profile
export MAKEFLAGS="-j $(nproc)"
BUILDDIR=$PREFIX/build
mkdir -p $BUILDDIR
cd $BUILDDIR
test -e $PKG-$VERSION-src.tar.gz || wget https://static.rust-lang.org/dist/$PKG-$VERSION-src.tar.gz
test -d $PKG-$VERSION-src || tar xvf $PKG-$VERSION-src.tar.gz
cd $PKG-$VERSION-src
# https://github.com/rust-lang/rust/commit/bcb75e61abc1be1da63a781b737cad9b273ee411
patch -p1 << EOF
From e5c92bc2b6f0bd69856ad3c4d3056c7f0c0ad72d Mon Sep 17 00:00:00 2001
From: Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Date: Mon, 19 Dec 2022 14:48:45 +0000
Subject: [PATCH] Don't panic on stable since miri is not available there
---
src/bootstrap/install.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs
index c53d0d7e4cb7c..1815a0973072b 100644
--- a/src/bootstrap/install.rs
+++ b/src/bootstrap/install.rs
@@ -200,10 +200,14 @@ install!((self, builder, _config),
install_sh(builder, "clippy", self.compiler.stage, Some(self.target), &tarball);
};
Miri, alias = "miri", Self::should_build(_config), only_hosts: true, {
- let tarball = builder
- .ensure(dist::Miri { compiler: self.compiler, target: self.target })
- .expect("missing miri");
- install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball);
+ if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) {
+ install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball);
+ } else {
+ // Miri is only available on nightly
+ builder.info(
+ &format!("skipping Install miri stage{} ({})", self.compiler.stage, self.target),
+ );
+ }
};
LlvmTools, alias = "llvm-tools", Self::should_build(_config), only_hosts: true, {
let tarball = builder
EOF
cat << EOF > config.toml
# see config.toml.example for more possible options
[llvm]
# use ninja
ninja = true
targets = "X86"
# When compiling LLVM, the experimental targets (WebAssembly
# and RISCV) are built by default - omit them
experimental-targets = ""
[build]
# omit HTML docs to save time and space (comment this to build them)
docs = false
# install cargo as well as rust
extended = true
vendor = true
[install]
# Adjust the prefix for the desired destination
prefix = "$PREFIX"
sysconfdir = "etc"
# docdir is used even if the full awesome docs are not installed
docdir = "share/doc/rustc-${VERSION}"
[rust]
channel = "stable"
rpath = false
# BLFS does not install the FileCheck executable from llvm,
# so disable codegen tests
codegen-tests = false
# get a trace if there is an Internal Compiler Exception
backtrace-on-ice = false
EOF
export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
python3 ./x.py build --exclude src/tools/miri
python3 ./x.py install
cd ${BUILDDIR}
BINDGENVERS=0.24.3
test -e ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz || wget https://github.com/eqrion/cbindgen/archive/v${BINDGENVERS}/cbindgen-${BINDGENVERS}.tar.gz -O ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz
test -d cbindgen-${BINDGENVERS} || tar xvf ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz
cd cbindgen-${BINDGENVERS}
source ${PREFIX}/profile
cargo build --release
install -Dm755 target/release/cbindgen $PREFIX/bin
exit