SUMMARY="Standards compliant, fast, secure markdown processing library in C"
DESCRIPTION="Hoedown is a revived fork of Sundown, the Markdown parser"
HOMEPAGE="https://github.com/hoedown/hoedown"
COPYRIGHT="2014 Xaier Mendez, Devin Torres, and Hoedown authors"
LICENSE="ISC"
REVISION="1"
SOURCE_URI="https://github.com/hoedown/hoedown/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="01b6021b1ec329b70687c0d240b12edcaf09c4aa28423ddf344d2bd9056ba920"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	hoedown$secondaryArchSuffix = $portVersion
	cmd:hoedown$secondaryArchSuffix = $portVersion
	cmd:smartypants$secondaryArchSuffix = $portVersion
	lib:libhoedown$secondaryArchSuffix = ${portVersion%%.*}
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	hoedown${secondaryArchSuffix}_devel
	devel:libhoedown$secondaryArchSuffix = ${portVersion%%.*}
	"
REQUIRES_devel="
	hoedown$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix 
	cmd:make
	"

TEST_REQUIRES="
	cmd:python3
	cmd:tidy
	"

BUILD()
{
	make
}

INSTALL()
{
	# update install paths
	sed -i 's,PREFIX = /usr/local',"PREFIX = $prefix", Makefile
	sed -i 's,BINDIR = $(PREFIX)/bin',"BINDIR = $binDir", Makefile
	sed -i 's,LIBDIR = $(PREFIX)/lib',"LIBDIR = $libDir", Makefile
	sed -i 's,INCLUDEDIR = $(PREFIX)/include',"INCLUDEDIR = $includeDir", Makefile
	make DESTDIR=$installDestDir install

	prepareInstalledDevelLib libhoedown

	packageEntries devel \
		$developDir
}

TEST()
{
	sed -i 's,python test',"python3 test", Makefile
	make test
}
