# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=freetube
pkgver=0.19.1
pkgrel=0
pkgdesc="An open source desktop YouTube player built with privacy in mind."
arch="x86_64 aarch64" # blocked by electron
license="AGPL-3.0-only"
depends="
	electron
	font-roboto
	"
makedepends="
	npm
	yarn
	"
url="https://freetubeapp.io"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/FreeTubeApp/FreeTube/archive/v$pkgver-beta.tar.gz
	freetube.sh
	freetube.desktop
	electron27.patch
	package-only-necessary.patch
	disable-asar.patch
	"
options="net !check" # No testsuite
builddir="$srcdir"/FreeTube-$pkgver-beta

build() {
	yarn --cache-folder "$srcdir"/yarn-cache install
	yarn --cache-folder "$srcdir"/yarn-cache --frozen-lockfile build
}

package() {
	# directory creation + program copy
	install -dm755 "$pkgdir"/usr/lib
	cp -r "$builddir"/build/linux-unpacked/resources/app "$pkgdir"/usr/lib/$pkgname

	# link binaries + other items
	install -Dm755 "$srcdir"/freetube.sh "$pkgdir"/usr/bin/$pkgname
	install -Dm644 "$builddir"/_icons/icon.svg "$pkgdir"/usr/share/icons/hicolor/scalable/$pkgname.svg
	install -Dm644 "$srcdir"/freetube.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
}

sha512sums="
2b607754092af7239e7afcc441d86009dba1295bf6f836ab0f2fe9ceffb3045c7da1e4d175a25aa72179241ea62d4905185c6990641213e8e66573d4daa74bfe  freetube-0.19.1.tar.gz
8508af3d983b305b9e3c8ffb478c723feb4f8301a69cd1ad588854ce13e9b51bab1b68599c2f7f8a6005e9aa8949d36d057a3660d70e4acf2f4d125e5f8ef136  freetube.sh
0b74e115852e71f665730a09e4d06a07fd3ae68fbc9bf8aaf280a32b70298910c692c99535cd2294df95394ad9b3b9f4a127bb6c9d50824946895dbb54649872  freetube.desktop
f12c19969981fe22c05d14007d6d9900e854757119ab16b5af8185d94850f3d96b0e22ef03bddc776e47088bc3de88d86bcd631e5e15fb74616f26b021b2a93f  electron27.patch
0869c3de3b93b92b8964d3baffa3dc3cf584cd1185af29104cad7bd928c39d9bc30209ed6113053afe96ca624f72fd3cc44de241f96f1cb757f16908b037ad0f  package-only-necessary.patch
67107797825cbb98cc3a46e288fe92e06e0cc91b1a44a10edcf68045d06c9679c587bd2706051ce0b109091295247b5e8ec572297cd0c72532afd529cf56449d  disable-asar.patch
"
