#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer		: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
#-----------------------------------------| DESCRIPTION |---------------------------------------
# Based on AUR pkgname=conky-lua-archers
# Maintainer  : Yiannis A Ginis <drxspace[at]gmail[dot]com>
# Contributor : Spyros Stathopoulos <foucault.online[at]gmail[dot]com>
# Contributor : Chris Sakalis <chrissakalis[at]gmail[dot]com>

# based on AUR: conky-lua-archers-git
pkgname=conky
pkgver=1.18.1
pkgrel=01
pkgdesc="A free, light-weight system monitor for X with lua enabled for Arch based distros"
url="https://github.com/brndnmtthws/conky"
replaces=('torsmo' 'conky-lua' 'conky-lua-arch' 'conky-lua-archers-git')
provides=("conky=${pkgver}")
conflicts=('conky-lua' 'conky-lua-arch' 'conky-lua-nv' 'conky-lua-archers-git' 'conky-lua-archers')
## Note: after discovering the following running error on our previous edition
##  'E: pyAlsaAudio in not available'
## we decided to add 'python-pyalsa' as make and run dependency
## the error is gone now
## ... end of note
depends=(
	'alsa-lib'
	'cairo'
	'curl'
	'glib2'
	'imlib2'
	'librsvg'
	'libxdamage'
	'libxft'
	'libxinerama'
	'libxml2'
#	'libxnvctrl'
	'lua'
	'lua51'
	'python-pyalsa'
	'tolua++'
#	'wireless_tools'
)
makedepends=(
	'cmake'
	'docbook2x'
	'docbook-xml'
	'docbook-xsl'
	'git'
	'perl-xml-libxml'
	'perl-xml-sax-expat'
	'python-pyalsa'
)
#source=("https://github.com/brndnmtthws/${pkgname}/archive/v${pkgver}.tar.gz")
source=("git+$url.git#commit=a21a8f7d26f07f1dc5c144be2120e8bc6721159f") # refs/tags/v1.18.1
options=('strip' '!emptydirs')

#pkgver() {
#	cd "${srcdir}/${_pkgname}"
#	echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
#}

prepare() {
	cd ${srcdir}/${pkgname}
	mkdir -p build/               # as @afaikifreedom recommended
}

build() {
	cd ${srcdir}/${pkgname}
	cmake \
		-D CMAKE_BUILD_TYPE=MinSizeRelease \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D MAINTAINER_MODE=OFF \
		-D BUILD_BUILTIN_CONFIG=ON \
		-D BUILD_APCUPSD=OFF \
		-D BUILD_ARGB=ON \
		-D BUILD_CURL=ON \
		-D BUILD_I18N=OFF \
		-D BUILD_IBM=OFF \
		-D BUILD_IMLIB2=ON \
		-D BUILD_IOSTATS=OFF \
		-D BUILD_IPV6=OFF \
		-D BUILD_LUA_CAIRO=ON \
		-D BUILD_LUA_IMLIB2=ON \
		-D BUILD_LUA_RSVG=ON \
		-D BUILD_MOC=OFF \
		-D BUILD_MPD=OFF \
		-D BUILD_NVIDIA=OFF \
		-D BUILD_OLD_CONFIG=ON \
		-D BUILD_PULSEAUDIO=OFF \
		-D BUILD_WLAN=OFF \
		-D BUILD_X11=ON \
		-D BUILD_XDAMAGE=ON \
		-D BUILD_XDBE=ON \
		-D BUILD_XFT=ON \
		-D BUILD_XINERAMA=ON \
		-D DEFAULTNETDEV=eth0 \
		-D OWN_WINDOW=ON
	
	make
}

package() {
	cd ${srcdir}/${pkgname}
	make DESTDIR=${pkgdir} install
	install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
	install -D -m644 LICENSE.BSD ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.BSD
#	install -D -m644 extras/vim/syntax/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/syntax/conkyrc.vim
	install -D -m644 extras/vim/ftdetect/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/ftdetect/conkyrc.vim
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL3' 'BSD')

sha256sums=(SKIP) # conky.git

##  ddebf36fcd03be6665c7a4d1a349a07c2f67ce663c32c95a88838ec8cb084d2b  conky-1.18.1-01-x86_64.pkg.tar.lz

