File PKGBUILD of Package scorched3d

# buildsys: automake, meson  KEEP on separate line!
buildsys='meson'
use_lua_ver='5.1'
gitref='core'



pkgname=scorched3d
pkgver=44.2
pkgrel=0
pkgdesc='Game based loosely on the classic DOS game Scorched Earth'
license=('GPL-2.0-or-later')
url="https://github.com/bberberov/${pkgname}"
arch=('i686' 'x86_64')

src_archive="${gitref}.tar.gz"
# src_archive="v${pkgver}.tar.gz"

source=(
	"${src_archive}"
	"${pkgname}.desktop"
)

sha256sums=(
	'SKIP'
	'SKIP'
)

makedepends=(
	${buildsys}
	gcc
	perl
	pkgconfig
)
depends=(
	sdl_net
	expat
	fftw
	freealut
	freetype2
	glew
	freeglut
	libjpeg-turbo

	lua51

	libogg
	openal
	libvorbis

	wxwidgets-gtk3

	xdg-utils

	zlib
)
# optdepends=()
# options=()



prepare() {
	if   [[ -n "${gitref}" ]]
	then
		cd "${pkgname}-${gitref}"
	else
		cd "${pkgname}-${pkgver}"
	fi

	if   [[ 'meson' == "${buildsys}" ]]
	then
		# Generate Makefile.am files first !!!
		cd scripts
		perl createAMMakefile.pl
		cd ..
	fi
}



build() {
	if   [[ -n "${gitref}" ]]
	then
		cd "${pkgname}-${gitref}"
	else
		cd "${pkgname}-${pkgver}"
	fi

	if   [[ 'meson' == "${buildsys}" ]]
	then
		meson setup --buildtype debugoptimized "builddir" && cd "builddir"

		meson compile

		cd ..
	else
		autoreconf -fiv

		./configure \
			--with-system-lua="lua-${use_lua_ver}" \
			--datadir="/usr/share/${pkgname}" \
			--with-docdir="/usr/share/doc/${pkgname}"

		make
	fi
}



package() {
	if   [[ -n "${gitref}" ]]
	then
		cd "${pkgname}-${gitref}"
	else
		cd "${pkgname}-${pkgver}"
	fi

	if   [[ 'meson' == "${buildsys}" ]]
	then
		cd "builddir"
		DESTDIR="${pkgdir}/" meson install
		cd ..
	else
		make DESTDIR="${pkgdir}/" install
	fi

	# Install .desktop file and icon
	install -D -m 0644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
	install -D -m 0644 data/images/tank2.png          "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
}
openSUSE Build Service is sponsored by