app=freerdp
version=2.2.0
build=1sml
homepage="https://www.freerdp.com"
download="https://pub.freerdp.com/releases/freerdp-2.2.0.tar.gz"
desc="Free implementation of the RDP protocol"
requires="libusb alsa-lib ffmpeg gdk-pixbuf graphite2"

build() {
  mkandenterbuilddir
  rm -rf FreeRDP-$version

  tar xf $srcdir/FreeRDP-$version.tar.?z*
  cd FreeRDP-$version 
  fixbuilddirpermissions

  mkdir -p smbuild && cd smbuild
  export CFLAGS="$CFLAGS -D_GNU_SOURCE" 
  cmake .. \
    -DCMAKE_INSTALL_PREFIX="" \
    -DCMAKE_INSTALL_LIBDIR="lib" \
    -DWITH_CUPS=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_JPEG=ON \
    -DWITH_SERVER=ON \
    -DWITH_SWSCALE=ON \
    -DWITH_CHANNELS=ON \
    -DWITH_CLIENT_CHANNELS=ON \
    -DWITH_SERVER_CHANNELS=ON \
    -DWITH_VAAPI=ON \
    -DCHANNEL_URBRDC_CLIENT=ON \
    -DWITH_SYSTEMD=OFF \
    -DWITH_WAYLAND=ON \
    -DWITH_PULSE=OFF \
    -DCMAKE_BUILD_TYPE=None \
    -Wno-dev 

  make
  make install DESTDIR=$pkg 

  cp ../LICENSE $pkgdocs/

  mkfinalpkg
}

sha512sums="
e14185db3f9e9900427c3149eef872ab9939ac33e307f7e7c73323e463f05b87f9ee8e6157a38a6dcb3d859039dd220b42b4a470c2d8b6c58045092960102135  FreeRDP-2.2.0.tar.lz
"
