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="2017, The Rust Project Developers" LICENSE="MIT" REVISION="2" cargoVersion="0.19.0" srcGitRev="1.18.0" SOURCE_URI="https://github.com/rust-lang/rust/archive/$srcGitRev.tar.gz" CHECKSUM_SHA256="77720ad4bf93175a73a94507fbf68c669bb66cf7c9a071f59a25510a4dfa1dbd" SOURCE_FILENAME="rust-$srcGitRev.tar.gz" SOURCE_DIR="rust-$srcGitRev" srcGitRev_2="d812b1641f798e38de9fa372476d42cdb6908c01" SOURCE_URI_2="https://github.com/rust-lang/compiler-rt/archive/$srcGitRev_2.tar.gz" CHECKSUM_SHA256_2="a1d7a2c248c01499518f54735038030651c62fe8f0d580987ac52be20a13e93b" srcGitRev_3="4f994850808a572e2cc8d43f968893c8e942e9bf" SOURCE_URI_3="https://github.com/rust-lang/rust-installer/archive/$srcGitRev_3.tar.gz" CHECKSUM_SHA256_3="dc7240d60a869fa24a68c8734fb7c810c27cca0a6dad52df6279865e4e8e7fae" srcGitRev_4="da282f1bb7277b4d30fa1599ee29ad8eb4dd2a92" SOURCE_URI_4="https://github.com/rust-lang/hoedown/archive/$srcGitRev_4.tar.gz" CHECKSUM_SHA256_4="623889a326754e93a4a7a8a3487699ea786f4ca9b118f7468c12f8b9966905e6" srcGitRev_5="c34a802d1eb037b44c5252078c7270b5472e0f65" SOURCE_URI_5="https://github.com/rust-lang/libc/archive/$srcGitRev_5.tar.gz" CHECKSUM_SHA256_5="3616106943b3d3a345fc85ec02e9e125f80f60ea2f9384d4c5d6286c7142cfbd" srcGitRev_6="2e951c3ae354bcbd2e50b30798e232949a926b75" SOURCE_URI_6="https://github.com/rust-lang/llvm/archive/$srcGitRev_6.tar.gz" CHECKSUM_SHA256_6="a85cc4847370573d194af95d6794304479d1024863c754d9b4e2499478c41393" SOURCE_URI_7="https://github.com/rust-lang/cargo/archive/$cargoVersion.tar.gz" CHECKSUM_SHA256_7="9ea59d17a7fa81aa4bdefa2bb45a5315219414386753eaf0988cadd465550b40" srcGitRev_8="616b98444ff4eb5260deee95ee3e090dfd98b947" SOURCE_URI_8="https://github.com/rust-lang-nursery/nomicon/archive/$srcGitRev_8.tar.gz" CHECKSUM_SHA256_8="ee080d47da2204094195362d91818cd56350c9c7e0969d78fc6d55c59529fce4" srcGitRev_9="6b0de90d87dda15e323ef24cdf7ed873ac5cf4d3" SOURCE_URI_9="https://github.com/rust-lang-nursery/reference/archive/$srcGitRev_9.tar.gz" CHECKSUM_SHA256_9="7fca934f5ab6c08ba38376a6847cf6c6a1405794148d107bffa715c46f634bb4" srcGitRev_10="ad7de198561b3a12217ea2da76d796d9c7fc0ed3" SOURCE_URI_10="https://github.com/rust-lang/book/archive/$srcGitRev_10.tar.gz" CHECKSUM_SHA256_10="31d77c9ccb2924f8381a09b6eb8b7efe74fbc280c581a21728e0c50878413ec0" srcGitRev_11="6ecff95fdc3ee7ceed2b9b0cc1a3a64876860bce" SOURCE_URI_11="https://github.com/rust-lang-nursery/rls/archive/$srcGitRev_11.tar.gz" CHECKSUM_SHA256_11="e1ad31337422f9b05f57f43266048935f246cc35ca53671feceb9e6208bc4b40" srcGitRev_12="0.1.6" SOURCE_URI_12="https://github.com/alexcrichton/cargo-vendor/archive/$srcGitRev_12.tar.gz" CHECKSUM_SHA256_12="927f6b782f0be32c6027335bbd49fb40cffa922095ffacc9a0aca78e45023f1a" PATCHES="rust-$portVersion.patchset" PATCHES_3="rust-installer-$portVersion.patchset" PATCHES_7="cargo-$cargoVersion.patchset" PATCHES_11="rust-rls-$portVersion.patchset" PATCHES_12="cargo-vendor-$srcGitRev_12.patchset" ARCHITECTURES="all !x86_gcc2 ?x86" SECONDARY_ARCHITECTURES="x86" PROVIDES=" rust$secondaryArchSuffix = $portVersion cmd:cargo$secondaryArchSuffix = $cargoVersion cmd:rls$secondaryArchSuffix = $portVersion cmd:rust_gdb = $portVersion cmd:rust_lldb = $portVersion cmd:rustc = $portVersion cmd:rustdoc = $portVersion " 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 == 0.18.0 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 == 1.17.0 cmd:sed cmd:tar cmd:which cmd:xargs " BUILD() { # With the new build system, Rust always makes a tarball with the source # In older recipes we symlinked the other git submodules, now we have to # copy them rm -rf cargo src/compiler-rt src/llvm src/rust-installer \ src/liblibc src/rt/hoedown src/doc/nomicon src/doc/reference \ src/doc/book rls cp -r /sources-2/compiler-rt-$srcGitRev_2 src/compiler-rt cp -r /sources-3/rust-installer-$srcGitRev_3 src/rust-installer cp -r /sources-4/hoedown-$srcGitRev_4 src/rt/hoedown cp -r /sources-5/libc-$srcGitRev_5 src/liblibc cp -r /sources-6/llvm-$srcGitRev_6 src/llvm cp -r /sources-7/cargo-$cargoVersion cargo cp -r /sources-8/nomicon-$srcGitRev_8 src/doc/nomicon cp -r /sources-9/reference-$srcGitRev_9 src/doc/reference cp -r /sources-10/book-$srcGitRev_10 src/doc/book cp -r /sources-11/rls-$srcGitRev_11 rls # write the build configuration cat >config.toml <<- EOL [llvm] targets = "X86" [build] cargo = "/$relativeBinDir/cargo" rustc = "/boot/system/bin/rustc" submodules = false extended = true [install] prefix = "$prefix" libdir = "$relativeLibDir" mandir = "$relativeManDir" docdir = "$relativeDevelopDocDir" [rust] channel = "stable" use-jemalloc = false rpath = false EOL # the install step of rust depends on the cargo vendor command # build it separately here cd /sources-12/cargo-vendor-$srcGitRev_12 cargo install --force # now build rust and cargo cd /sources/rust-$srcGitRev # Note: in the previous recipe the --verbose flag was added, but # this causes a bug in the Rust build. See issue #42543 on github ./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 /sources/rust-$srcGitRev/build/tmp/dist/ for module in "rust-docs-$srcGitRev-$architecture" \ "rust-std-$srcGitRev-$architecture" \ "rustc-$srcGitRev-$architecture" \ "rust-analysis-$srcGitRev-$architecture" \ "cargo-$cargoVersion-$architecture" \ "rls-0.1.0-$architecture" do ./$module/install.sh \ --prefix=$prefix \ --docdir=$developDocDir \ --libdir=$libDir \ --mandir=$manDir \ --disable-ldconfig done # move the cargo and binaries (in case of a secondary arch) if [ -n "$secondaryArchSuffix" ]; then mkdir -p $binDir mv $prefix/bin/cargo $binDir/cargo mv $prefix/bin/rls $binDir/rls fi # move other cargo artifacts mkdir -p $dataDir mv $prefix/share/zsh $dataDir mv $prefix/etc/bash_completions.d $dataDir rm -rf $prefix/share $prefix/etc # move the `rustlib` folder to the developLibDirs (as it is a framework of sorts) # do create a link in $prefix/lib as that is where rustc expects things to live # Note; this actually seems to be a bug in the Rust build system. The path # to rustlib is hardcoded in the rustc binary, but it does allow it to be # set to libdir_relative (see config.rs in the bootstrap tool). This variable # is only set when the configure script is used to generate the config, not # with config.toml mkdir -p $developLibDir mv $libDir/rustlib $developLibDir cd $prefix/lib ln -s $developLibDir/rustlib rustlib # clean out unneccesary files created by the rust installer rm $developLibDir/rustlib/components rm $developLibDir/rustlib/install.log rm $developLibDir/rustlib/manifest-cargo rm $developLibDir/rustlib/manifest-rls rm $developLibDir/rustlib/manifest-rust-analysis-*haiku rm $developLibDir/rustlib/manifest-rust-docs rm $developLibDir/rustlib/manifest-rust-std-*-haiku rm $developLibDir/rustlib/manifest-rustc rm $developLibDir/rustlib/rust-installer-version rm $developLibDir/rustlib/uninstall.sh } TEST() { make check }