# Description: Online conference
# URL: https://zoom.us/
# Maintainer: Petar Petrov, slackalaxy at gmail dot com
# Depends on: brotli double-conversion gnutls graphite2 gtk3 icu keyutils krb5 lame libcef libidn2 libinput lm_sensors pulseaudio qt5 tslib wayland

name=zoom-linux
version=6.3.6.6315
#version=$(tar -xOf zoom_x86_64.tar.xz zoom/version.txt)
release=1
source=(https://zoom.us/client/latest/zoom_x86_64.tar.xz
	$name.desktop $name.png $name.xml)
renames=($name-$version.tar.xz SKIP SKIP SKIP)

build() {
	cd zoom
	
	mkdir -p $PKG/usr/lib/$name
	cp -a * $PKG/usr/lib/$name
	
	mkdir -p $PKG/usr/bin
	cd $PKG/usr/bin
	ln -s ../lib/$name/ZoomLauncher $name
	
	mkdir -p $PKG/usr/share/{applications,pixmaps}
	cp $SRC/$name.desktop $PKG/usr/share/applications
	cp $SRC/$name.png $PKG/usr/share/pixmaps
	
	mkdir -p $PKG/usr/share/mime/packages
	cp $SRC/$name.xml $PKG/usr/share/mime/packages/
	cp $SRC/$name.png $PKG/usr/share/pixmaps/application-x-zoom.png
	
	find $PKG/usr/lib/$name/cef/locales/ -type f -not -name "en-US.pak" -delete
	find $PKG/usr/lib/$name/timezones/ -type d -not -name "en" -exec rm -rf {} +
	find $PKG/usr/lib/$name/translations/ -type f -not -name "en.qm" -delete
	
	mkdir -p $PKG/etc/revdep.d
	cd $PKG/usr/lib/$name
	find . -type d | perl -lne 'print tr:/::, " $_"' | sort -n | cut -d' ' -f2 > $PKG/etc/revdep.d/$name
	sed -i "s:\.:/usr/lib/$name:g" $PKG/etc/revdep.d/$name
}