Rust: add recipe for 1.28.0 (#2882)

This commit is contained in:
Niels Sascha Reedijk
2018-08-05 23:57:02 +02:00
committed by fbrosson
parent 76f74ca82b
commit d6ef4a6e22
3 changed files with 4167 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,168 @@
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="1"
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="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="?x86"
cargoVersion="0.29.0"
rlsVersion="0.128.0"
rustfmtVersion="0.8.2"
PROVIDES="
rust$secondaryArchSuffix = $portVersion
cmd:rustc = $portVersion
cmd:rustdoc = $portVersion
cmd:rust_gdb = $portVersion
cmd:rust_lldb = $portVersion
cmd:cargo$secondaryArchSuffix = $cargoVersion
cmd:cargo_fmt = $cargoVersion
cmd:rls = $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:git
cmd:gcc$secondaryArchSuffix
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
}

View File

@@ -0,0 +1,98 @@
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="1"
case "$effectiveTargetArchitecture" in
x86)
SOURCE_URI="http://dl.rust-on-haiku.com/dist/$portVersion/rust-$portVersion-i686-unknown-haiku.tar.xz"
CHECKSUM_SHA256="f7dd24059a6cc7375d1547c0e915c226ff52bff123c57e5e79e680ee0d90ce49"
SOURCE_DIR="rust-$portVersion-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="e26c564611ad920dcfad0c96bb86782afe29a684107afca908461ae09634b428"
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="f180eab88ea3139765bff9499ecbdb12d67a4f0b5fcbf86829f30b0a9a58fd8f"
SOURCE_DIR="rustc-$portVersion-src"
;;
esac
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
DISABLE_SOURCE_PACKAGE=yes
cargoVersion="0.29.0"
rlsVersion="0.128.0"
rustfmtVersion="0.8.2"
PROVIDES="
rust_bin$secondaryArchSuffix = $portVersion
cmd:rustc = $portVersion
cmd:rustdoc = $portVersion
cmd:rust_gdb = $portVersion
cmd:rust_lldb = $portVersion
cmd:cargo$secondaryArchSuffix = $cargoVersion
cmd:cargo_fmt = $cargoVersion
cmd:rls = $rlsVersion
cmd:rustfmt = $rustfmtVersion
"
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
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
}