# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Tim S. <stahta01@gmail.com>

_realname=kicad-doc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-ca"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-de"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-en"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-es"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-fr"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-id"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-it"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ja"
         # "${MINGW_PACKAGE_PREFIX}-${_realname}-nl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-pl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ru"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-zh")
pkgver=5.1.9
pkgrel=1
pkgdesc="Documentation for KiCad (mingw-w64)"
arch=(any)
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="http://www.kicad-pcb.org"
license=("GPL3" "custom")
makedepends=()
optdepends=("${MINGW_PACKAGE_PREFIX}-kicad-meta"
            "${MINGW_PACKAGE_PREFIX}-kicad")
options=('!strip')

source=("https://kicad-downloads.s3.cern.ch/docs/kicad-doc-${pkgver}.tar.gz")
sha256sums=('61571f260bba67e26b9f7456ad6eb5da7c3b406412f506e7857d0ca70ca66393')

build_lang() {
  cd "${srcdir}/kicad-doc-${pkgver}/share/doc/kicad/help"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
  cp -R ${langid} "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
}

for _n in ${pkgname[@]}; do
  eval "package_${_n}() {
    langid="${_n#${MINGW_PACKAGE_PREFIX}-${_realname}-}" build_lang
  }"
done
