SUMMARY="Systems programming language with C-like syntax & static typing"
DESCRIPTION="The D programming language was started by Walter Bright, as a \
'better C++' and has grown slowly, but steadily, for more than 15 years. Recent \
improvements to the D development process have accelerated development of the \
language and shown the need for a governing organization that overlooks and \
arranges the future development of the D programming language."
HOMEPAGE="https://dlang.org/"
COPYRIGHT="1999-2014 Digital Mars"
LICENSE="Digital Mars"
REVISION="1"
SOURCE_URI="https://github.com/dlang/dmd/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="526860456d181bb39ebdb7fb2bbb13e3afe62ec07c588eb5a5e8b8b61627ed8f"
PATCHES="dmd-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
	dmd$secondaryArchSuffix = $portVersion
	cmd:dmd$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	dmd_data == $portVersion
	"

if [ -z "$secondaryArchSuffix" ]; then
	SUMMARY_data="Standard resource files for dmd"
	ARCHITECTURES_data="any"
	PROVIDES_data="
		dmd_data = $portVersion
		"
	REQUIRES_data=""
fi

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

BUILD()
{
	make $jobArgs -f haiku.mak \
		DATADIR=$dataDir/dlang
}

INSTALL()
{
	make $jobArgs -f haiku.mak install \
		ARCH_SUFFIX=$secondaryArchSuffix \
		BINDIR=$binDir \
		DATADIR=$dataDir/dlang \
		MANDIR=$manDir

	if [ -z "$secondaryArchSuffix" ]; then
		packageEntries data \
			$dataDir/dlang
	else
		rm -rf $dataDir/dlang $manDir
	fi
}

TEST()
{
	make $jobArgs -f haiku.mak test
}
