# vim: set syn=sh et st=2 sw=2 ts=2 tw=0:
#Packager: JRD <jrd@enialis.net>
#With inspiration from the Arch Linux Package for the upstream patches.
#Former Packager(s): Richard Lapointe <richard@laprjns.com>

pkgname=remmina
pkgver=1.0.0
pkgrel=1cp
source=(https://github.com/downloads/FreeRDP/$(echo $pkgname|sed 's/^./\U\0/')/$(echo $pkgname|sed 's/^./\U\0/')-$pkgver.tar.gz
	'https://github.com/FreeRDP/Remmina/commit/569d9bb7.patch?01.patch'
	'https://github.com/FreeRDP/Remmina/commit/f7d1038b.patch?02.patch'
	'https://github.com/FreeRDP/Remmina/commit/3ebdd6e7.patch?03.patch'
	'https://github.com/FreeRDP/Remmina/commit/97c2af8c.patch?04.patch'
	'https://github.com/FreeRDP/Remmina/commit/84327f81.patch?05.patch'
	'https://github.com/FreeRDP/Remmina/commit/c1ef3a16.patch?06.patch'
	'https://github.com/FreeRDP/Remmina/commit/6ee20289.patch?07.patch'
	'https://github.com/FreeRDP/Remmina/commit/b2277827.patch?08.patch'
	'https://github.com/FreeRDP/Remmina/commit/cb0b209b.patch?09.patch'
  'https://github.com/Gankov/Remmina/commit/13f20367.patch?10.patch' # https://github.com/FreeRDP/Remmina/issues/9
)
sourcetemplate=http://people.salixos.org/jrd/salix/$pkgname/$pkgver-\$arch-$pkgrel/
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=http://remmina.sourceforge.net/index.shtml

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (remote desktop client)"
"Remmina is a remote desktop client written in GTK+, aiming to be"
"useful for system administrators and travellers, who need to work with"
"lots of remote computers in front of either large monitors or tiny"
"netbooks."
"Remmina supports multiple network protocols in an integrated"
"and consistant user interface."
"Currently RDP, VNC, NX, XDMCP and SSH are supported"
)

build() {
  cd $SRC/FreeRDP-$(echo $pkgname|sed 's/^./\U\0/')-* || return 1
  for f in $SRC/*.patch\?*.patch; do
    mv -v "$f" $SRC/"$(echo "$f"|sed 's/.*?//')"
  done
  for f in $(find $SRC -name '*.patch'|sort); do
    echo "Applying patch $(basename "$f")"
    patch -p1 -i "$f" || return 1
  done
  mkdir build && cd build || return 1
  cmake -DCMAKE_INSTALL_PREFIX=/usr -DWITH_TELEPATHY=OFF --build=build .. || return 1
  make -j $numjobs || return 1
  make install DESTDIR=$PKG || return 1
}