mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-12 14:50:08 +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.
168 lines
4.6 KiB
Bash
168 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="2020 The Rust Project Developers"
|
|
LICENSE="MIT"
|
|
REVISION="1"
|
|
cargoVersion="0.46.0"
|
|
rlsVersion="1.41.0"
|
|
rustfmtVersion="1.4.15"
|
|
clippyVersion="0.0.212"
|
|
SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz"
|
|
CHECKSUM_SHA256="c436034db42bc0ea7e7f32816ac6555b70d1f76c834407597966dfaf2ec839d6"
|
|
SOURCE_DIR="rustc-$portVersion-src"
|
|
PATCHES="rust-$portVersion.patchset"
|
|
|
|
ARCHITECTURES="?all !x86_gcc2"
|
|
SECONDARY_ARCHITECTURES="?x86"
|
|
|
|
PROVIDES="
|
|
rust_bin$secondaryArchSuffix = $portVersion
|
|
cmd:rustc$secondaryArchSuffix = $portVersion
|
|
cmd:rustdoc$secondaryArchSuffix = $portVersion
|
|
cmd:rustfmt$secondaryArchSuffix = $portVersion
|
|
cmd:rust_gdb$secondaryArchSuffix = $portVersion
|
|
cmd:rust_lldb$secondaryArchSuffix = $portVersion
|
|
cmd:cargo$secondaryArchSuffix = $cargoVersion
|
|
cmd:cargo_clippy$secondaryArchSuffix = $clippyVersion
|
|
cmd:cargo_fmt$secondaryArchSuffix = $cargoVersion
|
|
cmd:clippy_driver$secondaryArchSuffix = $clippyVersion
|
|
cmd:rls$secondaryArchSuffix = $rlsVersion
|
|
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$secondaryArchSuffix == $portVersion
|
|
cmd:sed
|
|
cmd:tar
|
|
cmd:which
|
|
cmd:xargs
|
|
"
|
|
|
|
relativeInstallDir="develop/tools$secondaryArchSubDir/rust"
|
|
installDir="$prefix/$relativeInstallDir"
|
|
|
|
BUILD()
|
|
{
|
|
# write the build configuration
|
|
tr -d '\t' >config.toml <<- EOL
|
|
[llvm]
|
|
targets = "X86"
|
|
experimental-targets = ""
|
|
|
|
[build]
|
|
cargo = "/$relativeBinDir/cargo"
|
|
rustc = "/$relativeBinDir/rustc"
|
|
submodules = false
|
|
extended = true
|
|
tools = ["cargo", "clippy", "rls", "rustfmt", "analysis"]
|
|
|
|
[install]
|
|
prefix = "$installDir"
|
|
libdir = "$installDir/bin/lib"
|
|
mandir = "$manDir"
|
|
docdir = "$developDocDir"
|
|
sysconfdir = "$dataDir"
|
|
|
|
[rust]
|
|
channel = "stable"
|
|
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" \
|
|
"clippy-$clippyVersion-$architecture" \
|
|
"rls-$rlsVersion-$architecture" \
|
|
"rustfmt-$rustfmtVersion-$architecture"
|
|
do
|
|
./$module/install.sh \
|
|
--prefix=$installDir \
|
|
--docdir=$developDocDir \
|
|
--mandir=$manDir \
|
|
--sysconfdir=$dataDir \
|
|
--disable-ldconfig
|
|
done
|
|
|
|
# move zsh data to the datadir
|
|
mv $installDir/share/zsh $dataDir
|
|
rm -rf $installDir/share
|
|
|
|
# clean out unneccesary files created by the rust installer
|
|
rm $installDir/lib/rustlib/components
|
|
rm $installDir/lib/rustlib/install.log
|
|
rm $installDir/lib/rustlib/manifest-*
|
|
rm $installDir/lib/rustlib/rust-installer-version
|
|
rm $installDir/lib/rustlib/uninstall.sh
|
|
|
|
# link the binaries in $binDir
|
|
mkdir -p $binDir
|
|
for f in cargo cargo-clippy cargo-fmt clippy-driver rls rust-gdb \
|
|
rust-lldb rustc rustdoc rustfmt; do
|
|
symlinkRelative -sfn $installDir/bin/$f $binDir
|
|
done
|
|
|
|
# make sure runtime_loader can find the libraries in the lib dir relative
|
|
# to the binaries
|
|
symlinkRelative -sfn $installDir/lib $installDir/bin/lib
|
|
}
|
|
|
|
TEST()
|
|
{
|
|
./x.py test
|
|
}
|