# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=minio
pkgbase=mingw-w64-${_realname}-docs
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-docs")
pkgver=2025.10.10
_pkgver=afd0e04c7f1dbe737b1f5fd5edc957ead0a94ccb
pkgrel=1
pkgdesc='Object storage server compatible with Amazon S3 (mingw-w64) (documentation)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://docs.min.io/'
msys2_repository_url='https://github.com/minio/docs'
license=('spdx:CC-BY-4.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-nodejs"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python-wheel"
             "git"
             "vim")
source=("${msys2_repository_url}/archive/${_pkgver}/docs-${_pkgver}.tar.gz")
sha256sums=('76664ddcea1e2166fc2d22f4ffd5d297008c8d04335c3bf6dd83b261f0e8c260')

build() {
  cp -r "docs-${_pkgver}" "build-${MSYSTEM}" && cd "build-${MSYSTEM}"

  python -m venv venv && source venv/bin/activate

  pip install -r requirements.txt

  npm install && npm run build

  make mindocs
}

package() {
  cd "build-${MSYSTEM}"

  _mindocs=$(find -type d -name mindocs)
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
  cp -a "${_mindocs}/html" "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/html"

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}-docs/LICENSE"
}
