# Template file for 'kotlin-bin'
pkgname=kotlin-bin
version=1.2.60
revision=1
wrksrc="kotlinc"
only_for_archs="x86_64"
makedepends="unzip setconf"
depends="openjdk"
short_desc="Statically typed programming language that can interoperate with Java"
maintainer="shizonic <realtiaz@gmail.com>"
license="Apache-2.0"
homepage="https://kotlinlang.org/"
distfiles="https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-compiler-${version}.zip"
checksum=ff79f695c9be0a500d4b56a69d0b8657b3d106d78a35101e792248af904a623d
nostrip=yes
replaces="kotlin>=0"

pre_install() {
	cd bin
	setconf kotlin DIR "/usr/bin"
	setconf kotlinc-js DIR "/usr/bin"
	setconf kotlinc-jvm DIR "/usr/bin"
	setconf kotlinc KOTLIN_HOME "/usr/share/${pkgname}"
}

do_install() {
	# executables
	vbin bin/kotlin
	vbin bin/kotlinc
	vbin bin/kotlinc-js
	vbin bin/kotlinc-jvm

	# jar files
	vmkdir usr/share/${pkgname}/lib
	vcopy lib/* usr/share/${pkgname}/lib

	# licenses
	vlicense license/LICENSE.txt
	vlicense license/NOTICE.txt

	# build.txt must be installed for for "-version" to work
	vcopy build.txt usr/share/${pkgname}
}
