summaryrefslogtreecommitdiff
path: root/repo/rust/rust.xibuild
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-02-02 14:10:02 +0000
committerdavidovski <david@davidovski.xyz>2023-02-02 14:10:02 +0000
commitf29d569cd33a73da5ad675f43a34ad53c5cc9bc6 (patch)
tree76fe6267f8307e7630fc6f53ff99a9767ad40de0 /repo/rust/rust.xibuild
parent05d004dfe0c9a9d898fac8a4a0292ca2a74ca391 (diff)
Work
Diffstat (limited to 'repo/rust/rust.xibuild')
-rw-r--r--repo/rust/rust.xibuild77
1 files changed, 77 insertions, 0 deletions
diff --git a/repo/rust/rust.xibuild b/repo/rust/rust.xibuild
new file mode 100644
index 0000000..8b95956
--- /dev/null
+++ b/repo/rust/rust.xibuild
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+MAKEDEPS="cmake libclang clang llvm curl"
+DEPS="libssh2 openssl"
+
+PKG_VER=1.66.0
+SOURCE=https://static.rust-lang.org/dist/rustc-$PKG_VER-src.tar.gz
+DESC="Systems programming language focused on safety, speed and concurrency"
+
+ADDITIONAL="
+ 0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
+ 0007-do-not-install-libunwind-source.patch
+ install-template-shebang.patch
+ link-musl-dynamically.patch
+ musl-fix-linux_musl_base.patch
+ need-rpath.patch
+ need-ssp_nonshared.patch
+"
+
+prepare () {
+ apply_patches
+ sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/libc/.cargo-checksum.json
+}
+
+build () {
+ export CFLAGS="$CFLAGS -fPIE -fPIC"
+ export CXXFLAGS="$CFLAGS"
+ target=x86_64-unknown-linux-musl
+ build=x86_64-unknown-linux-musl
+ ./configure \
+ --build="$build" \
+ --host="$target" \
+ --target="$target" \
+ --prefix="/usr" \
+ --release-channel="stable" \
+ --llvm-root="/usr/lib/" \
+ --disable-docs \
+ --enable-extended \
+ --tools="analysis,cargo,src,rustfmt" \
+ --enable-llvm-link-shared \
+ --enable-option-checking \
+ --enable-locked-deps \
+ --enable-vendor \
+ --set="rust.musl-root=/usr" \
+ --set="rust.codegen-units=1" \
+ --set="rust.codegen-units-std=1" \
+ --set="rust.parallel-compiler=true" \
+ --set="target.$target.llvm-config=/usr/bin/llvm-config" \
+ --set="target.$target.musl-root=/usr" \
+ --set="target.$target.crt-static=false" \
+ --set="target.$target.cc=gcc" \
+ --set="target.$target.cxx=g++" \
+ --set="target.$target.ar=ar" \
+ --set="target.$target.linker=gcc" \
+ --set="target.$build.musl-root=/usr" \
+ --set="target.$build.crt-static=false" \
+ --set="target.$build.cc=gcc" \
+ --set="target.$build.cxx=g++" \
+ --set="target.$build.ar=ar" \
+ --set="target.$build.linker=gcc" \
+
+ sed 's/#deny-warnings = .*/deny-warnings = false/' -i config.toml
+ sed 's|deny(warnings,|deny(|' -i src/bootstrap/lib.rs
+
+ python ./x.py dist -v --jobs $JOBS
+
+}
+
+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
+}