# Template file for 'neverball'
pkgname=neverball
version=1.5.4
revision=3
distfiles="http://www.neverball.org/$pkgname-$version.tar.gz"
build_style=custom-install
short_desc="Puzzle/action game similar to Super Monkey Ball"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=ea31ca9f6eec70c8e66eaa20d7ce9e48295fdb077313b97637c503b16b7b0da6
long_desc="
 Tilt the floor to roll a ball through an obstacle course before time runs
 out. Neverball is part puzzle game, part action game, and entirely a
 test of skill.

 Also found here is Neverputt, a hot-seat multiplayer miniature golf game
 using the physics and graphics of Neverball."

Add_dependency run glibc
Add_dependency run libpng
Add_dependency run jpeg
Add_dependency run libvorbis
Add_dependency run SDL
Add_dependency run SDL_ttf
Add_dependency run physfs
Add_dependency run libX11
Add_dependency run MesaLib
Add_dependency build libpng-devel
Add_dependency build jpeg-devel
Add_dependency build libvorbis-devel
Add_dependency build libX11-devel
Add_dependency build SDL-devel
Add_dependency build SDL_ttf-devel
Add_dependency build physfs-devel
Add_dependency build MesaLib-devel
Add_dependency full desktop-file-utils

do_build()
{
	cd ${wrksrc} || return 1
	HOME=/ make ${makejobs} ENABLE_NLS=1 DATADIR=/usr/share/neverball \
		LOCALEDIR=/usr/share/locale || return 1
}

do_install()
{
	cd ${wrksrc} || return 1

	for dir in usr/bin usr/share/neverball usr/share/locale \
		usr/share/applications usr/share/pixmaps \
		usr/share/doc/neverball; do
		install -d ${DESTDIR}/${dir} || return 1
	done

	for f in neverball neverputt mapc; do
		install -m755 ${f} ${DESTDIR}/usr/bin || return 1
	done

	cp -a data/* ${DESTDIR}/usr/share/neverball || return 1
	find ${DESTDIR}/usr/share/neverball -type f -exec chmod 0644 {} \;
	cp -a locale/* ${DESTDIR}/usr/share/locale || return 1

	install -m644 dist/*.desktop ${DESTDIR}/usr/share/applications \
		 || return 1
	install -m644 dist/*.png ${DESTDIR}/usr/share/pixmaps || return 1
	ln -s neverball_48.png ${DESTDIR}/usr/share/pixmaps/neverball.png \
		 || return 1
	ln -s neverputt_48.png ${DESTDIR}/usr/share/pixmaps/neverputt.png \
		 || return 1

	install -m644 doc/* ${DESTDIR}/usr/share/doc/neverball || return 1
	install -D -m644 dist/mapc.1 ${DESTDIR}/usr/share/man/man1/mapc.1 \
		 || return 1
	install -d ${DESTDIR}/usr/share/man/man6 || return 1
	install -m644 dist/*.6 ${DESTDIR}/usr/share/man/man6 || return 1
}
