SUMMARY="A utility to convert markdown to man pages"
DESCRIPTION="go-md2man converts standard markdown formatted documents \
into manpages. It is written purely in Go so as to reduce dependencies \
on 3rd party libs."
HOMEPAGE="https://github.com/cpuguy83/go-md2man"
COPYRIGHT="2017 Brian Goff
	2017 Russ Ross"
LICENSE="MIT
	BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/cpuguy83/go-md2man/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="108e4503fed96aa33fc89e98f8cca8f0ac2c3f79d272999463bacdaedf3606ac"
SOURCE_DIR="go-md2man-$portVersion"

ARCHITECTURES="?all"

PROVIDES="
	go_md2man = $portVersion
	cmd:go_md2man = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc
	cmd:git
	cmd:go
	cmd:make
	cmd:makeinfo
	cmd:which
	"

BUILD()
{
	# setup go environment
	BUILD=$(pwd)/../build
	BUILD_GOPATH=$BUILD/gopath
	BUILD_GOROOT=$BUILD/goroot

	rm -rf $BUILD
	mkdir -p $BUILD_GOPATH/bin $BUILD_GOPATH/src $BUILD_GOROOT
	cp -R -s $(go env GOROOT)/* $BUILD_GOROOT

	export GOPATH=$BUILD_GOPATH
	export GOROOT=$BUILD_GOROOT
	export PATH=$PATH:$GOPATH/bin

	# copy source
	mkdir -p $GOPATH/src/github.com/cpuguy83/go-md2man
	cp -R -s $(pwd)/* $GOPATH/src/github.com/cpuguy83/go-md2man
	cp -R -s $(pwd)/vendor/* $GOPATH/src

	go get github.com/cpuguy83/go-md2man
}

INSTALL()
{
	install -d $binDir
	install ../build/gopath/bin/go-md2man $binDir
}
