# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=docopt-cpp
pkgver=0.6.3
pkgrel=3
pkgdesc="Command line arguments parser for C++11 and later"
url="https://github.com/docopt/docopt.cpp/"
arch="all"
license="MIT"
options="!check" # No test suite from upstream
makedepends="cmake samurai"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/docopt/docopt.cpp/archive/v$pkgver.tar.gz
	docopt.pc
	"
builddir="$srcdir/docopt.cpp-$pkgver"

provides="docopt=$pkgver-r$pkgrel"
replaces="doctopt"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 "$srcdir"/docopt.pc "$pkgdir"/usr/lib/pkgconfig/docopt.pc
	sed -i "s|@VERSION@|$pkgver|" "$pkgdir"/usr/lib/pkgconfig/docopt.pc
	install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" README.rst
}

sha512sums="
01f881684d416d25f27120e7707473ee7337c09d1d3ce73bd1efd7763955c0bfa86c6d14655d989e37659af940b12c9ac0854571a758a71bf4a7f35e70277c40  docopt-cpp-0.6.3.tar.gz
16476e0d3499daf55122cd1df8a8355b50a5ea0eaefd488b12a2956cb497a360cf84bc2230bc80ef87e0440f99ad0a753c87e03a6bd6911595237d2cb66d20e4  docopt.pc
"
