SUMMARY="Wasm target for the Rust compiler"
DESCRIPTION="Adds support for the wasm32-unknown-unknown target for Rust."
HOMEPAGE="https://www.rust-lang.org/"
COPYRIGHT="2021 The Rust Project Developers"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://dl.rust-on-haiku.com/dist/$portVersion/rust-std-$portVersion-wasm32-unknown-unknown.tar.xz"
CHECKSUM_SHA256="b4e57266f3be5e0e3e9f0ed1397dc764a8fc2d7c2d91246a202c1db5e3c25f55"
SOURCE_DIR="rust-std-$portVersion-wasm32-unknown-unknown"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
DISABLE_SOURCE_PACKAGE=yes
PROVIDES="
	rust_wasm_bin$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	rust_bin$secondaryArchSuffix == $portVersion
	"

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

	# 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
}
