# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=rdesktop
pkgver=1.9.0
pkgrel=0
pkgdesc="rdesktop is used to connect to windows terminal servers"
options="!check" # No testsuite
url="https://www.rdesktop.org/"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-doc"
makedepends="linux-headers libx11-dev libao-dev libsamplerate-dev
	libxrandr-dev automake libtool autoconf libxcursor-dev
	libtasn1-dev nettle-dev gnutls-dev"
source="https://github.com/rdesktop/rdesktop/releases/download/v$pkgver/rdesktop-$pkgver.tar.gz"

# secfixes:
#   1.8.6-r0:
#     - CVE-2018-8794
#     - CVE-2018-8795
#     - CVE-2018-8797
#     - CVE-2018-20175
#     - CVE-2018-20175
#     - CVE-2018-20176
#     - CVE-2018-20176
#     - CVE-2018-8791
#     - CVE-2018-8792
#     - CVE-2018-8793
#     - CVE-2018-8796
#     - CVE-2018-8798
#     - CVE-2018-8799
#     - CVE-2018-8800
#     - CVE-2018-20174
#     - CVE-2018-20177
#     - CVE-2018-20178
#     - CVE-2018-20179
#     - CVE-2018-20180
#     - CVE-2018-20181
#     - CVE-2018-20182

prepare() {
	cd "$builddir"
	default_prepare
	update_config_sub
	autoreconf -fi # https://github.com/rdesktop/rdesktop/issues/331
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-sound=ao \
		--disable-smartcard \
		--disable-credssp
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

sha512sums="e101147b496ae70118c2756bf120007d4748aad9d9917d9ebc0878ffaf35764500861c548ef0528722777555c78e1d3d146b6f3691daa2b8657b0d3a541094f5  rdesktop-1.9.0.tar.gz"
