SUMMARY="COmputer Language Manipulation"
DESCRIPTION="Colm is a programming language designed for the analysis and \
transformation of computer languages. Colm is influenced primarily by TXL. It \
is in the family of program transformation languages."
HOMEPAGE="https://www.colm.net/open-source/colm/"
COPYRIGHT="2006-2016 Adrian Thurston"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://www.colm.net/files/colm/colm-$portVersion.tar.gz"
CHECKSUM_SHA256="33e624677176958eaad76ebe6c391a68a0b4728fec8cc039efa1316f525f408c"

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

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

PROVIDES="
	colm$secondaryArchSuffix = $portVersion
	cmd:colm$commandSuffix
	lib:libcolm_$portVersion$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	colm${secondaryArchSuffix}_devel = $portVersion
	devel:libcolm$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	colm$secondaryArchSuffix == $portVersion base
	haiku${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:asciidoc
	cmd:autoreconf
	cmd:awk
	cmd:grep
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:sed
	"

defineDebugInfoPackage colm$secondaryArchSuffix \
	$commandBinDir/colm \
	$libDir/libcolm-$portVersion.so

BUILD()
{
	autoreconf -i
	runConfigure --omit-dirs "binDir" ./configure \
		--bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libcolm.la

	prepareInstalledDevelLib libcolm
	fixPkgconfig

	packageEntries devel $developDir
}
