0
0
Fork 0
haikuports/dev-lang/rust_bin/rust_bin-1.21.0.recipe

96 lines
3.1 KiB
Bash

SUMMARY="Modern and safe systems programming language"
DESCRIPTION="Rust is a systems programming language that runs blazingly fast, prevents almost all crashes*, and eliminates data races."
HOMEPAGE="https://www.rust-lang.org/"
COPYRIGHT="2017 The Rust Project Developers"
LICENSE="MIT"
REVISION="1"
case "$effectiveTargetArchitecture" in
x86)
SOURCE_URI="http://dl.rust-on-haiku.com/dist/$portVersion/rust-$portVersion-i686-unknown-haiku.tar.xz"
CHECKSUM_SHA256="465db013876ead01686c991f1fa63ef4a6687d3cabbcde81f5a756e367989cdf"
SOURCE_DIR="rust-1.21.0-i686-unknown-haiku"
;;
x86_64)
SOURCE_URI="http://dl.rust-on-haiku.com/dist/$portVersion/rust-$portVersion-x86_64-unknown-haiku.tar.xz"
CHECKSUM_SHA256="cbb7f705398b76c5e2dd18119cdb9af2c042720449479b482a39309fb270ded8"
SOURCE_DIR="rust-$portVersion-x86_64-unknown-haiku"
;;
*)
SOURCE_URI="http://dl.rust-on-haiku.com/dist/$portVersion/rustc-$portVersion-src.tar.xz"
CHECKSUM_SHA256="7741c2f3652813b7ecd0233305a5ca0de561fea2849049651a79521d2c437f0f"
SOURCE_DIR="rustc-$portVersion-src"
;;
esac
ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"
DISABLE_SOURCE_PACKAGE=yes
cargoVersion="0.22.0"
rlsVersion="0.121.0"
PROVIDES="
rust_bin$secondaryArchSuffix = $portVersion
cmd:rustc = $portVersion
cmd:rustdoc = $portVersion
cmd:rust_gdb = $portVersion
cmd:rust_lldb = $portVersion
cmd:cargo$secondaryArchSuffix = $cargoVersion
cmd:rls = $rlsVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libssh2$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
CONFLICTS="
rust$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
INSTALL()
{
./install.sh \
--prefix=$prefix \
--docdir=$developDocDir \
--libdir=$libDir \
--mandir=$manDir \
--sysconfdir=$dataDir \
--disable-ldconfig
# move the cargo and binaries (in case of a secondary arch)
if [ -n "$secondaryArchSuffix" ]; then
mkdir -p $binDir
mv $prefix/bin/cargo $binDir/cargo
fi
# remove zsh data, it is not used on Haiku anyway
rm -rf $prefix/share
# move the `rustlib` folder to the developLibDirs (as it is a framework of sorts)
# do create a link in $prefix/lib as that is where rustc expects things to live
# Note; this actually seems to be a bug in the Rust build system. The path
# to rustlib is hardcoded in the rustc binary, but it does allow it to be
# set to libdir_relative (see config.rs in the bootstrap tool). This variable
# is only set when the configure script is used to generate the config, not
# with config.toml
mkdir -p $developLibDir
mv $libDir/rustlib $developLibDir
cd $prefix/lib
ln -s $developLibDir/rustlib rustlib
# clean out unneccesary files created by the rust installer
rm $developLibDir/rustlib/components
rm $developLibDir/rustlib/install.log
rm $developLibDir/rustlib/manifest-*
rm $developLibDir/rustlib/rust-installer-version
rm $developLibDir/rustlib/uninstall.sh
}