### this file is sourced not run
PKGBUILD=1
PKGARCH=x86_64

# source: james

# release tarball
#PKGVER=
#TARBALL=
#MD5SUM=
#SRC_URL=
#BUNDLE=

# git-master tarball
PKGVER=2012.09
MD5SUM=56eb02d18a1ed1b106d2b5af2613d1aa
hash=783204ff6c92afec33d6d36f7e74f1fcf2b1b601
hash7=${hash#???????}; hash7=${hash%$hash7}
TARBALL=fbvnc-$PKGVER-$hash7.tar.gz
SRC_URL=https://github.com/zohead/fbvnc/archive/$hash.tar.gz

SLACKREQ='' 
SLACKDESC="fbvnc: fbvnc $PKGVER (Framebuffer VNC Client)
fbvnc: 
fbvnc: A VNC client for Linux framebuffer. Fork of Ali Gholami's app of the 
fbvnc: same name.
fbvnc: 
fbvnc: https://github.com/zohead/fbvnc
fbvnc: 
fbvnc: Ali Gholami's version is here:
fbvnc: https://repo.or.cz/w/fbvnc.git
fbvnc: 
fbvnc: 
"

STATIC= # yes 
CROSS_COMPILER_PATH=/opt/abo64/bin
CROSS_COMPILE=x86_64-

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/fbvnc* &&
	patch -Np1 -i ../pkg/upstream.patch &&
	patch -Np1 -i ../pkg/rufwoof.patch &&
	patch -Np1 -i ../pkg/devices.patch
}

### default pkg_package
### build
pkg_build() {

	# Notes:
	# This fbvnc project assumes framebuffer color depth is 32bit.
	# If your framebuffer device has some bug for 32bit framebuffer (like Raspberry Pi)
	# or doesn't support 32bit framebuffer at all, then you need to
	# change size of framebuffer depth in fbvnc.c
	#
	# For Raspbery Pi (display well in 16bit framebuffer), you need to change:
	# typedef unsigned int fbval_t;
	# to:
	# typedef unsigned short fbval_t;
	#

	cd /tmp/fbvnc* &&
	if [ $STATIC ]; then
		PATH=$PATH:$CROSS_COMPILER_PATH
		make CC="${CROSS_COMPILE}gcc -static" || return 1
	else
		make || return 1
	fi &&
	install -m755 fbvnc /usr/bin &&
	pkg_build_slackdesc
}
