#! /bin/sh
# $Id: mkl4j,v 1.3.8.1 2008/02/06 03:33:44 cxh Exp $
# Create a Launch4j (http://launch4j.sourceforge.net/) configuration file
# 
ROOT=.
base=vergil
cmdLine=""
icon=$ROOT/doc/img/ptIIplanet.ico
mainClass=ptolemy.vergil.VergilApplication
fileVersion=6.0.0.1
PTVERSION=6.0-devel

if [ $# -gt 0 ]; then
   base=$1
   shift
fi

if [ $# -gt 0 ]; then
   mainClass=$1
   shift
fi

if [ $# -gt 0 ]; then
   icon=$1
   shift
fi

if [ $# -gt 0 ]; then
   cmdLine=$1
   shift
fi

if [ $# -eq 0 ]; then
   classPath="<cp>$ROOT</cp>"
else
   # Collect up remaining arguments as classpath
   while test $# -gt 0; do
       if [ ! -f $1 ]; then
	   echo "$0: warning: $1 does not exist" 1>&2
	   exit 2
       fi	   
       classPath="$classPath <cp>$1</cp>"
       shift
   done
fi
cat <<EOF
<launch4jConfig>
  <headerType>gui</headerType>
  <dontWrapJar>true</dontWrapJar>
  <jar></jar>
  <outfile>${base}.exe</outfile>
  <errTitle>${base}</errTitle>
  <chdir>.</chdir>
  <cmdLine>${cmdLine}</cmdLine>
  <customProcName>true</customProcName>
  <stayAlive>true</stayAlive>
  <icon>${icon}</icon>
  <jre>
    <minVersion>1.4.0</minVersion>
    <maxHeapSize>512</maxHeapSize>
    <path>jre</path>
  </jre>
  <classPath>
    <mainClass>${mainClass}</mainClass>
    $classPath
  </classPath>
  <versionInfo>
    <fileVersion>${fileVersion}</fileVersion>
    <txtFileVersion>${PTVERSION}</txtFileVersion>
    <fileDescription>Ptolemy II Application</fileDescription>
    <copyright>Copyright (c) 1995-2008 The Regents of the University of California. All rights reserved. http://ptolemy.eecs.berkeley.edu/copyright.htm</copyright>
    <productVersion>${fileVersion}</productVersion>
    <txtProductVersion>${PTVERSION}</txtProductVersion>
    <productName>Ptolemy II</productName>
    <companyName>Ptolemy Project, University of California, Berkeley</companyName>
    <internalName>${base}</internalName>
    <originalFilename>${base}.exe</originalFilename>
  </versionInfo>
</launch4jConfig>
EOF
