# Description: Fast C++ logging library
# URL: https://github.com/gabime/spdlog
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: fmt

name=spdlog
version=1.12.0
release=2
source=(https://github.com/gabime/spdlog/archive/v$version/$name-$version.tar.gz
  d8d23a660601a406a1e1aa07380b5b1c5781c190.patch
  spdlog_fmt_external.patch)

build() {
  patch -Np1 -d $name-$version -i $SRC/spdlog_fmt_external.patch
  patch -Np1 -d $name-$version -i $SRC/d8d23a660601a406a1e1aa07380b5b1c5781c190.patch

  rm -rf $name-$version/include/spdlog/fmt/bundled

  cmake -S $name-$version -B build -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_INSTALL_LIBDIR=lib \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
    -D SPDLOG_FMT_EXTERNAL=ON \
    -D SPDLOG_INSTALL=ON \
    -D SPDLOG_BUILD_SHARED=ON \
    -D SPDLOG_BUILD_EXAMPLE=OFF \
    -D SPDLOG_BUILD_BENCH=OFF \
    -Wno-dev
  cmake --build build
  DESTDIR=$PKG cmake --install build
}
