_realname=human-theme-gtk

mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_repository_url='https://github.com/luigifab/human-theme'

pkgbase=mingw-w64-$_realname
pkgname=${MINGW_PACKAGE_PREFIX}-$_realname
pkgver=3.2.0
pkgrel=1
pkgdesc='Human theme for GTK (mingw-w64)'
url='https://github.com/luigifab/human-theme'
license=('spdx:GPL-3.0-or-later' 'spdx:LGPL-2.1-or-later' 'spdx:CC-BY-SA-3.0-or-later')
arch=('any')
#optdepends=('gtk-engine-murrine: for gtk2' 'qt5-style-globalqss: for qt5' 'qt6-style-globalqss: for qt6')
makedepends=("${MINGW_PACKAGE_PREFIX}-7zip" "${MINGW_PACKAGE_PREFIX}-python")
source=("https://github.com/luigifab/human-theme/archive/v${pkgver}/human-theme-${pkgver}.tar.gz")
noextract=("human-theme-$pkgver.tar.gz")
sha256sums=('SKIP')

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

package() {
  cd "$pkgname-$pkgver"

  # the entire source code is GPL-3.0-or-later, except */metacity-1/* which is LGPL-2.1-or-later,
  # and */gtk-2.0/* which is CC-BY-SA-3.0-or-later
  install -dm 755 "$pkgdir/${MINGW_PREFIX}/share/themes/"
  cp -a src/Human/            "$pkgdir/${MINGW_PREFIX}/share/themes/"
  cp -a src/Human-blue/       "$pkgdir/${MINGW_PREFIX}/share/themes/"
  cp -a src/Human-green/      "$pkgdir/${MINGW_PREFIX}/share/themes/"
  cp -a src/Human-orange/     "$pkgdir/${MINGW_PREFIX}/share/themes/"

  #install -Dpm 644 README.md "$pkgdir/${MINGW_PREFIX}/share/doc/$_realname/README.md"
  install -Dpm 644  LICENSE   "$pkgdir/${MINGW_PREFIX}/share/licenses/$_realname/LICENSE"
}