# Description: A 3D recreation of the classic DOS game Scorched Earth.
# URL: https://github.com/jjaxse2017/scorched-earth-3d
# Maintainer: UNMAINTAINED
# Depends on: fftw freealut glew sdl_mixer sdl_net wxgtk3 p7zip

name=scorched3d
version=44
release=2
source=(https://github.com/jjaxse2017/scorched-earth-3d/archive/x86_64_gcc_7/$name-$version-src.tar.gz)

build() {
	cd scorched-earth-3d-*/data/globalmods
	7z x apoc.7z
	7z x none.7z.001
	cd ../..

	# accommodate the new wxgtk function signatures
	sed -e '/SetTickFreq/s/4, 0/4/' \
	    -i src/launcher/wxdialogs/DisplayDialog.cpp
	
	# update the version string, and respect the syntax expected by test
	sed -e '/ VERSION=43/s/43/44/; /test/s/== /= /g' -i configure

	# configure using pkgconf, not the deprecated freetype-config
	FT2_CONFIG="/usr/bin/pkgconf freetype2" \
		/bin/bash ./configure \
		--prefix=/usr \
		--datadir=/usr/share/scorched3d \
		--with-wx-config=/usr/bin/wx-config-gtk3 \
		--without-pgsql \
		--disable-freetypetest \
		--disable-dependency-tracking

	make
	make DESTDIR=$PKG install
	rm -r $PKG/usr/share/scorched3d/documentation
}
