0
0
Fork 0
haikuports/dev-lang/rust/rust-1.9.0.recipe

145 lines
5.4 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="2016, The Rust Project Developers"
LICENSE="MIT"
REVISION="1"
srcGitRev="cc71d3af918369b668c9cb9f092e13ed3e34671d"
SOURCE_URI="https://github.com/nielx/rust/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="25aae4f00f8be26125c5aab902c42bc17e06acbfa71f6218a02c73091ee95346"
SOURCE_FILENAME="rust-$srcGitRev.tar.gz"
SOURCE_DIR="rust-$srcGitRev"
srcGitRev_2="57315f7e07d09b6f0341ebbcd50dded6c20d782f"
SOURCE_URI_2="https://github.com/rust-lang/compiler-rt/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="244e97dbad67f752a4c394407e0929dbf44ed520a2dd9f19ebf86f2919112c3e"
srcGitRev_3="2686d1d16f4bbcb9e6310fc8d48b95ae12eb7643"
SOURCE_URI_3="https://github.com/nielx/llvm/archive/$srcGitRev_3.tar.gz"
CHECKSUM_SHA256_3="2492c7a1e04c47c99c8471f4f9b1ea5581887d969a7fbcbf33d2c9c7fb62f1bf"
srcGitRev_4="f96680f5a059069a320f62568d5afc88db9a7ec0"
SOURCE_URI_4="https://github.com/nielx/rust-installer/archive/$srcGitRev_4.tar.gz"
CHECKSUM_SHA256_4="d5f79186cd4b9221c07cf89b3f038aa073674e13ddd35f2e7e22486b8eb16020"
srcGitRev_5="4638c60dedfa581fd5fa7c6420d8f32274c9ca0b"
SOURCE_URI_5="https://github.com/rust-lang/hoedown/archive/$srcGitRev_5.tar.gz"
CHECKSUM_SHA256_5="a5a0a957544a5f8cf08c0b67cb503f294b0e1bb20c65766abf9dc3c683d3b9c5"
srcGitRev_6="a8510ebfbd9231db7d97b5df95bdaf983e68a04f"
SOURCE_URI_6="https://github.com/nielx/libc/archive/$srcGitRev_6.tar.gz"
CHECKSUM_SHA256_6="6831b6ca212d531e8f775bc05af573a33d1e7c7b8b0d5e1d4ac056ac2a079141"
SOURCE_URI_7="http://rust-on-haiku.com/downloads/44#noarchive"
CHECKSUM_SHA256_7="08fd4f697c08ed3da24225643eb8ae1331feb6afe13ada398691c0e2dbdc3b1f"
SOURCE_FILENAME_7="rust-stage0-2016-08-07-b71ea1d-haiku-i386-bb4f6267ef13d945bdfaa443a0a007a84c8ce187.tar.bz2"
SOURCE_URI_8="http://rust-on-haiku.com/downloads/46#noarchive"
CHECKSUM_SHA256_8="357b1d6a1307d2b9a784daf0a71ca1982f040d8539d7d4e1e0443523347445b0"
SOURCE_FILENAME_8="rust-stage0-haiku-x86_64.tar.bz2"
ARCHITECTURES="?all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
rust$secondaryArchSuffix = $portVersion
cmd:rust_gdb = $portVersion
cmd:rustc = $portVersion
cmd:rustdoc = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:file
cmd:find
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:git
cmd:grep
cmd:ld$secondaryArchSuffix
cmd:make
cmd:python
cmd:sed
cmd:tar
cmd:which
"
BUILD()
{
if [ $effectiveTargetArchitecture = x86_64 ]; then
# For x86_64 this recipe will unwrap the pre-built binary rustc compiler
# This compiler misses all the libraries and can only be used to bootstrap
# newer versions of Rust.
return
fi
rm -rf src/compiler-rt src/llvm src/rust-installer
ln -sf /sources-2/compiler-rt-$srcGitRev_2 src/compiler-rt
ln -sf /sources-3/llvm-$srcGitRev_3 src/llvm
ln -sf /sources-4/rust-installer-$srcGitRev_4 src/rust-installer
rm -r src/rt/hoedown
ln -sf /sources-5/hoedown-$srcGitRev_5 src/rt/hoedown
rm -r src/liblibc
ln -sf /sources-6/libc-$srcGitRev_6 src/liblibc
# Do not use runConfigure: it generates too much noise, and it creates a totally impossible directory structure
#runConfigure --omit-dirs "docDir libExecDir dataRootDir includeDir sharedStateDir sbinDir binDir oldIncludeDir" ./configure --disable-jemalloc --build=i686-unknown-haiku --host=i686-unknown-haiku --target=i686-unknown-haiku
./configure --prefix=$prefix --mandir=$manDir --disable-jemalloc --disable-rpath --release-channel=stable
# download the stage 0 compiler, and put it in the proper place
if [ $effectiveTargetArchitecture = x86_64 ]; then
# TODO: update x86_64 port
ln -sf /sources-7/rust-stage0-2015-11-13-c386da0-haiku-x86_64-d09b23db0ef31209a1ebc42e54177449db0985ef.tar.bz2 dl/rust-stage0-2015-11-13-c386da0-haiku-x86_64-d09b23db0ef31209a1ebc42e54177449db0985ef.tar.bz2
else
ln -sf /sources-7/rust-stage0-2016-08-07-b71ea1d-haiku-i386-bb4f6267ef13d945bdfaa443a0a007a84c8ce187.tar.bz2 dl/rust-stage0-2016-08-07-b71ea1d-haiku-i386-bb4f6267ef13d945bdfaa443a0a007a84c8ce187.tar.bz2
fi
make
}
INSTALL()
{
if [ $effectiveTargetArchitecture = x86_64 ]; then
cd /sources-8
tar xvfj rust-stage0-haiku-x86_64.tar.bz2
mkdir -p $binDir
cp rust-1.9.0-x86_64-distro/bin/rustc $binDir
return
fi
make install
# move documentation to the proper place
mkdir -p $developDocDir
mv $prefix/share/doc/rust/* $developDocDir
rm -rf $prefix/share
if [ -n "$secondaryArchSuffix" ]; then
# move the libs to the x86 subdir
mkdir -p $libDir
mv $prefix/lib/*.so $libDir
fi
# 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
mkdir -p $developLibDir
mv $prefix/lib/rustlib $developLibDir
cd $prefix/lib
ln -s ../$relativeDevelopLibDir/rustlib rustlib
# clean out unneccesary files created by the rust installer
rm $developLibDir/rustlib/components
rm $developLibDir/rustlib/install.log
rm $developLibDir/rustlib/manifest-rust-docs
rm $developLibDir/rustlib/manifest-rust-std-i686-unknown-haiku
rm $developLibDir/rustlib/manifest-rustc
rm $developLibDir/rustlib/rust-installer-version
rm $developLibDir/rustlib/uninstall.sh
}
TEST()
{
if [ $effectiveTargetArchitecture = x86_64 ]; then
return
fi
make check
}