pkgname=libfmt
pkgver=11.1.4
pkgdesc="Small, safe and fast formatting library"
homepage="https://fmt.dev/dev/ https://github.com/fmtlib/fmt"
license=("MIT")
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://github.com/fmtlib/fmt/archive/${pkgver}.tar.gz")
sha512sums=("573b7de1bd224b7b1b60d44808a843db35d4bc4634f72a9edcb52cf68e99ca66c744fd5d5c97b4336ba70b94abdabac5fc253b245d0d5cd8bbe2a096bf941e39")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local cmake_args=(
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_BUILD_TYPE=release
    -D BUILD_SHARED_LIBS=ON
    -W no-dev
    -D FMT_CMAKE_DIR="/usr/lib/cmake/fmt"
    -D FMT_LIB_DIR="/usr/lib"
    -D FMT_TEST=true
  )
  cmake -B build "${cmake_args[@]}"
  cmake --build build
}

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

src_install() {
  DESTDIR="$pkgdir" cmake --install build
}

# vim:ft=sh syn=sh et sw=2:
