# Template file for 'wasmtime'
pkgname=wasmtime
version=0.21.0
revision=1
archs="x86_64* i686* aarch64*"
build_style=cargo
short_desc="Standalone JIT-style runtime for WebAssembly, using Cranelift"
maintainer="Isaac Freund <ifreund@ifreund.xyz>"
license="Apache-2.0"
homepage="https://github.com/bytecodealliance/wasmtime"
_spec_testsuite_commit=18f83401a47a0e43772cf7d9f216e994bf7c7fa6
_wasm_c_api_commit=d9a80099d496b5cdba6f3fe8fc77586e0e505ddc
_WASI_commit=71f042514728e425a9b1b251c7f6daaa44301f4a
distfiles="${homepage}/archive/v${version}.tar.gz
 https://github.com/WebAssembly/testsuite/archive/${_spec_testsuite_commit}.tar.gz
 https://github.com/WebAssembly/wasm-c-api/archive/${_wasm_c_api_commit}.tar.gz
 https://github.com/WebAssembly/WASI/archive/${_WASI_commit}.tar.gz"
checksum="7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952
 9d82be5b4dcfaadb9c0b0455c0c8b2989b942f75b9f698fa8e70329e403f4f74
 aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c
 7496df0d28398229f511aba624ddfcf924a1e046e189cac93d4ea53483206e0e"

case ${XBPS_TARGET_MACHINE} in
	aarch64-musl)
		broken="https://github.com/bytecodealliance/wasmtime/issues/2133";;
esac

pre_configure() {
	# move submodules to the proper location
	rmdir tests/spec_testsuite
	rmdir crates/c-api/wasm-c-api
	rmdir crates/wasi-common/WASI

	mv -v ../testsuite-${_spec_testsuite_commit} tests/spec_testsuite
	mv -v ../wasm-c-api-${_wasm_c_api_commit} crates/c-api/wasm-c-api
	mv -v ../WASI-${_WASI_commit} crates/wasi-common/WASI
}
