# Maintainer: Hannah von Reth <vonreth@kde.org>

_variant=-${KF5_VARIANT:-shared}
source "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/kde-frameworks5
_kde_f5_init_package "${_variant}" "snorenotify"

#_realname=snorenotify
pkgbase=mingw-w64-${_basename}
pkgname="${MINGW_PACKAGE_PREFIX}-${_basename}"
provides=("${MINGW_PACKAGE_PREFIX}-Snorenotify")
replaces=("${MINGW_PACKAGE_PREFIX}-Snorenotify")
pkgver=0.7.0
pkgrel=4
pkgdesc="Multi-platform Qt5 notification framework (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://techbase.kde.org/Projects/Snorenotify"
msys2_repository_url="https://invent.kde.org/libraries/snorenotify"
license=("spdx:LGPL-3.0-only")
depends=()
_kde_f5_add_depends "${_variant}" "${MINGW_PACKAGE_PREFIX}-qt5-base${_namesuff}"
_kde_f5_add_depends "${_variant}" "${MINGW_PACKAGE_PREFIX}-snoregrowl"
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-qt5-tools"
             "${MINGW_PACKAGE_PREFIX}-extra-cmake-modules")
options=(!buildflags)
source=("https://download.kde.org/stable/${_basename}/${pkgver}/src/${_basename}-${pkgver}.tar.xz")
sha256sums=('6d411ba6e31a73db56d298195f8336f66f8fe4fffd64d5fde3f14090e68ee64b')

build() {
  mkdir -p "${srcdir}"/build-${MSYSTEM}${_variant}
  cd "${srcdir}"/build-${MSYSTEM}${_variant}

  local -a extra_config
  if [ "${_variant}" = "-static" ]; then
    extra_config+=( -DBUILD_SHARED_LIBS=NO )
  fi

  _kde_f5_build_env
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=$(_kde_f5_CMAKE_BUILD_TYPE) \
    "${_kde_f5_KDE_INSTALL_DIRS[@]}" \
    "${extra_config[@]}" \
    ../${_basename}-${pkgver}

   ${MINGW_PREFIX}/bin/cmake --build .
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}${_variant}
  DESTDIR="${pkgdir}"  ${MINGW_PREFIX}/bin/cmake --install .
}
