### this file is sourced not run
# Note: Original name was compton-yshui up to version 7.4
PKGBUILD=1
PKGARCH=x86_64

# source: james
# release tarball
#PKGVER=
#TARBALL=
#MD5SUM=
#SRC_URL=
#BUNDLE=

# git-master tarball
PKGVER=1.23.2022.03.25
MD5SUM=439e8cc3bfcb8bfab95dc190113f426c
hash=adbe7908c6e05899d8c4a03cd5cbc10209e3d221
hash7=${hash#???????}; hash7=${hash%$hash7}
TARBALL=scrcpy-$PKGVER-$hash7.tar.gz
SRC_URL=https://github.com/Genymobile/scrcpy/archive/$hash.tar.gz


SLACKREQ='ffmpeg libSDL2 libusb' # build time: wget lfs-cacert
SLACKDESC="scrcpy: scrcpy $PKGVER (Mirror Android Screen on PC)
scrcpy: 
scrcpy: This application provides display and control of Android devices 
scrcpy: connected via USB (or over TCP/IP). It does not require any root 
scrcpy: access. It provides: recording, mirorring, copy-paste, from an 
scrcpy: Android device, and many others.
scrcpy: You need to have 'adb' installed somewhere in your path for this
scrcpy: to work. 'adb' can be downloaded from Android platform-tools, from
scrcpy: Google website.
scrcpy:
scrcpy: https://github.com/Genymobile/scrcpy
"

### default pkg_download
### default pkg_prepare
### package
pkg_package() {
	# more cleanup
	rm -r root etc
}

### build
pkg_build() {
	cd /tmp/scrcpy* &&

	# preparation
	echo "nameserver 8.8.8.8" > /etc/resolv.conf && # needed for download
	sed -i -e 's/sudo //' install_release.sh && # remove sudo
	sed -i -e 's|buildtype|prefix /usr --buildtype|' install_release.sh && # install to /usr
	
	# build
	./install_release.sh &&
	pkg_build_slackdesc &&

	# install docs
	install -dm755 /usr/share/doc/scrcpy-$PKGVER &&
	install -m644 README.* FAQ.* /usr/share/doc/scrcpy-$PKGVER &&

	# cleanup
	rm -r /etc/resolv.conf &&
	
	# finish
	true
}
