Rust: add recipe for 1.43.0 (#4906)

This commit is contained in:
Niels Sascha Reedijk
2020-04-25 17:02:35 +01:00
committed by GitHub
parent 657aeaaafc
commit 521e8b287c
3 changed files with 366 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
From 50f71172e83f63750c7e2090630186f66c9194fa Mon Sep 17 00:00:00 2001
From: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Date: Sat, 25 Apr 2020 13:03:58 +0100
Subject: Add Haiku-specific patches for Rust 1.43.0
diff --git a/Cargo.lock b/Cargo.lock
index d41517c..480cbc6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1056,9 +1056,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "filetime"
-version = "0.2.8"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
+checksum = "f59efc38004c988e4201d11d263b8171f49a2e7ec0bdbb71773433f271504a5e"
dependencies = [
"cfg-if",
"libc",
@@ -1760,9 +1760,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
[[package]]
name = "libc"
-version = "0.2.66"
+version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
+checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
dependencies = [
"rustc-std-workspace-core",
]
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index 674d4c7..35992cb 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -183,7 +183,7 @@ impl Thread {
unsafe {
let ret = libc::pthread_join(self.id, ptr::null_mut());
mem::forget(self);
- assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret));
+ debug_assert_eq!(ret, 0);
}
}
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 4d37734..592a065 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -255,7 +255,6 @@ pub const FILE_END: DWORD = 2;
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
pub const WAIT_TIMEOUT: DWORD = 258;
-pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs
index c828243..891cd4c 100644
--- a/src/libstd/sys/windows/thread.rs
+++ b/src/libstd/sys/windows/thread.rs
@@ -65,10 +65,7 @@ impl Thread {
}
pub fn join(self) {
- let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
- if rc == c::WAIT_FAILED {
- panic!("failed to join on thread: {}", io::Error::last_os_error());
- }
+ unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
}
pub fn yield_now() {
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 0dc43c7..13dd5a7 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -1465,11 +1465,6 @@ impl<T> JoinHandle<T> {
/// [`panic`]: ../../std/macro.panic.html
/// [atomic memory orderings]: ../../std/sync/atomic/index.html
///
- /// # Panics
- ///
- /// This function may panic on some platforms if a thread attempts to join
- /// itself or otherwise may create a deadlock with joining threads.
- ///
/// # Examples
///
/// ```
--
2.19.0

View File

@@ -0,0 +1,171 @@
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="2"
cargoVersion="0.44.0"
rlsVersion="1.41.0"
rustfmtVersion="1.4.12"
clippyVersion="0.0.212"
miriVersion="0.1.0"
SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz"
CHECKSUM_SHA256="d0899933840369f07394b211cb0b53a5cd4634907633f0bee541133c8b75e309"
SOURCE_DIR="rustc-$portVersion-src"
PATCHES="rust-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
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:cargo_miri$secondaryArchSuffix = $miriVersion
cmd:clippy_driver$secondaryArchSuffix = $clippyVersion
cmd:miri$secondaryArchSuffix = $miriVersion
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" \
"miri-$miriVersion-$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 miri cargo-miri; 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
}

View File

@@ -0,0 +1,101 @@
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"
case "$effectiveTargetArchitecture" in
x86)
SOURCE_URI="http://dl.rust-on-haiku.com/dist/$portVersion/rust-$portVersion-i686-unknown-haiku.tar.xz"
CHECKSUM_SHA256="f7ed469585c3ef89d011d80fbc7824b4643c6a0dd89c9f965cadfcf4dc7c8f86"
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="c28abfa60abf652014e7e43e86cb9bee086b033d1770503ab910fe7e8c708853"
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="55ffb85d1055258d725d3fc01d9a780fb9e924c805e27f368546f0b5ea292126"
SOURCE_DIR="rustc-$portVersion-src"
;;
esac
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
DISABLE_SOURCE_PACKAGE=yes
cargoVersion="0.44.0"
rlsVersion="1.41.0"
rustfmtVersion="1.4.12"
clippyVersion="0.0.212"
miriVersion="0.1.0"
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:cargo_miri$secondaryArchSuffix = $miriVersion
cmd:clippy_driver$secondaryArchSuffix = $clippyVersion
cmd:miri$secondaryArchSuffix = $miriVersion
cmd:rls$secondaryArchSuffix = $rlsVersion
cmd:rustfmt = $rustfmtVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
CONFLICTS="
rust$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
relativeInstallDir="develop/tools$secondaryArchSubDir/rust"
installDir="$prefix/$relativeInstallDir"
INSTALL()
{
./install.sh \
--prefix=$installDir \
--docdir=$developDocDir \
--mandir=$manDir \
--sysconfdir=$dataDir \
--disable-ldconfig
# 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 miri cargo-miri; 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
}