#!/bin/sh
# Quick hack to allow people try everything without installing
#
#   Copyright (C) 2000 Free Software Foundation, Inc.
#
#   Author:  Nicola Pero <n.pero@mi.flashnet.it>
#   Date: July 2000, September 2000
#   
#   This file is part of GNUstep.
#   
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#   
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */

#
# WARNING: If you want to use the debug version, wipe out the not-debug
# version first.  This is peculiar to this little hack.
#

# Path to the wrapping library classes
export CLASSPATH=./:../WrappingLibrary/Java/:$CLASSPATH

# Load the LD_LIBRARY_PATH for GNUstep stuff
. $GNUSTEP_MAKEFILES/ld_lib_path.sh

# Quick hack at a suffix
nodebug_suffix=shared_obj/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gnu-gnu-gnu-xgps/
debug_suffix=shared_debug_obj/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gnu-gnu-gnu-xgps/

suffix=

# If it doesn't work, try with xdps
if [ -d ../Library/$nodebug_suffix ]; then
  suffix=$nodebug_suffix # OK
else
  if [ -d ../Library/$debug_suffix ]; then
    suffix=$debug_suffix # OK
  else
    nodebug_suffix=shared_obj/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gnu-gnu-gnu-xdps/
    debug_suffix=shared_debug_obj/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gnu-gnu-gnu-xdps/
    if [ -d ../Library/$nodebug_suffix ]; then
      suffix=$nodebug_suffix # OK
    else
      if [ -d ../Library/$debug_suffix ]; then
        suffix=$debug_suffix # OK
      else
        echo "Sorry, I am confused."
	echo "Make sure you have run \"make\" in the top level directory."
	echo "Otherwise it could be my fault - I am just a quick hack:"
	echo "would you please try the full installation then ?"
	echo "(see the top level README)"
	echo "Thanks."
	exit
      fi
    fi
  fi
fi

# Path to SimpleGUI.A.so (or SimpleGUI.A_d.so), the wrapping library
LD_LIBRARY_PATH=../WrappingLibrary/Objc/$suffix:$LD_LIBRARY_PATH
# Path to SimpleGUI.so (or SimpleGUI_d.so), the real library
LD_LIBRARY_PATH=../Library/$suffix:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH

java SimpleApp


