SUMMARY="Make a fortune dealing drugs on the streets of New York"
DESCRIPTION="dopewars is a free Unix/Win32 rewrite of a game originally based \
on \"Drug Wars\" by John E. Dell. The idea of dopewars is to deal in drugs on \
the streets of New York, amassing a huge fortune and paying off the loan \
shark, while avoiding the ever-annoying police. The Unix/Win32 rewrite, as \
featuring a so-called \"antique\" mode which closely follows the original, \
introduces new features such as the ability to take part in multi-player \
games. dopewars aims to be highly configurable, and what you can't change in \
the configuration files you can change by poking around in the source, which \
is freely available under the terms of the GNU General Public License.

ADVISORY: dopewars is not recommended for children below 16 without parental \
supervision. We also do not condone real-life drug dealing."
HOMEPAGE="https://dopewars.sourceforge.io/
	https://github.com/benmwebb/dopewars"
COPYRIGHT="1999-2020 dopewars developers"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/dopewars/dopewars-$portVersion.tar.gz"
CHECKSUM_SHA256="83127903a61d81cda251a022f9df150d11e27bdd040e858c09c57927cc0edea6"
PATCHES="dopewars-$portVersion.patchset"

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

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

GLOBAL_WRITABLE_FILES="
	var/dopewars.sco keep-old
	"

PROVIDES="
	dopewars$secondaryArchSuffix = $portVersion
	cmd:dopewars$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcurl$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_mixer_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	"

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

INSTALL()
{
	make install
	install -m 755 -d "$docDir"
	mv $prefix/share/doc/dopewars/* "$docDir"
	rm -rf "$dataDir/gnome" "$dataDir/pixmaps" "$prefix/share"
}
