# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=rippled
pkgver=0.80.2
pkgrel=0
pkgdesc="Blockchain daemon implementing the Ripple Consensus Ledger"
url="https://ripple.com/"
arch="x86_64"
license="ISC"
makedepends="cmake libressl-dev boost-dev protobuf-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ripple/$pkgname/archive/$pkgver.tar.gz
       musl-fixes.patch
       "
builddir="$srcdir/"$pkgname-$pkgver

build() {
	cd "$builddir"
	mkdir build && cd build
	cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=release
	make
}

check() {
	cd "$builddir"
	./build/rippled --unittest
}

package() {
	cd "$builddir"
	install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
	install -D build/rippled "${pkgdir}/usr/bin/rippled"
	install -D -m644 doc/rippled-example.cfg "${pkgdir}/etc/$pkgname/rippled.cfg"
	install -D -m644 doc/validators-example.txt "${pkgdir}/etc/$pkgname/validators.txt"
}

sha512sums="4f4b10567ce349e51cb19e556db10c179a62d979f70051fa8f111ee0536b26af9776ba7ef6629400cdc6d9d8ee69b10b738dab7fb4b5297fa7c71107d8f2de04  rippled-0.80.2.tar.gz
a26b01f8bf541471f96f3865b99923b267611ece093f8cbc4f35f87002c403b6e558e5ac15cc7599e9a5c1486f3070a4f61a880a2a3b874fc2dab5d8a6d8e82e  musl-fixes.patch"
