SUMMARY="Algol 68 compiler and interpreter"
DESCRIPTION="Algol68G is an implementation of Algol 68 as defined by the \
Revised Report. It ranks among the most complete implementations of the \
language."
HOMEPAGE="https://jmvdveer.home.xs4all.nl/en.algol-68-genie.html"
COPYRIGHT="2001-2018 J. Marcel van der Veer"
LICENSE="GNU LGPL v3"
REVISION="2"
SOURCE_URI="https://jmvdveer.home.xs4all.nl/algol68g-$portVersion.tar.gz"
CHECKSUM_SHA256="0f757c64a8342fe38ec501bde68b61d26d051dffd45742ca58b7288a99c7e2d8"
SOURCE_URI_2="http://downloads.sourceforge.net/project/algol68/algol68g/algol68g-2.0.0/a68g-doc.pdf#noarchive"
CHECKSUM_SHA256_2="064b6761207d937aa704d245fc871a072f5a33ea23a346cb136ec8b2078ea321"
PATCHES="algol68g-$portVersion.patchset"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	algol68g$secondaryArchSuffix = $portVersion
	cmd:a68g$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgsl$secondaryArchSuffix
	lib:libgslcblas$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libplot$secondaryArchSuffix
	lib:libpq$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgsl$secondaryArchSuffix
	devel:libgslcblas$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libplot$secondaryArchSuffix
	devel:libpq$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:automake
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage algol68g$secondaryArchSuffix \
	"$commandBinDir"/a68g

BUILD()
{
	# TODO: compiler still not enabled
	autoreconf -fi
	LDFLAGS="-lnetwork" runConfigure --omit-dirs binDir ./configure \
		--bindir="$commandBinDir" \
		--enable-compiler
	make $jobArgs
}

INSTALL()
{
	make install
	mkdir -p $developDocDir
	cp $sourceDir2/a68g-doc.pdf $developDocDir
}

TEST()
{
	#make check #test-set not provided
	true
}
