#Maintainer: Christian Dersch <chrisdersch~at~googlemail~dot~com>

pkgname=openttd
pkgver=1.1.0
pkgrel=1cd
source=("http://binaries.openttd.org/releases/$pkgver/openttd-$pkgver-source.tar.xz")
url=http://www.openttd.org/
docs=("COPYING" "changelog.txt" "known-bugs.txt" "readme.txt")

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"openttd (free clone of the game TTD)"
"OpenTTD is an open source clone of the Microprose game Transport"
"Tycoon Deluxe, a popular game originally written by Chris Sawyer. It"
"attempts to mimic the original game as closely as possible while"
"extending it with new features."
"NOTE: This package doesn't contain the original data files of TTD"
"which are not free. Beginning with OpenTTD 1.0.0 there are free"
"replacements for graphics, sounds and music. They are provided by the"
"packages openttd-opengfx, openttd-openmsx and openttd-opensfx."
"http://www.openttd.org/"
)

doinst() {
	#update the mime desktop database
	if [ -x usr/bin/update-desktop-database ]; then
		usr/bin/update-desktop-database -q
	fi
	# update the mime database
	if [ -x usr/bin/update-mime-database ]; then
		usr/bin/update-mime-database usr/share/mime > /dev/null 2>&1
	fi
}

build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix-dir=/usr \
		--binary-dir=/games \
		--data-dir=/share/games/openttd \
		--icon-dir=/share/pixmaps \
		--man-dir=/man/man6 \
		--doc-dir=/doc/$pkgname-$pkgver \
		--personal-dir=.openttd \
		--install-dir=$startdir/pkg || return 1
	make || return 1
	make install DEST_DIR=$startdir/pkg
}