#Packager: Maximus (maximuus[at]gmail[dot]com)

pkgname=FlightGear
pkgver=2.0.0
pkgrel=2mb
source=(http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/Source/$pkgname-$pkgver.tar.gz)
sourcetemplate=http://people.salixos.org/maximus/$pkgname/$pkgver/
docs=("readme" "readme.openal" "readme.osg" "readme.plib" "readme.simgear" "install" "copying" "changelog" "authors" "news" "thanks")
url=http://www.flightgear.org/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"FlightGear (an open-source, multi-platform flight simulator)"
"The goal of the FlightGear project is to create a sophisticated"
"flight simulator framework for use in research or academic"
"environments, for the development and pursuit of other interesting"
"flight simulation ideas, and as an end-user application."
)

build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure \
	--prefix=/usr \
	--libdir=/usr/lib${LIBDIRSUFFIX} \
	--localstatedir=/var \
	--sysconfdir=/etc	
	make || return 1
	make install DESTDIR=$startdir/pkg
	
	#make desktop file
	mkdir -p $startdir/pkg/usr/share/applications
	cat > $startdir/pkg/usr/share/applications/$pkgname.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=FlightGear
Comment=Flight Simulator
Exec=fgfs
Terminal=false
Type=Application
Categories=Game;Simulation;
Icon=FlightGear
EOF
	
	#make and copy icon
	convert ./projects/VC90/flightgear${LIBDIRSUFFIX}.ico flightgear.png
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	cp flightgear.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/FlightGear.png
	
}