# Contributor: Daniel Sabogal <dsabogalcc@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=discount
pkgver=2.2.2
pkgrel=1
pkgdesc="A Markdown to HTML translator written in C"
url="http://www.pell.portland.or.us/~orc/Code/discount/"
arch="all"
license="BSD"
depends="!markdown"
makedepends=""
checkdepends="diffutils"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="http://www.pell.portland.or.us/~orc/Code/discount/$pkgname-$pkgver.tar.bz2
	configure.inc.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure.sh \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--enable-all-features \
		--with-fenced-code \
		--pkg-config \
		--shared
	make
}

check() {
	msg "Running testsuites..."
	cd "$builddir"
	make test
}

package() {
	cd "$builddir"
	make PREFIX=/usr DESTDIR="$pkgdir" install.everything
	local bin; for bin in theme makepage mkd2html; do
		mv "$pkgdir"/usr/bin/$bin \
			"$pkgdir"/usr/bin/$pkgname-$bin
		mv "$pkgdir"/usr/share/man/man1/$bin.1 \
			"$pkgdir"/usr/share/man/man1/$pkgname-$bin.1
	done
}

sha512sums="67d882c0a334592230332815c543458b3c916a950bf7983f8a468fbc9f61154b4023d4bf451b76639fcb3a076506b48118f192a8e21f2535b3f49c7f081bbdf3  discount-2.2.2.tar.bz2
d243f0b5e01cd91376fa94960e9abcdbf24d3579f7d4b5220262e867adefdc5e9ed850fe0228cc290ed605f4b42c50a5ce1ac3fb61ff191a24dc2349d16b2ff2  configure.inc.patch"
