# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

source "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/kde-frameworks
_realname=breeze
pkgbase="mingw-w64-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=6.4.5
pkgrel=1
pkgdesc="Artwork, styles and assets for the Breeze visual style for the Plasma Desktop (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: breeze'
)
msys2_repository_url='https://invent.kde.org/plasma/breeze/'
url='https://kde.org/plasma-desktop/'
license=('spdx:LGPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-breeze-icons"
         "${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-kcolorscheme"
         "${MINGW_PACKAGE_PREFIX}-kconfig"
         "${MINGW_PACKAGE_PREFIX}-kcoreaddons"
         "${MINGW_PACKAGE_PREFIX}-kguiaddons"
         "${MINGW_PACKAGE_PREFIX}-ki18n"
         "${MINGW_PACKAGE_PREFIX}-kiconthemes"
         "${MINGW_PACKAGE_PREFIX}-kirigami"
         "${MINGW_PACKAGE_PREFIX}-kwindowsystem"
         "${MINGW_PACKAGE_PREFIX}-qt6-base"
         "${MINGW_PACKAGE_PREFIX}-qt6-declarative")
makedepends=("${MINGW_PACKAGE_PREFIX}-7zip"
             "${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-extra-cmake-modules"
             "${MINGW_PACKAGE_PREFIX}-gettext-tools"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-qt6-tools")
groups=("${MINGW_PACKAGE_PREFIX}-plasma")
source=("https://download.kde.org/stable/plasma/${pkgver}/${_realname}-${pkgver}.tar.xz"{,.sig})
noextract=("${_realname}-${pkgver}.tar.xz")
sha256sums=('dcb8433d399511546958f4c8c1a8fae5ed22f2a698f053968d410ee75bd6d8b4'
            'SKIP')
validpgpkeys=(
  'D07BD8662C56CB291B316EB2F5675605C74E02CF' # David Edmundson (David at KDE) <davidedmundson@kde.org>
  'E0A3EB202F8E57528E13E72FD7574483BB57B18D' # Jonathan Esk-Riddell <jr@jriddell.org>
  '0AAC775BB6437A8D9AF7A3ACFE0784117FBCE11D' # Bhushan Shah (mykolab address) <bshah@mykolab.com>
)

prepare() {
  7z x -bso0 -bsp0 "${_realname}-${pkgver}.tar.xz"
  7z x -bso0 -bsp0 -snld20 -ttar "${_realname}-${pkgver}.tar"
  python "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/replace-symlinks.py "${_realname}-${pkgver}"
}

build() {
  declare -a _extra_config
  if check_option "debug" "n"; then
    _extra_config+=("-DCMAKE_BUILD_TYPE=Release")
  else
    _extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
  fi

  _kde_build_env
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    "${MINGW_PREFIX}"/bin/cmake.exe \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
      "${_KDE_INSTALL_DIRS[@]}" \
      -DBUILD_TESTING=OFF \
      -DBUILD_QT5=OFF \
      "${_extra_config[@]}" \
      -S "${_realname}-${pkgver}" \
      -B "build-${MSYSTEM}"

  "${MINGW_PREFIX}"/bin/cmake.exe --build "build-${MSYSTEM}"
}

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