mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-12 23:00:10 +02:00
x86_64 is used as a baseline: the "x86_64" entry, whatever status it has, is transformed into "all", and then the other entries in ARCHITECTURES either dropped or rearranged appropriately.
211 lines
7.6 KiB
Bash
211 lines
7.6 KiB
Bash
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.20.0"
|
|
srcGitRev="1.19.0"
|
|
SOURCE_URI="https://github.com/rust-lang/rust/archive/$srcGitRev.tar.gz"
|
|
CHECKSUM_SHA256="7e1ecb476118b79b5abed02bc7a724bb65413057e26f1d2b8538c572f7463be0"
|
|
SOURCE_FILENAME="rust-$srcGitRev.tar.gz"
|
|
SOURCE_DIR="rust-$srcGitRev"
|
|
srcGitRev_2="c8a8767c56ad3d3f4eb45c87b95026936fb9aa35"
|
|
SOURCE_URI_2="https://github.com/rust-lang/compiler-rt/archive/$srcGitRev_2.tar.gz"
|
|
CHECKSUM_SHA256_2="ac595c03dd5dcd3ad66eee76bec2e95770259e4aa4db5df875c2bbcf7781a441"
|
|
srcGitRev_3="b4ff403041f17957f735ad750c3241a3a428b9b7"
|
|
SOURCE_URI_3="https://github.com/rust-lang/rust-installer/archive/$srcGitRev_3.tar.gz"
|
|
CHECKSUM_SHA256_3="dfcce5a555e0aff5f7ba7681968b77529c806c3109ede78eb1b45a0c4455db4b"
|
|
srcGitRev_4="da282f1bb7277b4d30fa1599ee29ad8eb4dd2a92"
|
|
SOURCE_URI_4="https://github.com/rust-lang/hoedown/archive/$srcGitRev_4.tar.gz"
|
|
CHECKSUM_SHA256_4="623889a326754e93a4a7a8a3487699ea786f4ca9b118f7468c12f8b9966905e6"
|
|
srcGitRev_5="03562b0cb26a00f49d4eaf18ca3e49608110b0c8"
|
|
SOURCE_URI_5="https://github.com/rust-lang/libc/archive/$srcGitRev_5.tar.gz"
|
|
CHECKSUM_SHA256_5="2ecccc8810c1e84e1b8bbcb564c96d1df5aefce13663efc006621a30685a9e4f"
|
|
srcGitRev_6="2153316469829c338eab18835b879d01c3a986a8"
|
|
SOURCE_URI_6="https://github.com/rust-lang/llvm/archive/$srcGitRev_6.tar.gz"
|
|
CHECKSUM_SHA256_6="495850c84eab4f20277a839a12283dd27fb9e61daf0c7dec0e76d1bc1a5a437b"
|
|
SOURCE_URI_7="https://github.com/rust-lang/cargo/archive/$cargoVersion.tar.gz"
|
|
CHECKSUM_SHA256_7="f0e21d23cffd3510ba8a65e6a4d1010073afc0e573d9d92c23d22b868ca0bc42"
|
|
srcGitRev_8="c0e8c56d76bdf6bd16c64338f81c04d48c60f117"
|
|
SOURCE_URI_8="https://github.com/rust-lang-nursery/nomicon/archive/$srcGitRev_8.tar.gz"
|
|
CHECKSUM_SHA256_8="a15a4bbc86a207e9cc9604ed0f7a7039f9365034063096e4f6e44eb8832fffec"
|
|
srcGitRev_9="876582e9d0fbdc9cecb03133c28db96e9ff8c844"
|
|
SOURCE_URI_9="https://github.com/rust-lang-nursery/reference/archive/$srcGitRev_9.tar.gz"
|
|
CHECKSUM_SHA256_9="0c5e47826948cf30345cd5c09f237566dfc995b7f1f2c8751e306c5488f05ecb"
|
|
srcGitRev_10="ad7de198561b3a12217ea2da76d796d9c7fc0ed3"
|
|
SOURCE_URI_10="https://github.com/rust-lang/book/archive/$srcGitRev_10.tar.gz"
|
|
CHECKSUM_SHA256_10="31d77c9ccb2924f8381a09b6eb8b7efe74fbc280c581a21728e0c50878413ec0"
|
|
srcGitRev_11="bfe80cfa8db75500e67ca8762465d27662674637"
|
|
SOURCE_URI_11="https://github.com/rust-lang-nursery/rls/archive/$srcGitRev_11.tar.gz"
|
|
CHECKSUM_SHA256_11="666ba8fb85cd875471ba1d71c9e674516cd7891ea954721276a9a99a1e4aa7d8"
|
|
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_5="rust-libc-$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: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.19.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.18.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 src/tools/cargo src/compiler-rt src/llvm src/tools/rust-installer \
|
|
src/liblibc src/rt/hoedown src/doc/nomicon src/doc/reference \
|
|
src/doc/book src/tools/rls
|
|
cp -r /sources-2/compiler-rt-$srcGitRev_2 src/compiler-rt
|
|
cp -r /sources-3/rust-installer-$srcGitRev_3 src/tools/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 src/tools/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 src/tools/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"
|
|
sysconfdir = "$relativeDataDir"
|
|
|
|
[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
|
|
./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"
|
|
do
|
|
./$module/install.sh \
|
|
--prefix=$prefix \
|
|
--docdir=$developDocDir \
|
|
--libdir=$libDir \
|
|
--mandir=$manDir \
|
|
--sysconfdir=$dataDir \
|
|
--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
|
|
fi
|
|
|
|
# remove zsh data, it is not used on Haiku anyway
|
|
rm -rf $prefix/share
|
|
|
|
# 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-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
|
|
}
|