#!/bin/sh

name="xrally"
title="XRally"
package="xrally"
version="1.1"
build="1"
noarch="n"
build_info="Standard build."

info="A clone of the Rally X arcade game."
desc="XRally is a linux clone of the classic Rally X arcade game. For
those who don't know, in Rally X you control a blue (good) car,
that has to collect yellow flags around a maze-like map, while
avoiding the red (bad) cars. In order to help himself, the blue
car can use clouds of smoke through the maze. If a enemy touch
any of these clouds, it stops for a while. The enemy cars can
also crash one with the other, what gives you some extra time."
category="games/arcade"
environment="x11"
contact="$name@packages.packware.gnu.pl"
vendor="The Packware Project"
vendor_id="pw"

requires=""
obsoletes=""
conflicts=""

docs_source="AUTHORS,ChangeLog,COPYING,INSTALL,README,TODO,xrally.lsm"
docs_cwd=""

strip_bin="y"
reset_own="y"
reset_dir="y"
reset_fil="y"
delete_cat="y"

# Don't remove the line below.
. /usr/src/tgz/lib/builder.defs

# Allow users to write to hiscore file.
change_own main usr/X11R6/share/xrally/hiscore.new root.games
change_mod main usr/X11R6/share/xrally/hiscore.new g+w
change_own main usr/X11R6/bin/xrally root.games
change_mod main usr/X11R6/bin/xrally g+s

add_source ftp://ftp.sf.net/pub/sourceforge/$name/$name-$version.tar.bz2 $name

rm -f $src1/maps/"Test Level"

configure_option --prefix=/usr/X11R6

install_option prefix=$pkg_main/usr/X11R6

# Don't remove the two lines below.
parent_package="$package"
write_info main

cd $src1

do_configure

# I don't know other way to force -O2 and turn off -g3.
sed "s}-O3}-O2}" Makefile | sed "s}-g3}}" > Makefile.new
cat Makefile.new > Makefile

do_make
do_install

# We don't want to erase existing hiscore file.
mv $pkg_main/usr/X11R6/share/xrally/hiscore $pkg_main/usr/X11R6/share/xrally/hiscore.new

make_docs

make_package main

clean_up
