# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Alexey Vasiliev <robbinton@gmail.com>

pkgname=freerdp-git
pkgdesc="Free RDP client - git checkout"
pkgver=1.1.0.beta.2013071101.r1331.g4a6b1f3
pkgrel=1
#depends=('openssl' 'libxcursor' 'libcups' 'alsa-lib' 'libxext' 'libxdamage'
#         'ffmpeg' 'libxkbfile' 'libxinerama' 'libxv')
depends=('openssl' 'libxcursor' 'alsa-lib' 'libxext' 'libxdamage'
          'libxkbfile' 'libxinerama' 'libxv')
makedepends=('git' 'krb5' 'cmake' 'damageproto')
arch=('i686' 'x86_64')
url="http://www.freerdp.com/"
license=('GPL')
provides=(freerdp)
conflicts=(freerdp)
source=('freerdp::git://github.com/FreeRDP/FreeRDP.git')

pkgver() {
	cd freerdp/

	if GITTAG="$(git describe --abbrev=0 --tags 2>/dev/null)"; then
		echo "$(sed -e "s/^${pkgname%%-git}//" -e 's/^[-_/a-zA-Z]\+//' -e 's/[-_+]/./g' <<< ${GITTAG}).r$(git rev-list --count ${GITTAG}..).g$(git log -1 --format="%h")"
	else
		echo "0.r$(git rev-list --count master).g$(git log -1 --format="%h")"
	fi
}

build() {
	cd freerdp/

	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DWITH_PULSE=OFF \
		-DWITH_SERVER=ON \
		.
	make
}

package() {
	cd freerdp/

	make DESTDIR="${pkgdir}/" install
}

sha256sums=('SKIP')
