# Template file for 'opentyrian'
pkgname=opentyrian
version=2.1.20221123
revision=1
build_wrksrc="$pkgname-$version"
build_style=gnu-makefile
hostmakedepends="pkg-config unzip"
makedepends="SDL2-devel SDL2_net-devel"
short_desc="OSS port of the DOS shoot-em-up Tyrian"
maintainer="Aicaya Maro <aicaya@posteo.net>"
license="GPL-2.0-or-later"
homepage="https://github.com/opentyrian/opentyrian"
distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz
 https://camanis.net/tyrian/tyrian21.zip"
checksum="e0e8a8b0d61de10a3a65789ace9ea8e8c5d8dc67f3e423d2c852d64da38aeeb9
 7790d09a2a3addcd33c66ef063d5900eb81cc9c342f4807eb8356364dd1d9277"
replaces="opentyrian-data>=0"

post_install() {
	local _dir="${wrksrc}/tyrian21"

	# data files
	vmkdir usr/share/games/tyrian
	vcopy ${_dir}/*.dat usr/share/games/tyrian
	vcopy ${_dir}/*.lvl usr/share/games/tyrian
	vcopy ${_dir}/*.shp usr/share/games/tyrian
	vcopy ${_dir}/*.snd usr/share/games/tyrian
	vcopy ${_dir}/demo.* usr/share/games/tyrian
	vcopy ${_dir}/music.mus usr/share/games/tyrian
	vcopy ${_dir}/tyrend.anm usr/share/games/tyrian
	vcopy ${_dir}/tshp2.pcx usr/share/games/tyrian
	vcopy ${_dir}/tyrian.cdt usr/share/games/tyrian
	vcopy ${_dir}/tyrian.hdt usr/share/games/tyrian
	vcopy ${_dir}/tyrian.pic usr/share/games/tyrian

	# manual
	cat <<- EOF > manual.txt
	******** This is the original manual of the DOS game. The install
	instructions are obsolete, while the story and gameplay instructions
	starting in section "V) THE STORY" may still be useful. ********

	EOF
	tr -d '\r' < "${_dir}/manual.doc" >> manual.txt
	vdoc manual.txt
}
