# Contributor: Daniel Sabogal <dsabogalcc@gmail.com>
# Contributor: Daniel Fancsali <fancsali@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=discount
pkgver=3.0.0d
pkgrel=0
pkgdesc="A Markdown to HTML translator written in C"
url="http://www.pell.portland.or.us/~orc/Code/discount/"
arch="all"
license="BSD-3-Clause"
depends="!markdown"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/Orc/discount/archive/v$pkgver.tar.gz
	configure.inc.patch
	"

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

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

package() {
	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="
ab24722bb8513f64eed59bb2770276b91615033b494a0492a331f36c5fcd2e32b7a9f3bd7ef0bb74c107f1e0e955522c83ddba6c482fca7f18cf275334707c4d  discount-3.0.0d.tar.gz
a7d6924b45afbf9a12ec3fdd38e810a76f2557cae5d3f852839c75ada36942ac52237ff6ca39a01d812de90a9f3fc1dcfda9af80521757a1524e46af3609be5a  configure.inc.patch
"
