mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
Rust: add recipe for 1.40.0 (#4491)
This commit is contained in:
committed by
waddlesplash
parent
4a9415d265
commit
76d6654067
84
dev-lang/rust/patches/rust-1.40.0.patchset
Normal file
84
dev-lang/rust/patches/rust-1.40.0.patchset
Normal file
@@ -0,0 +1,84 @@
|
||||
From 0bb583ffd38715fe48644e1ef9cbe9387578ac2c Mon Sep 17 00:00:00 2001
|
||||
From: Niels Sascha Reedijk <niels.reedijk@gmail.com>
|
||||
Date: Wed, 25 Dec 2019 14:21:38 +0100
|
||||
Subject: Haiku-specific patches for Rust 1.40.0
|
||||
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index f44ed3d..db0550e 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -1644,9 +1644,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libssh2-sys"
|
||||
-version = "0.2.11"
|
||||
+version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d"
|
||||
+checksum = "5fcd5a428a31cbbfe059812d74f4b6cd3b9b7426c2bdaec56993c5365da1c328"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
|
||||
index 72b0ac4..f97db49 100644
|
||||
--- a/src/libstd/sys/unix/thread.rs
|
||||
+++ b/src/libstd/sys/unix/thread.rs
|
||||
@@ -177,8 +177,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 b1f9d97..c07af0f 100644
|
||||
--- a/src/libstd/sys/windows/c.rs
|
||||
+++ b/src/libstd/sys/windows/c.rs
|
||||
@@ -254,7 +254,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 ebdf361..de198a6 100644
|
||||
--- a/src/libstd/sys/windows/thread.rs
|
||||
+++ b/src/libstd/sys/windows/thread.rs
|
||||
@@ -58,11 +58,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 0ffa6ac..490cb00 100644
|
||||
--- a/src/libstd/thread/mod.rs
|
||||
+++ b/src/libstd/thread/mod.rs
|
||||
@@ -1435,11 +1435,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
|
||||
|
||||
167
dev-lang/rust/rust-1.40.0.recipe
Normal file
167
dev-lang/rust/rust-1.40.0.recipe
Normal file
@@ -0,0 +1,167 @@
|
||||
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"
|
||||
cargoVersion="0.41.0"
|
||||
rlsVersion="1.40.0"
|
||||
rustfmtVersion="1.4.9"
|
||||
clippyVersion="0.0.212"
|
||||
SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz"
|
||||
CHECKSUM_SHA256="6e2aa3a91697f4b225c6b394cbae6b97666f061dba491f666a5281698fe2aace"
|
||||
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: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
|
||||
}
|
||||
98
dev-lang/rust_bin/rust_bin-1.40.0.recipe
Normal file
98
dev-lang/rust_bin/rust_bin-1.40.0.recipe
Normal 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="32210ca61ecc307eea0a05a1edb8b0b81e81228189d3119a40cea3f671265cd9"
|
||||
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="b0440494645b7aa5b9037897102f200e2f2563326032077fa411fc4bfb3ddb10"
|
||||
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="67980649b5ac975e1a953b177d76b56ef7aeb7796b5248e59a0656621490228a"
|
||||
SOURCE_DIR="rustc-$portVersion-src"
|
||||
;;
|
||||
esac
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
DISABLE_SOURCE_PACKAGE=yes
|
||||
|
||||
cargoVersion="0.41.0"
|
||||
rlsVersion="1.40.0"
|
||||
rustfmtVersion="1.4.9"
|
||||
clippyVersion="0.0.212"
|
||||
|
||||
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
|
||||
"
|
||||
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; 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
|
||||
}
|
||||
Reference in New Issue
Block a user