SUMMARY="A space real-time strategy computer game"
DESCRIPTION="Homeworld is a real-time strategy computer game, set and played \
in a 3D space environment. Developed by Relic Entertainment, it was released \
for the PC in 1998 to worldwide acclaim, winning multiple awards for its \
novel gameplay and strong single-player story. Relic Entertainment later \
released the source code to the public under license."
HOMEPAGE="https://gitlab.com/ThibaultLemaire/HomeworldSDL/"
COPYRIGHT="1999-2000 Sierra On-Line, Inc."
LICENSE="RE-INC-EULA"
REVISION="3"
SOURCE_URI="https://bitbucket.org/extrowerk/homeworld-sdl-haiku/get/e80d5e8c7a73.tar.gz"
CHECKSUM_SHA256="f098c3f713eca5718433ffb4bc9a7ad71eb7d584cbf9fe9eb3a1266363843bd1"
SOURCE_DIR="extrowerk-homeworld-sdl-haiku-e80d5e8c7a73"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	homeworld_sdl$secondaryArchSuffix = $portVersion
	app:homeworld_sdl$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgl$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libsdl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool
	cmd:make
	cmd:unzip
	cmd:yacc$secondaryArchSuffix
	"

BUILD()
{
	cd Haiku
	echo "Bootstrapping Homewold_SDL"
	bash ./bootstrap
	echo "Configuring Homeworld_SDL"
	runConfigure ../configure -C --bindir=$appsDir/Homeworld_SDL
	echo "Building Homeworld_SDL"
	make $jobArgs
}

INSTALL()
{
	cd Haiku/src
	echo "Striping debug symbols"
	strip homeworld
	echo "Creating bin directory for packaging Homeworld_SDL"
	mkdir -p $appsDir/Homeworld_SDL
	echo "Moving binary into the bin directory"
	cp homeworld $appsDir/Homeworld_SDL/homeworld_sdl
	cd ..
	unzip -o ./Haiku_Extra/Homeworld_Haiku_Start.sh.zip
	cp Homeworld_Haiku_Start.sh $appsDir/Homeworld_SDL/Start_Homeworld_SDL.sh
	echo "Adding Homeworld_SDL to the Deskbar"
	addAppDeskbarSymlink $appsDir/Homeworld_SDL/Start_Homeworld_SDL.sh \
		Homeworld_SDL
}
