#!/bin/sh
#
# Copyright 2005 Zach Borgerding <zborgerd@gmail.com>
# Available under the terms of the GNU GPL.
#

NAME="sportstracker"
VERSION="1.0.1"
REVISION="1"

PKG_PATCH[0]='Makefile.patch'
PKG_PATCH[1]='SportsTracker.Gui.Dialogs.About.Dialog.patch'
PKG_PATCH[2]='sportstracker'
PKG_PATCH[3]='sportstracker.desktop'

PKG_SOURCEURL='http://switch.dl.sourceforge.net/sourceforge/sportstracker/SportsTracker-$VERSION.tar.gz'

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

cflags
prepare
analyzesource
#configure
applypatch 0 1
applypatch 1 1
make
makeinstall

# fixing this menu madness
spewdo "mkdir -p $PKG_STAGEROOT$PKG_PREFIX/share/applications"
findpatch filename sportstracker.desktop
spewdo "cp $filename $PKG_STAGEROOT$PKG_PREFIX/share/applications/sportstracker.desktop"

# adding a real "executable" to fix this mono madness
findpatch filename sportstracker
spewdo "cp $filename $PKG_STAGEROOT$PKG_PREFIX/bin/sportstracker"
spewdo "chmod a+x $PKG_STAGEROOT$PKG_PREFIX/bin/sportstracker"

# moving the exe to a more sane place
spewdo "mkdir -p $PKG_STAGEROOT$PKG_PREFIX/lib/sportstracker"
spewdo "mv $PKG_STAGEROOT$PKG_PREFIX/bin/SportsTracker.exe $PKG_STAGEROOT$PKG_PREFIX/lib/sportstracker/SportsTracker.exe"

# moving the DLL to a more sane place
spewdo "mv $PKG_STAGEROOT$PKG_PREFIX/bin/NPlot.dll $PKG_STAGEROOT$PKG_PREFIX/lib/sportstracker/NPlot.dll"

# copying the icon to a usable place for menus
spewdo "mkdir -p $PKG_STAGEROOT$PKG_PREFIX/share/pixmaps"
spewdo "cp $PKG_SRCROOT/resource/icons/st-logo.png $PKG_STAGEROOT$PKG_PREFIX/share/pixmaps/st-logo.png"

tidydocumentation
analyzebinaries
finalizepackage
packagize
cleanup
