summaryrefslogtreecommitdiff
path: root/repo/devel/rustc.xibuild
diff options
context:
space:
mode:
Diffstat (limited to 'repo/devel/rustc.xibuild')
-rw-r--r--repo/devel/rustc.xibuild93
1 files changed, 93 insertions, 0 deletions
diff --git a/repo/devel/rustc.xibuild b/repo/devel/rustc.xibuild
new file mode 100644
index 0000000..21002e0
--- /dev/null
+++ b/repo/devel/rustc.xibuild
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+MAKEDEPS=(cmake )
+DEPS=(curl gcc libssh2)
+
+PKG_VER=1.58.1
+SOURCE=https://static.rust-lang.org/dist/rustc-$PKG_VER-src.tar.gz
+DESC="Systems programming language focused on safety, speed and concurrency"
+
+prepare () {
+ mkdir $PKG_DEST/opt/rustc-$PKG_VER &&
+ ln -svfin rustc-$PKG_VER $PKG_DEST/opt/rustc
+
+ cat << EOF > config.toml
+# see config.toml.example for more possible options
+# See the 8.4 book for an example using shipped LLVM
+# e.g. if not installing clang, or using a version before 10.0
+[llvm]
+# by default, rust will build for a myriad of architectures
+targets = "X86"
+
+# When using system llvm prefer shared libraries
+link-shared = true
+
+[build]
+# omit docs to save time and space (default is to build them)
+docs = false
+
+# install cargo as well as rust
+extended = true
+
+[install]
+prefix = "/opt/rustc-1.58.1"
+docdir = "share/doc/rustc-1.58.1"
+
+[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]
+# 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"
+
+[target.i686-unknown-linux-gnu]
+# 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
+
+}
+
+build () {
+ export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
+ python3 ./x.py build --exclude src/tools/miri
+
+}
+
+package () {
+ export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&
+ DESTDIR=${PWD}/install python3 ./x.py install &&
+ unset LIBSSH2_SYS_USE_PKG_CONFIG
+
+ chown -R root:root install &&
+ cp -a install/* $PKG_DEST
+
+ mkdir -pv $PKG_DEST/etc/profile.d/
+ cat > $PKG_DEST/etc/profile.d/rustc.sh << "EOF"
+# Begin /etc/profile.d/rustc.sh
+
+pathprepend /opt/rustc/bin PATH
+
+# End /etc/profile.d/rustc.sh
+EOF
+}
+
+postinstall () {
+cat >> /etc/ld.so.conf << EOF
+# Begin rustc addition
+
+/opt/rustc/lib
+
+# End rustc addition
+EOF
+
+ldconfig
+}