### this file is sourced not run

ZIPGIT=8e61e2bd9c7b396a2507b6247005462133f5b38f.zip # GitHub SHA
MD5GIT= # not used
TARBALL=xdotool-3.20160905.tar.gz # pick your local name
MD5SUM=4ec8aa5ab96ef4f7e1329885a5668d75
SRC_URL=https://github.com/jordansissel/xdotool/archive/$ZIPGIT

BUNDLE=
SLACKREQ='libX11 libXtst libXinerama libxkbcommon' # 
SLACKDESC='xdotool: xdotool 3.20160905 GitHub (X utility)  
xdotool:  
xdotool: This tool lets you simulate keyboard input and mouse activity, move 
xdotool: and resize windows, etc. It does this using X11'\''s XTEST extension and 
xdotool: other Xlib functions.  
xdotool: 
xdotool: 
xdotool: 
xdotool: 
xdotool: 
xdotool: https://github.com/jordansissel/xdotool/ 
'

#PKG_NOBUILD=yes # don't run the build-step (don't enter chroot)
#PKG_NOSTRIP=yes # don't strip binaries
#PKG_NOMAKEPKG=yes # don't run makepkg, supposedly pkg_package will do actual packaging

# $1-src-dir $2-tarball $SRC_URL
# return 0=good, anything else=bad
# download github commit $ZIPGIT and convert it to $TARBALL
pkg_download() {
	local repo=${TARBALL%%-*}
	local topdir=${repo}-${ZIPGIT%.*}
	local tarballbase=${TARBALL%.*} # delete .txz|.tgz|.gx|.gz
	tarballbase=${tarballbase%.tar} # for .tar.gz and .tar.tz
	echo downloading $ZIPGIT
	wget --no-check-certificate -O $1/$ZIPGIT "$SRC_URL" &&
	rm -fr $1/${topdir} $1/${tarballbase} &&
	unzip -q $1/$ZIPGIT -d $1 &&
	mv $1/${topdir} $1/${tarballbase}
	GZIP=-n tar -caf $1/$2 -C $1 ${tarballbase} || return 1
	rm -rf $1/${ZIPGIT} $1/${topdir} $1/${tarballbase}
	return 0
}


### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/xdotool*
	make $MAKEFLAGS && make PREFIX=/usr install INSTALLLIB=/usr/lib64 &&
	pkg_build_slackdesc &&
	rm -rf /var/cache/ldconfig
}
