# Template file for 'slack-desktop'
pkgname=slack-desktop
version=1.2.6
revision=1
only_for_archs="i686 x86_64"
short_desc="A messaging app for teams"
maintainer="Diogo Leal <diogo@diogoleal.com>"
license="Proprietary"
homepage="https://slack.com/"
repository="nonfree"
restricted=yes

if [ "${XBPS_TARGET_MACHINE}" = "x86_64" ];then
	_debarch=amd64
	checksum=f7a10e7b565e2251f63bff879e9a31728af374c5e0aa36b577d3c542a3e25760
else
	_debarch=i386
	checksum=474a1f95920e39e3a93e7771e7214401e8549d82142d313e6224540c9e17ddef
fi

distfiles="https://slack-ssb-updates.global.ssl.fastly.net/linux_releases/slack-desktop-${version}-${_debarch}.deb"

do_extract() {
	ar x ${XBPS_SRCDISTDIR}/${pkgname}-${version}/slack-desktop-${version}-${_debarch}.deb
	cd ${wrksrc}
	tar xfJ data.tar.xz
}

do_install() {
	vbin ${FILESDIR}/slack
	vlicense usr/share/slack/LICENSE
	rm -rf usr/share/doc
	rm -rf etc
	rm -rf usr/share/lintian
	rm -rf usr/share/doc
	rm -rf usr/share/slack/resources/app.asar.unpacked/static/plugins/darwin
	rm -rf usr/share/slack/resources/app.asar.unpacked/static/plugins/win32
	find usr/ -type f -iname \*.dll -delete
	find usr/ -type f -iname \*.exe -delete
	vcopy usr/ /
}
