mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 07:10:05 +02:00
x86_64 is used as a baseline: the "x86_64" entry, whatever status it has, is transformed into "all", and then the other entries in ARCHITECTURES either dropped or rearranged appropriately.
167 lines
4.6 KiB
Bash
167 lines
4.6 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="2018 The Rust Project Developers"
|
|
LICENSE="MIT"
|
|
REVISION="2"
|
|
cargoVersion="0.29.0"
|
|
rlsVersion="0.128.0"
|
|
rustfmtVersion="0.8.2"
|
|
SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz"
|
|
CHECKSUM_SHA256="8a899afd4b502b4ebff5cfc82cba77a8cb37113b5e6018f15c09545936081848"
|
|
SOURCE_DIR="rustc-$portVersion-src"
|
|
PATCHES="rust-$portVersion.patchset"
|
|
|
|
ARCHITECTURES="?all !x86_gcc2"
|
|
SECONDARY_ARCHITECTURES="?x86"
|
|
|
|
PROVIDES="
|
|
rust$secondaryArchSuffix = $portVersion
|
|
cmd:cargo$secondaryArchSuffix = $cargoVersion
|
|
cmd:cargo_fmt = $cargoVersion
|
|
cmd:rls = $rlsVersion
|
|
cmd:rust_gdb = $portVersion
|
|
cmd:rust_lldb = $portVersion
|
|
cmd:rustc = $portVersion
|
|
cmd:rustdoc = $portVersion
|
|
cmd:rustfmt = $rustfmtVersion
|
|
"
|
|
REQUIRES="
|
|
haiku$secondaryArchSuffix
|
|
lib:libcrypto$secondaryArchSuffix
|
|
lib:libcurl$secondaryArchSuffix
|
|
lib:libssl$secondaryArchSuffix
|
|
lib:libz$secondaryArchSuffix
|
|
"
|
|
|
|
BUILD_REQUIRES="
|
|
haiku${secondaryArchSuffix}_devel
|
|
devel:libcurl$secondaryArchSuffix
|
|
devel:libssl$secondaryArchSuffix
|
|
devel:libz$secondaryArchSuffix
|
|
"
|
|
BUILD_PREREQUIRES="
|
|
cmd:cargo$secondaryArchSuffix == $cargoVersion
|
|
cmd:cmake
|
|
cmd:cmp
|
|
cmd:file
|
|
cmd:find
|
|
cmd:gcc$secondaryArchSuffix
|
|
cmd:git
|
|
cmd:grep
|
|
cmd:ld$secondaryArchSuffix
|
|
cmd:make
|
|
cmd:pkg_config$secondaryArchSuffix
|
|
cmd:python
|
|
cmd:rustc == $portVersion
|
|
cmd:sed
|
|
cmd:tar
|
|
cmd:which
|
|
cmd:xargs
|
|
"
|
|
|
|
BUILD()
|
|
{
|
|
# write the build configuration
|
|
tr -d '\t' >config.toml <<- EOL
|
|
[llvm]
|
|
targets = "X86"
|
|
experimental-targets = ""
|
|
|
|
[build]
|
|
cargo = "/$relativeBinDir/cargo"
|
|
rustc = "/boot/system/bin/rustc"
|
|
submodules = false
|
|
extended = true
|
|
tools = ["cargo", "rls", "rustfmt", "analysis"]
|
|
|
|
[install]
|
|
prefix = "$prefix"
|
|
libdir = "$relativeLibDir"
|
|
mandir = "$relativeManDir"
|
|
docdir = "$relativeDevelopDocDir"
|
|
sysconfdir = "$relativeDataDir"
|
|
|
|
[rust]
|
|
channel = "stable"
|
|
use-jemalloc = false
|
|
rpath = false
|
|
deny-warnings = false
|
|
dist-src = false
|
|
|
|
[dist]
|
|
src-tarball = false
|
|
EOL
|
|
# Disable ASLR: compiling stage 1 rustc requires a lot of RAM (about 1.5
|
|
# GB). Haiku has a per-process limit of 2GB on 32 bit systems. ASLR makes
|
|
# the available space even smaller. Disabling it will give us the space to
|
|
# compile Rust
|
|
export DISABLE_ASLR=1
|
|
|
|
# now build rust and cargo
|
|
./x.py dist
|
|
}
|
|
|
|
INSTALL()
|
|
{
|
|
# we will manually invoke the install scripts
|
|
if [ $effectiveTargetArchitecture = x86 ]; then
|
|
architecture="i686-unknown-haiku"
|
|
fi
|
|
if [ $effectiveTargetArchitecture = x86_64 ]; then
|
|
architecture="x86_64-unknown-haiku"
|
|
fi
|
|
|
|
# let's install the packages one by one
|
|
cd $sourceDir/build/tmp/dist/
|
|
for module in "rust-docs-$srcGitRev-$architecture" \
|
|
"rust-std-$srcGitRev-$architecture" \
|
|
"rustc-$srcGitRev-$architecture" \
|
|
"rust-analysis-$srcGitRev-$architecture" \
|
|
"cargo-$cargoVersion-$architecture" \
|
|
"rls-$rlsVersion-$architecture" \
|
|
"rustfmt-$rustfmtVersion-$architecture"
|
|
do
|
|
./$module/install.sh \
|
|
--prefix=$prefix \
|
|
--docdir=$developDocDir \
|
|
--libdir=$libDir \
|
|
--mandir=$manDir \
|
|
--sysconfdir=$dataDir \
|
|
--disable-ldconfig
|
|
done
|
|
|
|
# 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
|
|
ln -r -s $developLibDir/rustlib $prefix/lib/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
|
|
}
|
|
|
|
TEST()
|
|
{
|
|
./x.py test
|
|
}
|