SUMMARY="Tool for relocating SID tunes"
DESCRIPTION="Sidreloc is a tool for relocating SID tunes any number of whole pages, \
using a novel but remarkably simple algorithm. It can also relocate \
all zero-page variables used by the tune."
HOMEPAGE="https://www.linusakesson.net/software/sidreloc/index.php"
COPYRIGHT="2012-2020 Linus Akesson
	2005-2020 Ian Piumarta"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://hd0.linusakesson.net/files/sidreloc-$portVersion.tgz"
CHECKSUM_SHA256="8ca55fb4886bda2a499f837e2f9ffd0a4b7217ee7bb1907ceed9e87ef6157bf6"

PATCHES="sidreloc-$portVersion.patchset"
ADDITIONAL_FILES="
	configure.ac
	Makefile.am
	ax_check_compile_flag.m4-dist
	"

ARCHITECTURES="all !x86_gcc2 ?arm ?ppc ?sparc"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	sidreloc$secondaryArchSuffix = $portVersion
	cmd:sidreloc$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cp -r "$portDir"/additional-files/configure.ac .
	cp -r "$portDir"/additional-files/Makefile.am .

	mkdir -p ./m4
	cp -r "$portDir"/additional-files/ax_check_compile_flag.m4-dist ./m4/ax_check_compile_flag.m4

	autoreconf --force --install --verbose
	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir"
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST(){
	make check
}