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 88 lines (63 sloc) 1.9 KB
#! /bin/bash
PKG=rustc
VERSION=1.29.2
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
#PREFIX=/dev/shm/$PKG-$VERSION-$BUILD
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
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
cat << EOF > config.toml
# see config.toml.example for more possible options
[llvm]
targets = "X86"
# When using system llvm prefer shared libraries
link-shared = true
[build]
# install cargo as well as rust
extended = true
[install]
prefix = "$PREFIX"
docdir = "share/doc/rustc-1.29.2"
sysconfdir = "etc"
[rust]
channel = "stable"
rpath = false
# BLFS does not install the FileCheck executable from llvm,
# so disable codegen tests
codegen-tests = false
[target.x86_64-unknown-linux-gnu]
# delete this *section* if you are not using system llvm.
# NB the output of llvm-config (i.e. help options) may be
# dumped to the screen when config.toml is parsed.
llvm-config = "/usr/bin/llvm-config"
EOF
export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
python3 ./x.py build
python3 ./x.py install
cd ${BUILDDIR}
test -e ${BUILDDIR}/cbindgen-0.6.6.tar.gz || wget https://github.com/eqrion/cbindgen/archive/v0.6.6/cbindgen-0.6.6.tar.gz -O ${BUILDDIR}/cbindgen-0.6.6.tar.gz
test -d cbindgen-0.6.6 || tar xvf ${BUILDDIR}/cbindgen-0.6.6.tar.gz
cd cbindgen-0.6.6
$PREFIX/bin/cargo build --release
install -Dm755 target/release/cbindgen $PREFIX/bin
exit