2021-01-30 21:58:39 +00:00
|
|
|
# Based on Abyss OS phase1/devel/rust APKBUILD:
|
|
|
|
#
|
|
|
|
# Copyright (c) 2019 by the Abyss Authors
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
pkgname=rust
|
2021-02-04 22:30:41 +00:00
|
|
|
pkgver=nightly
|
2021-01-30 21:58:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
_clear_vendor_checksums() {
|
|
|
|
sed -i 's/\("files":{\)[^}]*/\1/' vendor/$1/.cargo-checksum.json
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch() {
|
|
|
|
curl "https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz" -o $pkgname-$pkgver.tar.xz
|
2021-02-04 12:02:44 +00:00
|
|
|
# curl "https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz" -o $pkgname-
|
2021-01-30 21:58:39 +00:00
|
|
|
tar -xf $pkgname-$pkgver.tar.xz
|
|
|
|
|
|
|
|
mv rustc-$pkgver-src $pkgname-$pkgver
|
|
|
|
cp ../*.patch .
|
|
|
|
cd $pkgname-$pkgver
|
|
|
|
patch -p1 < ../alpine-move-py.patch
|
|
|
|
patch -p1 < ../abyss-install-template-shebang.patch
|
|
|
|
patch -p1 < ../abyss-libunwind.patch
|
|
|
|
patch -p1 < ../abyss-libz.patch
|
|
|
|
patch -p1 < ../vendored-ssl.patch
|
2021-03-13 22:00:56 +00:00
|
|
|
# patch -p1 < ../openbsd-libressl.patch
|
2021-01-30 21:58:39 +00:00
|
|
|
patch -p1 < ../alpine-crt.patch
|
2021-03-13 22:00:56 +00:00
|
|
|
patch -p1 < ../libexec.patch
|
|
|
|
patch -p1 < ../llvm_crt.patch
|
2021-01-30 21:58:39 +00:00
|
|
|
|
|
|
|
sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py
|
|
|
|
_clear_vendor_checksums libc
|
|
|
|
_clear_vendor_checksums openssl-sys
|
|
|
|
_clear_vendor_checksums openssl-src
|
|
|
|
rm -rf src/llvm-project/
|
|
|
|
|
2021-02-04 12:02:44 +00:00
|
|
|
cd ..
|
2021-01-30 21:58:39 +00:00
|
|
|
ln -s /usr/bin/gmake make
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd $pkgname-$pkgver
|
|
|
|
|
|
|
|
OPENSSL_LIB_DIR=/usr/lib/ ./configure \
|
|
|
|
--build="x86_64-unknown-linux-musl" \
|
|
|
|
--host="x86_64-unknown-linux-musl" \
|
|
|
|
--target="x86_64-unknown-linux-musl" \
|
|
|
|
--prefix="/usr" \
|
2021-03-13 22:00:56 +00:00
|
|
|
--release-channel="nightly" \
|
2021-01-30 21:58:39 +00:00
|
|
|
--enable-local-rust \
|
|
|
|
--local-rust-root="/usr" \
|
|
|
|
--llvm-root="/usr" \
|
|
|
|
--disable-docs \
|
|
|
|
--enable-extended \
|
2021-03-13 22:00:56 +00:00
|
|
|
--tools="cargo,rls,rustfmt" \
|
2021-01-30 21:58:39 +00:00
|
|
|
--enable-vendor \
|
|
|
|
--enable-locked-deps \
|
|
|
|
--enable-llvm-link-shared \
|
|
|
|
--enable-option-checking \
|
|
|
|
--python="python" \
|
|
|
|
--set="rust.musl-root=/usr" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.llvm-config=/usr/bin/llvm-config" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.musl-root=/usr" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.crt-static=false" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.cc=cc" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.cxx=c++" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.ar=ar" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.linker=cc" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.musl-root=/usr" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.crt-static=false" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.cc=cc" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.cxx=c++" \
|
|
|
|
--set="target.x86_64-unknown-linux-musl.ar=ar" \
|
2021-02-04 22:30:41 +00:00
|
|
|
--set="target.x86_64-unknown-linux-musl.linker=cc"
|
2021-01-30 21:58:39 +00:00
|
|
|
|
|
|
|
sed 's/#deny-warnings = .*/deny-warnings = false/' -i config.toml
|
|
|
|
sed 's|deny(warnings,|deny(|' -i src/bootstrap/lib.rs
|
|
|
|
|
|
|
|
PATH=$(pwd)"/..:$PATH" ./x.py build
|
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
|
|
|
cd $pkgname-$pkgver
|
|
|
|
DESTDIR="$pkgdir" ./x.py install
|
|
|
|
}
|
|
|
|
|
|
|
|
license() {
|
|
|
|
cd $pkgname-$pkgver
|
2021-02-04 22:30:41 +00:00
|
|
|
cat LICENSE-MIT
|
2021-01-30 21:58:39 +00:00
|
|
|
# cat COPYING
|
|
|
|
}
|