# Template file for 'freetube'
pkgname=freetube
version=0.7.0
revision=1
archs="x86_64"
wrksrc=FreeTube-${version}-beta
hostmakedepends="nodejs yarn-bin"
depends="nodejs"
short_desc="Open source desktop YouTube player built with privacy in mind"
maintainer="reback00 <reback00@protonmail.com>"
license="GPL-3.0-or-later"
homepage="https://freetubeapp.io/"
distfiles="https://github.com/FreeTubeApp/FreeTube/archive/v${version}-beta.tar.gz"
checksum=1c3287b9df9134540a9b7538a74dc43eae3e9b2e1a33cca9931a18882511b7bc

pre_build() {
	yarn add electron-builder --dev
}

do_build() {
	npm run make:linux:x64:tar
}

do_install() {
	mkdir -p "${DESTDIR}/opt/${pkgname}"
	vcopy "${wrksrc}/dist/linux-unpacked/*" "opt/${pkgname}"

	vinstall "${wrksrc}/build/icons/256x256.png" 644 usr/share/pixmaps "${pkgname}.png"

	mkdir -p "${DESTDIR}/usr/bin"
	ln -sf "/opt/${pkgname}/freetube" "${DESTDIR}/usr/bin/${pkgname}"

	# .desktop file
	mkdir -p "${DESTDIR}/usr/share/applications"
	vcopy "${FILESDIR}/freetube.desktop" "usr/share/applications/${pkgname}.desktop"
}
