# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=rasdaemon
pkgver=0.8.0
pkgrel=1
pkgdesc="utility to receive RAS error tracings"
url="https://github.com/mchehab/rasdaemon"
arch="x86_64"
license="GPL-2.0-or-later"
depends="dmidecode
	perl
	perl-dbd-sqlite
	"
makedepends="argp-standalone
	autoconf
	automake
	sqlite-dev
	libtool
	libtraceevent-dev
	linux-headers
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
# Bad release name for 0.8.0: https://github.com/mchehab/rasdaemon/releases
# https://github.com/mchehab/rasdaemon/releases/download/v$pkgver/rasdaemon-$pkgver.tar.bz2
source="$pkgname-$pkgver.tar.gz::https://github.com/mchehab/rasdaemon/archive/refs/tags/v$pkgver.tar.gz
	$pkgname.initd
	"

build() {
	autoreconf -vfi
	export LIBS="-largp"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-abrt-report \
		--enable-aer \
		--enable-devlink \
		--enable-diskerror \
		--enable-extlog \
		--enable-hisi-ns-decode \
		--enable-mce \
		--enable-non-standard \
		--enable-sqlite3
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
f66f3f1663253c64070f9b93141011a2a11f7ad625e10d3b6cd7b7fbe3e75460c2ffff4d54b12893957e3e67f3b6d13a04093cc81fc3168fbdc67339cdb43e49  rasdaemon-0.8.0.tar.gz
edee5b32765b3c89ab82e5cd410b0b381aa58470fdaed3a94516aa954845123b661a4923435f7d0bc9c33fb9b1e42a611dc1aa629a5db7d3e431164e4cd432cf  rasdaemon.initd
"
