# Template file for 'GoLand'
pkgname=GoLand
version=2025.3
revision=2
archs="x86_64"
depends="virtual?java-environment"
short_desc="Cross-platform IDE built specially for Go developers"
maintainer="Anton Afanasyev <anton@doubleasoftware.com>"
license="custom:Commercial"
homepage="https://www.jetbrains.com/go"
distfiles="https://download.jetbrains.com/go/goland-${version}.tar.gz"
checksum=6151856286ea546eb8af9aeb025772cee6bd57134f45494a818e8da20a8691c6
repository=nonfree
restricted=yes
nopie=yes

post_extract() {
	# aarch64
	rm -rf lib/pty4j-native/linux/aarch64
	rm -rf plugins/go/lib/dlv/linuxarm
	rm -rf plugins/go-plugin/lib/dlv/linuxarm
	rm -rf lib/async-profiler/aarch64
}

do_install() {
	_target_path="usr/lib/${pkgname}"

	vmkdir usr/bin
	vmkdir ${_target_path}

	local i
	for i in license/* ; do
		vlicense $i
	done

	local launcher_path="bin/goland.sh"
	vcopy bin ${_target_path}
	vcopy help ${_target_path}
	vcopy lib ${_target_path}
	vcopy jbr ${_target_path}
	vcopy plugins ${_target_path}
	vcopy product-info.json ${_target_path}
	vcopy build.txt ${_target_path}

	ln -sf "/${_target_path}/${launcher_path}" "${DESTDIR}/usr/bin/${pkgname}"
	vdoc "${FILESDIR}/README.voidlinux"
}
