Files
BMLFS/build-scripts/cargo.build

62 lines
2.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /bin/bash
# cargo 0.74.0 (1.74.0)
# Source: https://github.com/rust-lang/cargo/archive/refs/tags/0.74.0.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: rustc-bootstrap curl libgit2 libssh2
# Recommended: NONE
# Optional: NONE
# NOTE: Requires cargo + rustc for bootstrapping.
# Use a prebuilt cargo from rust-lang.org and rustc from Chimera Linux (CMLFS) or
# Alpine Linux (MLFS)
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export RUST_BACKTRACE=1
# The openssl-sys v0.9.90 crate only supports:
# OpenSSL (version 1.0.1 through 1.1.1, or 3.0.0),
# or LibreSSL 2.5 through 3.8.0
# Set the PKG_CONFIG_PATH to choose openssl in /opt
# instead of libressl in /usr
read -p "Compile?" && \
PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig \
cargo build --release &&
unset SSL_CERT_FILE RUST_BACKTRACE
# Set the runpath for cargo
sudo patchelf --set-rpath /opt/openssl/lib target/release/cargo
sudo mkdir -pv $BUILD/opt/rustc-1.74.0/bin &&
sudo cp -v target/release/cargo \
$BUILD/opt/rustc-1.74.0/bin/
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
cargo: cargo
cargo:
cargo: Cargo downloads your Rust projects dependencies and compiles your
cargo: project.
cargo:
cargo: https://github.com/rust-lang/cargo
cargo: https://rust-lang.org
cargo:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/cargo-1.74.0-$PSUFFIX &&
sudo -S rm -rf ${BUILD}/*