# Template file for 'stlink'
pkgname=stlink
version=1.6.0
revision=1
build_style=cmake
configure_args="-DSTLINK_UDEV_RULES_DIR=/usr/lib/udev/rules.d -DSTLINK_MODPROBED_DIR=/usr/lib/modprobe.d"
hostmakedepends="pkg-config"
makedepends="libusb-devel gtk+3-devel"
short_desc="STM32 discovery line Linux programmer"
maintainer="bra1nwave <bra1nwave@protonmail.com>"
license="BSD-3-Clause"
homepage="https://github.com/texane/stlink"
changelog="https://raw.githubusercontent.com/texane/stlink/master/CHANGELOG.md"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=5575e9322e6914fad3bcbcad77fa2669e4b1853cd49bed44bfac1c68992f538a

post_install() {
	vlicense LICENSE.md LICENSE
	vdoc README.md README
}

stlink-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove "usr/lib/*.a"
		vmove usr/lib/pkgconfig
	}
}

stlink-gtk_package() {
	short_desc+=" - GTK+3 frontend"
	depends="${sourcepkg}>=${version}_${revision} hicolor-icon-theme desktop-file-utils"
	pkg_install() {
		vmove usr/share/applications/stlink-gui.desktop
		vmove usr/share/icons/hicolor/scalable/apps/stlink-gui.svg
		vmove usr/bin/stlink-gui
	}
}
