From cb4d04a67e55607dbb4c7d31bfb9589bab87d7b5 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sun, 16 Feb 2020 13:36:33 +0000 Subject: [PATCH] Rust: add recipe for 1.41.0 (#4706) --- dev-lang/rust/patches/rust-1.41.0.patchset | 82 ++++++++++ dev-lang/rust/rust-1.41.0.recipe | 171 +++++++++++++++++++++ dev-lang/rust_bin/rust_bin-1.41.0.recipe | 101 ++++++++++++ 3 files changed, 354 insertions(+) create mode 100644 dev-lang/rust/patches/rust-1.41.0.patchset create mode 100644 dev-lang/rust/rust-1.41.0.recipe create mode 100644 dev-lang/rust_bin/rust_bin-1.41.0.recipe diff --git a/dev-lang/rust/patches/rust-1.41.0.patchset b/dev-lang/rust/patches/rust-1.41.0.patchset new file mode 100644 index 000000000..c9e311b27 --- /dev/null +++ b/dev-lang/rust/patches/rust-1.41.0.patchset @@ -0,0 +1,82 @@ +From 9d592e5355a60c8142bf32d834e98278c9275bf0 Mon Sep 17 00:00:00 2001 +From: Niels Sascha Reedijk +Date: Sun, 2 Feb 2020 01:16:13 +0100 +Subject: Haiku-specific patches for Rust 1.41.0 + + +diff --git a/Cargo.lock b/Cargo.lock +index 1af0442..ef37feb 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -1822,9 +1822,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 a5b34ee..75d0d13 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 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 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 0c632d2..025891d 100644 +--- a/src/libstd/thread/mod.rs ++++ b/src/libstd/thread/mod.rs +@@ -1447,11 +1447,6 @@ impl JoinHandle { + /// [`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 + diff --git a/dev-lang/rust/rust-1.41.0.recipe b/dev-lang/rust/rust-1.41.0.recipe new file mode 100644 index 000000000..4e47ee7ca --- /dev/null +++ b/dev-lang/rust/rust-1.41.0.recipe @@ -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="2018 The Rust Project Developers" +LICENSE="MIT" +REVISION="1" +cargoVersion="0.42.0" +rlsVersion="1.41.0" +rustfmtVersion="1.4.11" +clippyVersion="0.0.212" +miriVersion="0.1.0" + SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz" +CHECKSUM_SHA256="38d6742e5c4c98a835de5d6e12a209e442fb3078a03b2c01bab6ea7afb25be6f" +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 +} diff --git a/dev-lang/rust_bin/rust_bin-1.41.0.recipe b/dev-lang/rust_bin/rust_bin-1.41.0.recipe new file mode 100644 index 000000000..760fcb853 --- /dev/null +++ b/dev-lang/rust_bin/rust_bin-1.41.0.recipe @@ -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="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="330e9655fe3a0eefc6ec845dea4aff6328fda0d89f4fea0988ead63e5e52ae25" +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="3b2ab6d7632925b5722a5a343f0a452c74819c35d6f19d6af03617edc59e0cc5" +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="e0944d34b5b78229c65670d6d9874d61ae79ecacb9c217119143fa7320a0cabc" +SOURCE_DIR="rustc-$portVersion-src" + ;; +esac + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +SECONDARY_ARCHITECTURES="x86" +DISABLE_SOURCE_PACKAGE=yes + +cargoVersion="0.42.0" +rlsVersion="1.41.0" +rustfmtVersion="1.4.11" +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 +}