# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Ben <ben@benmazer.net>

pkgname=gmime3
pkgver=3.2.7
pkgrel=1
pkgdesc="A C/C++ MIME creation and parser library with support for S/MIME, PGP, and Unix mbox spools"
arch=(x86_64)
license=(GPL)
url="https://github.com/jstedfast/gmime"
depends=(glib2 gpgme zlib libidn2)
makedepends=(gobject-introspection gtk-doc git vala docbook-utils)
provides=(libgmime-3.0.so)
_commit=9749a44bae4bacbb59c06d9a62e5e87cb8be3081  # tags/3.2.7^0
source=("git+https://github.com/jstedfast/gmime#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd gmime
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd gmime
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd gmime
  ./configure --prefix=/usr \
    --program-prefix=$pkgname \
    --enable-gtk-doc \
    --enable-smime \
    --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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