# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=kmime
pkgver=6.27.0
pkgrel=2
epoch=1
pkgdesc='Library for handling mail messages and newsgroup articles'
arch=(x86_64 aarch64)
url='https://kontact.kde.org'
license=(LGPL-2.0-or-later)
depends=(glibc
         kcodecs
         libgcc
         libstdc++
         qt6-base)
makedepends=(extra-cmake-modules
             qt6-tools)
groups=(kf6)
source=(https://download.kde.org/stable/frameworks/${pkgver%.*}/$pkgname-$pkgver.tar.xz{,.sig}
        https://invent.kde.org/frameworks/kmime/-/commit/0be16663.patch)
sha256sums=('b0c81fb7e001ac4c05bd6c8b1bb41aaf765f79e4d3e8d17108458a890d712c76'
            'SKIP'
            '039162b7065e2dec02bdfe24f8e36df2baa37ec92276a0092a9b239e2e746547')
validpgpkeys=(53E6B47B45CEA3E0D5B7457758D0EE648A48B3BB  # David Faure <faure@kde.org>
              90A968ACA84537CC27B99EAF2C8DF587A6D4AAC1) # Nicolas Fella <nicolas.fella@kde.org>

prepare() {
# Temporarily restore compatibility with pre-KF6 kmime
  patch -d $pkgname-$pkgver -Rp1 < 0be16663.patch
  sed -e 's|KF_DEP_VERSION VERSION_LESS 6.27|TRUE|' -i $pkgname-$pkgver/CMakeLists.txt
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
