# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=cppdap
pkgver=1.58.0
pkgrel=2.2
pkgdesc='C++ library for the Debug Adapter Protocol'
arch=(x86_64 aarch64)
url='https://github.com/google/cppdap'
license=(Apache-2.0)
depends=(gcc-libs
         glibc)
makedepends=(cmake
             git
             nlohmann-json)
source=(git+https://github.com/google/cppdap#tag=dap-$pkgver-a)
sha256sums=('84c59af16b1fa109223c64ee44c5df12a9c3d3b4fab90cacd20a2b4efd048554')

prepare() {
  cd cppdap
  git cherry-pick -n 6a3cc9a8 # Build shared lib
  git cherry-pick -n c69444e  # Fix for gcc-15
}

build() {
  cmake -B build -S cppdap \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON \
    -DBUILD_SHARED_LIBS=ON
  cmake --build build
}

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