# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: rubicon <rubicon@mailo.com>
pkgname=tke
pkgver=3.6.2
pkgrel=0
_gittag=devel-$pkgver
pkgdesc="Advanced, modern code editor written in Tcl/Tk"
url="https://tke.sourceforge.net/"
arch="noarch"
license="GPL-2.0-or-later"
depends="tcl tk tclx tcl-lib tk-lib tcl-tls"
options="!check"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/phase1geo/tke/archive/refs/tags/$_gittag.tar.gz
	install-script.patch
	"
builddir="$srcdir/$pkgname-$_gittag"

package() {
	mkdir -vp "$pkgdir"/usr/share/applications
	echo "$pkgdir"/usr | tclsh install.tcl

	find "$pkgdir" \( \
		-name .DS_Store \
		-o -name '*.dll' -o -name '*.dylib' \) \
		-delete
	rm -rvf "$pkgdir"/usr/lib/tke/uninstall.tcl \
		"$pkgdir"/usr/lib/tke/lib/macOS \
		"$pkgdir"/usr/lib/tke/lib/win

	mkdir -vp "$pkgdir"/usr/share/doc
	mv -v "$pkgdir"/usr/lib/tke/doc "$pkgdir"/usr/share/doc/$pkgname
}

doc() {
	license="GFDL-1.3-only"
	default_doc

	mkdir -vp "$subpkgdir"/usr/lib/tke
	ln -sv ../../share/doc/$pkgname "$subpkgdir"/usr/lib/tke/doc
}

sha512sums="
3fc3ba48210509cb4c47b0281726577226e90fc43c5f27998a19ac7bd1e99757ab61b62cf34ef72f6bfd0314da3fb827854a7aa5143fc803d7dcc35b8e0a2caa  tke-3.6.2.tar.gz
05161d0e277e796951d860e1c06139b0b7c556bb4bd70c1517e3756fad5c4559b6169ef8ddcc878acd891d35ed01d357a3d40fa4f844024833b85664e05a24a3  install-script.patch
"
