From 6e3a4028c7720b36a282eeffc33f1e2c23b8483a Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Wed, 5 Jun 2019 20:02:35 +0200 Subject: [PATCH] Rust: add recipe for 1.33.0 --- .../rust/patches/rust_x86-1.33.0.patchset | 173 ++++++++++++++++++ dev-lang/rust/rust-1.33.0.recipe | 167 +++++++++++++++++ dev-lang/rust_bin/rust_bin-1.33.0.recipe | 98 ++++++++++ 3 files changed, 438 insertions(+) create mode 100644 dev-lang/rust/patches/rust_x86-1.33.0.patchset create mode 100644 dev-lang/rust/rust-1.33.0.recipe create mode 100644 dev-lang/rust_bin/rust_bin-1.33.0.recipe diff --git a/dev-lang/rust/patches/rust_x86-1.33.0.patchset b/dev-lang/rust/patches/rust_x86-1.33.0.patchset new file mode 100644 index 000000000..5510c5ad7 --- /dev/null +++ b/dev-lang/rust/patches/rust_x86-1.33.0.patchset @@ -0,0 +1,173 @@ +From 8be1b79b06dae145da5300a17b59618e1db3b0d3 Mon Sep 17 00:00:00 2001 +From: Niels Sascha Reedijk +Date: Wed, 5 Jun 2019 20:01:20 +0200 +Subject: Add Haiku-specific patches for Rust 1.33.0 + + +diff --git a/Cargo.lock b/Cargo.lock +index 9f2bba2..c44be08 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -1164,7 +1164,7 @@ dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +- "libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libssh2-sys 0.2.11 (git+https://github.com/alexcrichton/ssh2-rs?rev=74d7f04)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1182,7 +1182,7 @@ dependencies = [ + [[package]] + name = "libssh2-sys" + version = "0.2.11" +-source = "registry+https://github.com/rust-lang/crates.io-index" ++source = "git+https://github.com/alexcrichton/ssh2-rs?rev=74d7f04#74d7f04dbee9997510bdad5608bb06970c6b4c8a" + dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1813,7 +1813,7 @@ name = "rand_chacha" + version = "0.1.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -1835,7 +1835,7 @@ name = "rand_hc" + version = "0.1.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -1860,7 +1860,7 @@ name = "rand_xorshift" + version = "0.1.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -3495,7 +3495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + "checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" + "checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1" + "checksum libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d75d7966bda4730b722d1eab8e668df445368a24394bae9fc1e8dc0ab3dbe4f4" +-"checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" ++"checksum libssh2-sys 0.2.11 (git+https://github.com/alexcrichton/ssh2-rs?rev=74d7f04)" = "" + "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" + "checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" + "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +diff --git a/Cargo.toml b/Cargo.toml +index cb3c0ee..1bb1bca 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -59,6 +59,7 @@ cargo = { path = "src/tools/cargo" } + # that we're shipping as well (to ensure that the rustfmt in RLS and the + # `rustfmt` executable are the same exact version). + rustfmt-nightly = { path = "src/tools/rustfmt" } ++libssh2-sys = { git = "https://github.com/alexcrichton/ssh2-rs", rev = "74d7f04" } + + # See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on + # here +diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs +index 889e1ec..f7166ef 100644 +--- a/src/librustc_driver/lib.rs ++++ b/src/librustc_driver/lib.rs +@@ -1443,9 +1443,14 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec 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 + /// + /// ``` +diff --git a/src/llvm/lib/Support/Unix/Signals.inc b/src/llvm/lib/Support/Unix/Signals.inc +index ad88d5e..9d320b7 100644 +--- a/src/llvm/lib/Support/Unix/Signals.inc ++++ b/src/llvm/lib/Support/Unix/Signals.inc +@@ -47,7 +47,9 @@ + #include "llvm/Support/raw_ostream.h" + #include + #include ++#define _BSD_SOURCE + #include ++#undef _BSD_SOURCE + #ifdef HAVE_BACKTRACE + # include BACKTRACE_HEADER // For backtrace(). + #endif +-- +2.19.0 + diff --git a/dev-lang/rust/rust-1.33.0.recipe b/dev-lang/rust/rust-1.33.0.recipe new file mode 100644 index 000000000..930c678b0 --- /dev/null +++ b/dev-lang/rust/rust-1.33.0.recipe @@ -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.34.0" +rlsVersion="1.33.0" +rustfmtVersion="1.0.1" +clippyVersion="0.0.212" +SOURCE_URI="https://static.rust-lang.org/dist/rustc-$portVersion-src.tar.xz" +CHECKSUM_SHA256="f4b1a72f1a29b23dcc9d7be5f60878f0434560513273906aa93dcd5c0de39b71" +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", "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 +} diff --git a/dev-lang/rust_bin/rust_bin-1.33.0.recipe b/dev-lang/rust_bin/rust_bin-1.33.0.recipe new file mode 100644 index 000000000..0712045b2 --- /dev/null +++ b/dev-lang/rust_bin/rust_bin-1.33.0.recipe @@ -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="a1c531502110c4cfedc9bab2f9211b43ac4d7ced553347c2be44a5868cb57d73" +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="10e428ac3e5fca6cfcbad19e715077bea4f4443434176d1d7fcb6eb2a0683967" +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="8a55b8f4cae1efb52594199b65a544fcb823914bb6bab05799820d54e4679d3a" +SOURCE_DIR="rustc-$portVersion-src" + ;; +esac + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +SECONDARY_ARCHITECTURES="x86" +DISABLE_SOURCE_PACKAGE=yes + +cargoVersion="0.34.0" +rlsVersion="1.33.0" +rustfmtVersion="1.0.1" +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 +}