#!/bin/sh
#
# $Id$
#
WINGS_VSN="%WINGS_VSN%"
INSTALL_DIR="$HOME/wings-$WINGS_VSN"

echo "Installing Wings 3D $WINGS_VSN in $INSTALL_DIR"
mkdir -p $INSTALL_DIR
tar cf - * | (cd $INSTALL_DIR; tar xf -)
rm -f $INSTALL_DIR/install_wings

sed <<'EOF' -e "s^%ROOTDIR%^$INSTALL_DIR^" > $INSTALL_DIR/wings
#!/bin/sh
ROOTDIR=%ROOTDIR%
BINDIR=$ROOTDIR/bin
EMU=beam
PROGNAME=`echo $0 | sed 's/.*\///'`
export EMU
export ROOTDIR
export BINDIR
export PROGNAME
exec $BINDIR/erlexec -noinput -smp -run wings_start start_halt ${1+"$@"}
EOF

chmod +x $INSTALL_DIR/wings

sed <<'EOF' -e "s^%ROOTDIR%^$INSTALL_DIR^" > $INSTALL_DIR/wings.desktop
[Desktop Entry]
Version=$WINGS_VSN$
Type=Application
Terminal=false
Exec=%ROOTDIR%/wings
Name=Wings 3D
GenericName[en]=A 3D Subdivision Modeler
Comment[en]=A 3D modeler that is both powerful and easy to use
Icon=%ROOTDIR%/lib/wings-%WINGS_VSN%/ebin/wings_icon_379x379.png
EOF

chmod +x $INSTALL_DIR/wings.desktop

exit 0;
