# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
setvar pkgname = 'libmpack'
setvar pkgver = '1.0.5'
setvar pkgrel = '0'
setvar pkgdesc = ""Simple implementation of msgpack in C""
setvar url = ""https://github.com/libmpack/libmpack""
setvar arch = ""all""
setvar license = ""MIT""
setvar makedepends = ""libtool""
setvar subpackages = ""$pkgname-dev""
setvar source = ""$pkgname-$pkgver.tar.gz::https://github.com/libmpack/$pkgname/archive/$pkgver.tar.gz""
setvar builddir = ""$srcdir/$pkgname-$pkgver""

proc build {
	cd $builddir
	make
}

proc check {
	local out
	cd $builddir

	# Tests prints thousands lines, so print only last few when fails.
	setvar out = $(make test) || do {
		echo "Tests failed, printing last 50 lines of the output..."
		printf '%s\n' $out | tail -n 50
		return 1
	}
}

proc package {
	cd $builddir
	make DESTDIR="$pkgdir" PREFIX=/usr install
}

setvar sha512sums = ""6e30edafcacfb580b410bc6749ed7fe8f18b3be0cb98959339853e77bc3ec0cda6df08a0f1f22768cfc773458a2ea6bcef4f0421eea55cf56c58981d13711a04  libmpack-1.0.5.tar.gz""