# Contributor: Andre Bierwolf <a.b.bierwolf@gmail.com>
# Maintainer: Andre Bierwolf <a.b.bierwolf@gmail.com>
pkgname=novnc
_pkgname=noVNC
pkgver=0.6.2
pkgrel=0
pkgdesc="VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support"
url="https://kanaka.github.io/noVNC/"
arch="noarch"
license="MPL-2.0"
depends="websockify net-tools"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$_pkgname/archive/v$pkgver.tar.gz
	alpine-specific-launch.js.patch"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"

package() {
	mkdir -p "$pkgdir"/usr/share/$pkgname
	cd "$pkgdir"/usr/share/$pkgname

	cp -r "$builddir"/* .

	# Clean up package.
	rm CONTRIBUTING.md utils/README.md

	# Move license files.
	mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
	mv LICENSE.txt docs/LICENSE.* "$pkgdir"/usr/share/licenses/novnc/

	# Move documentation.
	mkdir -p "$pkgdir"/usr/share/doc
	mv docs "$pkgdir"/usr/share/doc/$pkgname
	mv README.md "$pkgdir"/usr/share/doc/$pkgname/

	# Install launch.sh to /usr/bin.
	install -D -m 755 utils/launch.sh "$pkgdir"/usr/bin/novnc_server

	# Remove irrelevant utils.
	rm -r utils
}

sha512sums="245d205f8935c82722a55d6cfcd2cea1825176c0cd695fd0eec34aa19cdc3b766fed62e741ff41b0a8c4a3b3cbabc5a39dfa6ad8ffa6169f5b88420a4a845a7c  novnc-0.6.2.tar.gz
e3a444d8a8cbf742bc1299e229deb129bcb6045eef1aad20e8db066362db1da77a59130fdadfffffbc69a5cb4c5a929eb4d40382305dae5fc4ab5f09f9d9eef6  alpine-specific-launch.js.patch"
