# Maintainer: LoveSy <shana@zju.edu.cn>

pkgname=yodl
pkgver=4.03.03
pkgrel=2
pkgdesc='Implements a pre-document language and tools to process it'
arch=('i686' 'x86_64')
url='https://fbb-git.gitlab.io/yodl/'
msys2_references=(
  "cpe: cpe:/a:yodl_project:yodl"
)
license=('GPL3')
depends=('bash')
makedepends=('icmake>=8.00.00' 'gcc')
_patches=(
  0001-Remove-bool-that-conflict-with-c23.patch
)
source=("https://gitlab.com/fbb-git/${pkgname}/-/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz"
        ${_patches[@]})
sha512sums=('5ba3a70152e3820dc08e2da821f357ec00c1f0f500e52bc4cc5a36f5d4ea8cdc13d564f5678a306cfb621d30bc53dd85f6756a6bbfd6825f63237d9217deaf3b'
            '97191c03650ac8bd1dab7e6da7af3bae94112495c27f2fd1dfc6b568c12225fcdb8d486b9e9865d47d8c825d4551f0142b7b451bf85210f4a9ad66e1ea6702f3')

prepare() {
  pushd "${srcdir}/${pkgname}-${pkgver}"

  for patch in "${_patches[@]}"; do
    msg2 "Patching with ${patch}"
    patch -Nbp1 -i "${srcdir}/${patch}"
  done

  popd
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}/${pkgname}"
  rm -f verbinsert/VERSION
  cp VERSION verbinsert/
  
  CXXFLAGS+=' --std=c++20'
  ./build programs
  ./build macros
  ./build man
  ./build html
}
package() {
  cd "${srcdir}/${pkgname}-${pkgver}/${pkgname}"
  ./build install programs "${pkgdir}"
  ./build install macros "${pkgdir}"
  ./build install man "${pkgdir}"
  ./build install manual "${pkgdir}"
}
