# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libetpan
pkgver=1.9.4
pkgrel=2
pkgdesc="a portable middleware for email access"
url="http://www.etpan.org/"
arch="all"
license="custom:etpan"
subpackages="$pkgname-dev $pkgname-doc"
makedepends="cyrus-sasl-dev curl-dev expat-dev gnutls-dev libgcrypt-dev
	libgpg-error-dev autoconf automake libtool zlib-dev"
depends_dev="cyrus-sasl-dev"
source="libetpan-$pkgver.tar.gz::https://github.com/dinhviethoa/libetpan/archive/$pkgver.tar.gz
	fix-build.patch
	CVE-2020-15953.patch
	"

# secfixes:
#   1.9.4-r1:
#     - CVE-2020-15953

prepare() {
	default_prepare
	touch README
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-gnutls=yes \
		--with-openssl=no \
		--with-gnutls \
		--disable-static
	make
}

check() {
	make check
}

package() {
	cd "$srcdir"/$pkgname-$pkgver
	make DESTDIR="$pkgdir" install
	install -Dm644 COPYRIGHT "$pkgdir"/usr/share/licenses/$pkgname/license.txt
}

sha512sums="7b7047d084fb4ce0c91821c2ad78e921d6d009106851afb7f5b068713c84ebe6926f6bf7a7423f263eeebef617511e44f6b65448d892bbc058c447235fd55c0f  libetpan-1.9.4.tar.gz
85d0be0b1a57cb5865a6802c01c9f4fe3e4e32b06929a9c7f688be6f2115a2f6ea8229fd637f83d1376925939b7112bcb6704a9bd79206bf821c32f06747e6c9  fix-build.patch
4430fb1172944b48a379feb9d716d6d8594819206daabcd2c00dbdd07fa4598a213161d97073f1e5cacab08921263c938bbf40c1ba9080436a5dba4a17dcfd79  CVE-2020-15953.patch"
