mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
Rust: add version 1.51.0 (#5796)
This commit is contained in:
committed by
GitHub
parent
acbd472d84
commit
014d98c390
155
dev-lang/rust/patches/rust-1.51.0.patchset
Normal file
155
dev-lang/rust/patches/rust-1.51.0.patchset
Normal file
@@ -0,0 +1,155 @@
|
||||
From 36c66e7faaaecea5b40cbd99d331fd6d9cf0ef32 Mon Sep 17 00:00:00 2001
|
||||
From: Niels Sascha Reedijk <niels.reedijk@gmail.com>
|
||||
Date: Thu, 25 Mar 2021 16:51:24 +0000
|
||||
Subject: Patches for Haiku for Rust 1.51.0
|
||||
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 2b68f72..1ed6856 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -893,9 +893,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "curl-sys"
|
||||
-version = "0.4.39+curl-7.74.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "07a8ce861e7b68a0b394e814d7ee9f1b2750ff8bd10372c6ad3bacc10e86f874"
|
||||
+version = "0.4.40+curl-7.75.0"
|
||||
+source = "git+https://github.com/alexcrichton/curl-rust?rev=15a48d2346cb1d28d76bcbdde42bfb2c6e62c621#15a48d2346cb1d28d76bcbdde42bfb2c6e62c621"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1887,8 +1886,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.2"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
|
||||
+source = "git+https://github.com/nielx/libz-sys?tag=1.1.2-haiku#15004cb938fd0d8591aea3227b71743171cd9a1e"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -4778,13 +4776,12 @@ checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
-version = "0.3.16"
|
||||
+version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "7fd8b795c389288baa5f355489c65e71fd48a02104600d15c4cfbc561e9e429d"
|
||||
+checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
|
||||
dependencies = [
|
||||
- "cfg-if 0.1.10",
|
||||
+ "cfg-if 1.0.0",
|
||||
"libc",
|
||||
- "redox_syscall",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index f961d3e..639e4b2 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -106,5 +106,9 @@ rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
|
||||
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
|
||||
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
|
||||
|
||||
+# Build fix for cross-compiling Rust for Haiku
|
||||
+libz-sys = { git = 'https://github.com/nielx/libz-sys', tag = "1.1.2-haiku" }
|
||||
+curl-sys = { git = 'https://github.com/alexcrichton/curl-rust', rev = "15a48d2346cb1d28d76bcbdde42bfb2c6e62c621" }
|
||||
+
|
||||
[patch."https://github.com/rust-lang/rust-clippy"]
|
||||
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
|
||||
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs
|
||||
index cda17eb..d9131e6 100644
|
||||
--- a/library/std/src/sys/unix/thread.rs
|
||||
+++ b/library/std/src/sys/unix/thread.rs
|
||||
@@ -176,7 +176,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/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs
|
||||
index dec8862..516c3b2 100644
|
||||
--- a/library/std/src/sys/windows/c.rs
|
||||
+++ b/library/std/src/sys/windows/c.rs
|
||||
@@ -270,7 +270,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/library/std/src/sys/windows/thread.rs b/library/std/src/sys/windows/thread.rs
|
||||
index 38839ea..7bb8c95 100644
|
||||
--- a/library/std/src/sys/windows/thread.rs
|
||||
+++ b/library/std/src/sys/windows/thread.rs
|
||||
@@ -70,10 +70,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/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
|
||||
index 0d004a5..7d8c1e2 100644
|
||||
--- a/library/std/src/thread/mod.rs
|
||||
+++ b/library/std/src/thread/mod.rs
|
||||
@@ -1356,11 +1356,6 @@ impl<T> JoinHandle<T> {
|
||||
/// [`Err`]: crate::result::Result::Err
|
||||
/// [atomic memory orderings]: crate::sync::atomic
|
||||
///
|
||||
- /// # 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
|
||||
///
|
||||
/// ```
|
||||
diff --git a/src/llvm-project/llvm/lib/Support/CMakeLists.txt b/src/llvm-project/llvm/lib/Support/CMakeLists.txt
|
||||
index 17bef02..e36da10 100644
|
||||
--- a/src/llvm-project/llvm/lib/Support/CMakeLists.txt
|
||||
+++ b/src/llvm-project/llvm/lib/Support/CMakeLists.txt
|
||||
@@ -36,6 +36,10 @@ elseif( CMAKE_HOST_UNIX )
|
||||
if( FUCHSIA )
|
||||
set(system_libs ${system_libs} zircon)
|
||||
endif()
|
||||
+ if ( HAIKU )
|
||||
+ add_definitions(-D_BSD_SOURCE)
|
||||
+ set(system_libs ${system_libs} bsd)
|
||||
+ endif()
|
||||
endif( MSVC OR MINGW )
|
||||
|
||||
# Delay load shell32.dll if possible to speed up process startup.
|
||||
diff --git a/src/llvm-project/llvm/lib/Support/Unix/Program.inc b/src/llvm-project/llvm/lib/Support/Unix/Program.inc
|
||||
index 8f41fc0..950416d 100644
|
||||
--- a/src/llvm-project/llvm/lib/Support/Unix/Program.inc
|
||||
+++ b/src/llvm-project/llvm/lib/Support/Unix/Program.inc
|
||||
@@ -448,8 +448,12 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
|
||||
if (ProcStat) {
|
||||
std::chrono::microseconds UserT = toDuration(Info.ru_utime);
|
||||
std::chrono::microseconds KernelT = toDuration(Info.ru_stime);
|
||||
+#ifndef __HAIKU__
|
||||
uint64_t PeakMemory = static_cast<uint64_t>(Info.ru_maxrss);
|
||||
*ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory};
|
||||
+#else
|
||||
+ *ProcStat = ProcessStatistics{UserT + KernelT, UserT, 0};
|
||||
+#endif
|
||||
}
|
||||
|
||||
// Return the proper exit status. Detect error conditions
|
||||
--
|
||||
2.30.0
|
||||
|
||||
168
dev-lang/rust/rust-1.51.0.recipe
Normal file
168
dev-lang/rust/rust-1.51.0.recipe
Normal 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="2021 The Rust Project Developers"
|
||||
LICENSE="MIT"
|
||||
REVISION="1"
|
||||
cargoVersion="0.52.0"
|
||||
rustfmtVersion="1.4.36"
|
||||
clippyVersion="0.1.51"
|
||||
SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz"
|
||||
CHECKSUM_SHA256="92c68a91fca33cbafb83442cde722d010cc387dc1ee8a2680e2fb33a575821a1"
|
||||
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_analyzer$secondaryArchSuffix = $portVersion
|
||||
cmd:rust_gdb$secondaryArchSuffix = $portVersion
|
||||
cmd:rust_gdbgui$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 = $portVersion
|
||||
cmd:clippy_driver$secondaryArchSuffix = $clippyVersion
|
||||
cmd:miri$secondaryArchSuffix = $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:python3
|
||||
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", "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" \
|
||||
"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
|
||||
}
|
||||
101
dev-lang/rust_bin/rust_bin-1.51.0.recipe
Normal file
101
dev-lang/rust_bin/rust_bin-1.51.0.recipe
Normal 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="2021 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="135992f9a8e74820f3afb0107ea256a9e56268a1c9f5603f6de6e57fc9b006d2"
|
||||
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="10750ce0b7404f41c6e8ee894a4870c480a0e8220a45b1b8e12e69da990cdc7a"
|
||||
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="4a85027872d625661d9078920857361b2c581c4b3fe0622f2d315ee31dd4d3be"
|
||||
SOURCE_DIR="rustc-$portVersion-src"
|
||||
;;
|
||||
esac
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
DISABLE_SOURCE_PACKAGE=yes
|
||||
|
||||
cargoVersion="0.52.0"
|
||||
rustfmtVersion="1.4.36"
|
||||
clippyVersion="0.1.51"
|
||||
|
||||
PROVIDES="
|
||||
rust_bin$secondaryArchSuffix = $portVersion
|
||||
cmd:rustc$secondaryArchSuffix = $portVersion
|
||||
cmd:rustdoc$secondaryArchSuffix = $portVersion
|
||||
cmd:rustfmt$secondaryArchSuffix = $portVersion
|
||||
cmd:rust_analyzer$secondaryArchSuffix = $portVersion
|
||||
cmd:rust_gdb$secondaryArchSuffix = $portVersion
|
||||
cmd:rust_gdbgui$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 = $portVersion
|
||||
cmd:clippy_driver$secondaryArchSuffix = $clippyVersion
|
||||
cmd:miri$secondaryArchSuffix = $portVersion
|
||||
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 cargo-miri clippy-driver miri \
|
||||
rust-analyzer rust-gdb rust-gdbgui 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