SUMMARY="A fast and powerful lossless audio compressor"
DESCRIPTION="Monkey's Audio is a lossless audio format. This package provides \
the mac command line utility for compressing and decompressing Monkey's Audio \
files."
HOMEPAGE="https://www.monkeysaudio.com/"
COPYRIGHT="2000-2022 Matthew T. Ashland"
LICENSE="Monkey's Audio SDK and Source Code License Agreement"
REVISION="1"
SOURCE_URI="https://www.monkeysaudio.com/files/MAC_SDK_${portVersion/./}.zip"
CHECKSUM_SHA256="5de68b52892dfed8a84f01fa3b0781a00b84e3d9a57bcbda5cd8e50f384d2a60"
SOURCE_DIR=""

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

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

libVersion="8"

PROVIDES="
	mac$secondaryArchSuffix = $portVersion
	cmd:mac$commandSuffix = $portVersion
	lib:libMAC$secondaryArchSuffix = $libVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	mac${secondaryArchSuffix}_devel = $portVersion
	devel:libMAC$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	mac$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	export CXXFLAGS="$CXXFLAGS -fpermissive"
	make -f Source/Projects/NonWindows/Makefile $jobArgs
}

INSTALL()
{
	make -f Source/Projects/NonWindows/Makefile \
		prefix="$prefix" bindir="$commandBinDir" \
		libdir="$libDir" includedir="$includeDir" install

	install -m 755 -d "$developDocDir"
	install -m 644 -t "$developDocDir" Readme.txt

	prepareInstalledDevelLibs libMAC

	packageEntries devel \
		"$developDir"
}
