# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=fmt
pkgver=%version%
pkgrel=%release%
pkgdesc='Open-source formatting library for C++'
arch=(x86_64)
url=https://fmt.dev
license=(MIT)
depends=(gcc-libs)
makedepends=(
  cmake
  doxygen
  git
  ninja
  npm
  python-breathe
  python-docutils
  python-jinja
  python-six
  python-sphinx
  python-wheel
)
provides=(libfmt.so)
_tag=67c0c0c09cf74d407d71a29c194761981614df3e
source=(
  git+https://github.com/fmtlib/fmt.git#tag=${_tag}
  fmt-no-pip-no-virtualenv.patch
  fmt-10.0.0-sphinx.patch
)
b2sums=('SKIP'
        '0bc421afdc4c2527525ce2e21740c9f72e05431394fb4710c1a8fa6d3bb2ee20d0630e2a76ddbac3c0ba27c1ab08f0c8e27d060def1370721b1c94246cbbf0ff'
        '4eabdf38317e22e6b650b91821f1fab50bb3641e4f9a63847cb9b823becd3a4106fe47df37c8dc886f5fe1d1d3e529136c867459105df07c359582214d6fa01f')

prepare() {
  cd fmt
  patch -Np1 -i ../fmt-no-pip-no-virtualenv.patch
  patch -Np1 -i ../fmt-10.0.0-sphinx.patch
}

pkgver() {
  cd fmt
  git describe --tags
}

build() {
  cmake -S fmt -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBUILD_SHARED_LIBS=ON
  cmake --build build
  cmake --build build --target doc
}

check() {
  cmake --build build --target test
}

package() {
  DESTDIR="${pkgdir}" cmake --build build --target install
  install -Dm 644 fmt/LICENSE -t "${pkgdir}"/usr/share/licenses/fmt/
}

# vim: ts=2 sw=2 et:
