# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: SaultDon <sault.don gmail>
pkgname=pdal
pkgver=2.9.2
pkgrel=2
pkgdesc="A C++ library for translating and manipulating point cloud data"
arch=('x86_64' 'aarch64')
url="http://www.pdal.io"
license=('BSD')
depends=('gdal' 'libgeotiff' 'jsoncpp')
makedepends=('cmake' 'python' 'python-numpy' 'ninja' 'postgresql-libs')
optdepends=('python-numpy: for the Python plugin'
            'sqlite: for the sqlite plugin'
            'postgresql-libs: for the postgresql plugin')
provides=('pdal')
source=("https://github.com/PDAL/PDAL/releases/download/${pkgver}/PDAL-${pkgver}-src.tar.bz2")
sha512sums=('eaf2e9b57880a561165850c059ff1d3abee90864bb3944a8c0a8af697687b4b195423ad95f4efc15a74b98e7397a60bed1a6d94ce84e9e4b3555729618f23942')

build() {
  cd "PDAL-$pkgver-src/"

  cmake \
    -Bbuild \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PLUGIN_PGPOINTCLOUD=ON \
    -DWITH_COMPLETION=ON

  ninja -C build
}

package() {
  cd "PDAL-$pkgver-src"

  DESTDIR="$pkgdir/" ninja -C build install

  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE
}
