# Contributor: Raed Rizqie <raed.rizqie@gmail.com>

_realname=rssguard
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.8.6
pkgrel=1
pkgdesc='Feed reader and podcast player which supports RSS/ATOM/JSON (mingw-w64)'
arch=(any)
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/martinrotter/rssguard'
msys2_references=(
  'archlinux: rssguard'
)
license=('spdx:GPL-3.0-only')
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-mpv"
         "${MINGW_PACKAGE_PREFIX}-nodejs"
         "${MINGW_PACKAGE_PREFIX}-qt6-5compat"
         "${MINGW_PACKAGE_PREFIX}-qt6-base"
         "${MINGW_PACKAGE_PREFIX}-qt6-declarative"
         "${MINGW_PACKAGE_PREFIX}-qt6-multimedia"
         #"${MINGW_PACKAGE_PREFIX}-qt6-webengine"
         "${MINGW_PACKAGE_PREFIX}-sqlite")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-qt6-tools")
source=("https://github.com/martinrotter/${_realname}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('c29bdda08ece8de113dbdb87e8e23491221ba9ddbacd26141d6a00e04888972e')

build() {
  CXXFLAGS+=" -Wno-deprecated-declarations -Wno-ignored-attributes"
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  cmake \
    -GNinja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DBUILD_MSYS2=ON \
    -DBUILD_WITH_QT6=ON \
    -DREVISION_FROM_GIT=OFF \
    -DNO_UPDATE_CHECK=ON \
    -DNO_LITE=OFF \
    -S ${_realname}-${pkgver} \
    -B build-${MSYSTEM}

  cmake --build build-${MSYSTEM}
}

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

  install -Dm644 ${_realname}-${pkgver}/LICENSE.md \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.md
}

