# Contributor: Andre Bierwolf <a.b.bierwolf@gmail.com>
# Maintainer: Andre Bierwolf <a.b.bierwolf@gmail.com>
pkgname=novnc
_pkgname=noVNC
pkgver=1.0.0
pkgrel=0
pkgdesc="VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support"
url="https://kanaka.github.io/noVNC/"
arch="noarch !s390x"
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 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="97a86be5f10f382e2ed641360f5f6c3b22998f68f980c78138aca900ef6a011c1f6aa9cbdd8cd07afd4884e8c65af30d65487e87bb34e524c10f16cf4cd116a3  novnc-1.0.0.tar.gz
d4fba29910c81a52af176cc9af533660a2b09a7846d9857824db0a9b5395712ae99ebd1d96a7cb3c29a58b7aad78876c88e14b847d6cb542cf9cb2991730c935  alpine-specific-launch.js.patch"
