# Template file for 'babashka'
pkgname=babashka
version=1.0.170
revision=1
create_wrksrc=yes
hostmakedepends="mandrel leiningen git"
makedepends="zlib-devel"
checkdepends="clojure curl"
short_desc="Native, fast starting Clojure interpreter for scripting"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="EPL-1.0"
homepage="https://babashka.org/"
changelog="https://github.com/babashka/babashka/blob/master/CHANGELOG.md"
_sci_commit=ee1df7aa95cb7279fd2040b0437ffb8415fbffa0
_babashka_curl_commit=99e6d3ba7a7252284b43f9de7d91d3433ecfa8f0
_babashka_nrepl_commit=ad763a78f1bc327a493ff0b650aa5408ecbf4819
_depstar_commit=c419b8c82041855d55593c5b561fc7cea8234712
_process_commit=8c98184222033c0af375b47dd3e13ba56ae8fe9f
_pods_commit=75c2216649bf5caf3ae41e7b8fc202e45b090ea9
_deps_clj_commit=e9318a759628221c48b9259bc8885d4aee1d7262
_fs_commit=8a8bfa618be6f0c1b21be0daafd1887e2a4f5c44
_babashka_core_commit=52a6037bd4b632bffffb04394fb4efd0cdab6b1e
distfiles="https://github.com/babashka/babashka/archive/refs/tags/v${version}.tar.gz
 https://github.com/borkdude/sci/archive/${_sci_commit}.tar.gz
 https://github.com/babashka/babashka.curl/archive/${_babashka_curl_commit}.tar.gz
 https://github.com/babashka/babashka.nrepl/archive/${_babashka_nrepl_commit}.tar.gz
 https://github.com/babashka/depstar/archive/${_depstar_commit}.tar.gz
 https://github.com/babashka/process/archive/${_process_commit}.tar.gz
 https://github.com/babashka/pods/archive/${_pods_commit}.tar.gz
 https://github.com/borkdude/deps.clj/archive/${_deps_clj_commit}.tar.gz
 https://github.com/babashka/fs/archive/${_fs_commit}.tar.gz
 https://github.com/babashka/babashka.core/archive/${_babashka_core_commit}.tar.gz"
checksum="b6e0984e8f8f0120ae6e0851c98e1649b3ca1d794e06bf3652351426490b95a5
 a29e0c23ea70b4b38c339faa47b9524c66e5a483489e05019364f1c1d86e746a
 bb0bccbdeb295b83f9b5b859a12634b28a6b1c68da7ab04d18f87dd8b7a69930
 c2a174c385d9728837c1432055669390de063a417fa7aacb36c9e826819f3e6a
 9d214a10a4f5e4f15b9c80354dae85689a40e941ec3417203354c0dc3ce9457b
 afa762485a8d92eb79c70a2467f67e05bd60189b8fce3ad9da25db57a8c00ac2
 fd7d60d3b336c5c11f13a59f9524ef0b00e3755f3033e597cfc4c23f2c618fda
 38f1eac7ec38374709972ea856acb6c684591bd36cfcfc44044874cdd12264ab
 949f8da34f285f2385af569d6ed5bcc49851ec3774532f614bef63f5a496f787
 bad285812bcc7de7e0dd905c5df99045d7f92d6e2e191fc2768c06adbaaeb709"

nocross="https://build.voidlinux.org/builders/aarch64_builder/builds/33769/steps/shell_3/logs/stdio"

post_extract() {
	mv babashka-$version/* babashka-$version/.??* .
	rmdir babashka-$version
	for dir in sci babashka.core babashka.curl babashka.nrepl \
		depstar process pods deps.clj fs
	do
		rmdir $dir
		mv "$dir"-* $dir
	done
}

do_build() {
	export GRAALVM_HOME=/usr/lib/jvm/mandrel11
	if [ "$XBPS_TARGET_LIBC" = musl ]; then
		export BABASHKA_MUSL=true
		export BABASHKA_STATIC=true  # mandrel workaround
	fi

	lein deps
	script/uberjar
	script/compile
}

do_check() {
	export BABASHKA_TEST_ENV=native
	script/test
	script/run_lib_tests
}

do_install() {
	vbin bb
	vlicense LICENSE
}
