#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

IS_FREMANTLE=$(shell if grep Fremantle /etc/maemo_version &> /dev/null; then echo y; else echo n; fi)

DEB_OPT_FLAG:=-O2
#DEB_SOURCE_PACKAGE:=maelstrom
DEB_TAR_SRCDIR:=Maelstrom-3.0.6.6
ifeq ($(IS_FREMANTLE),y)
DEB_CONFIGURE_NORMAL_ARGS:=--prefix=/opt/maelstrom --datarootdir=/usr/share
DEB_CONFIGURE_EXTRA_FLAGS:=--enable-maemo
else
DEB_CONFIGURE_EXTRA_FLAGS:=--enable-maemo
endif
#DEB_AUTO_UPDATE_AUTOCONF=2.59
#DEB_AUTO_UPDATE_AUTOMAKE=1.8

include /usr/share/cdbs/1/rules/tarball.mk

install/maelstrom::
	echo "*** Fixing up things for maemo"
	install -d -m 755 debian/maelstrom/usr/bin/
	install -m 755 Maelstrom.sh debian/maelstrom/usr/bin/Maelstrom
	strip -g debian/maelstrom/opt/maelstrom/bin/Maelstrom
	chmod 666 debian/maelstrom/opt/maelstrom/data/Maelstrom-Scores

