# Template file for 'Signal-Desktop'
pkgname=Signal-Desktop
version=1.14.4
revision=1
hostmakedepends="git python nodejs-lts yarn"
depends="libnotify libappindicator"
short_desc="Signal Private Messenger for Linux"
maintainer="Julio Galvan <juliogalvan@protonmail.com>"
license="GPL-3.0-only"
homepage="https://github.com/signalapp/Signal-Desktop"
distfiles="https://github.com/signalapp/Signal-Desktop/archive/v${version}.tar.gz"
checksum=538c50de7fb2bd442e470f5128a76ddb07490f612a597183d342a95f26b89940
# Due to electron
only_for_archs="x86_64 i686"
nostrip_files="signal-desktop"

do_build() {
	yarn install --ignore-engines
	yarn grunt
	yarn build-release --dir
}

do_install() {
	vmkdir usr/share/signal-desktop

	case "$XBPS_TARGET_MACHINE" in
		i686*) _ARCH="-ia32-";;
		x86_64*) _ARCH="-";;
	esac
	vcopy release/linux${_ARCH}unpacked/* usr/share/signal-desktop

	vmkdir usr/bin
	ln -s /usr/share/signal-desktop/signal-desktop ${DESTDIR}/usr/bin/

	vmkdir usr/share/applications
	vcopy ${FILESDIR}/signal.desktop usr/share/applications/

	vmkdir usr/share/icons/hicolor
	for size in 16 32 48 128 256 1024; do
		vinstall images/icon_${size}.png 644 usr/share/icons/hicolor/${size}x${size}/apps/	signal.png
	done
}
