Jogamp
Merge remote-tracking branch 'origin/master'
[jogl-demos.git] / setenv-jogl.sh
CommitLineData
41cd6c47
KR
1#! /bin/sh
2
dbf66ad9 3function print_usage() {
8dbb0954 4 echo "Usage: $0 {JOGL_ALL|JOGL_ALL_NOAWT|JOGL_ALL_MOBILE} [jogl-build-dir]"
dbf66ad9
SG
5}
6
41cd6c47 7if [ -z "$1" ] ; then
dbf66ad9
SG
8 echo JOGL PROFILE missing
9 print_usage
46584ac0 10 return
dbf66ad9 11fi
41cd6c47
KR
12
13JOGL_PROFILE=$1
14shift
15
dbf66ad9
SG
16JOGL_BUILDDIR=
17if [ ! -z "$1" ] ; then
18 JOGL_BUILDDIR=$1
19 shift
20fi
41cd6c47 21
41cd6c47 22THISDIR=`pwd`
dbf66ad9 23AUTOBUILD=0
41cd6c47 24
dbf66ad9
SG
25if [ -e "$JOGL_BUILDDIR" ] ; then
26 JOGL_DIR=$JOGL_BUILDDIR/..
27 JOGL_BUILDDIR_BASE=`basename $JOGL_BUILDDIR`
28else
29 AUTOBUILD=1
30 jpf=`find jogl/etc -name profile.jogl`
31 if [ -z "$jpf" ] ; then
32 jpf=`find . -name profile.jogl`
33 fi
34 if [ -z "$jpf" ] ; then
35 echo JOGL_DIR not found
36 echo JOGL_BUILDDIR $JOGL_BUILDDIR not exist or not given
37 print_usage
46584ac0 38 return
dbf66ad9
SG
39 fi
40 JOGL_DIR=`dirname $jpf`/..
41 JOGL_BUILDDIR=$JOGL_DIR/lib
42 JOGL_BUILDDIR_BASE="."
41cd6c47
KR
43fi
44
dbf66ad9 45if [ $AUTOBUILD -eq 0 ] ; then
e66c2c42 46 gpf=`find ../gluegen/make -name jogamp-env.xml`
dbf66ad9 47 if [ -z "$gpf" ] ; then
e66c2c42 48 gpf=`find .. -name jogamp-env.xml`
dbf66ad9
SG
49 fi
50 if [ -z "$gpf" ] ; then
51 echo GLUEGEN_BUILDDIR not found
52 print_usage
46584ac0 53 return
dbf66ad9
SG
54 fi
55 GLUEGEN_DIR=`dirname $gpf`/..
56 GLUEGEN_BUILDDIR=$GLUEGEN_DIR/$JOGL_BUILDDIR_BASE
46584ac0 57 if [ ! -e "$GLUEGEN_BUILDDIR" ] ; then
dbf66ad9
SG
58 echo GLUEGEN_BUILDDIR $GLUEGEN_BUILDDIR does not exist
59 print_usage
46584ac0 60 return
dbf66ad9
SG
61 fi
62 GLUEGEN_JAR=$GLUEGEN_BUILDDIR/gluegen-rt.jar
63 GLUEGEN_OS=$GLUEGEN_BUILDDIR/obj
46584ac0 64 JUNIT_JAR=$GLUEGEN_DIR/make/lib/junit-4.5.jar
dbf66ad9
SG
65else
66 GLUEGEN_BUILDDIR=$JOGL_BUILDDIR
67 GLUEGEN_JAR=$JOGL_BUILDDIR/gluegen-rt.jar
68 GLUEGEN_OS=$JOGL_BUILDDIR
46584ac0 69 JUNIT_JAR=$GLUEGEN_DIR/junit-4.5.jar
dbf66ad9 70fi
41cd6c47 71
4ff184fd
SG
72if [ -z "$ANT_PATH" ] ; then
73 ANT_JARS=
74else
75 ANT_JARS=$ANT_PATH/lib/ant.jar:$ANT_PATH/lib/ant-junit.jar
76fi
77
dbf66ad9 78DEMOS_BUILDDIR=$THISDIR/$JOGL_BUILDDIR_BASE
41cd6c47 79
dbf66ad9
SG
80echo JOGL AUTOBUILD: $AUTOBUILD
81echo GLUEGEN BUILDDIR: $GLUEGEN_BUILDDIR
82echo JOGL DIR: $JOGL_DIR
83echo JOGL BUILDDIR: $JOGL_BUILDDIR
84echo JOGL BUILDDIR BASE: $JOGL_BUILDDIR_BASE
85echo JOGL PROFILE: $JOGL_PROFILE
86echo DEMOS BUILDDIR: $DEMOS_BUILDDIR
41cd6c47 87
dbf66ad9
SG
88J2RE_HOME=$(which java)
89JAVA_HOME=$(which javac)
90CP_SEP=:
91
92. $JOGL_DIR/etc/profile.jogl $JOGL_PROFILE $JOGL_BUILDDIR
41cd6c47 93
b4b7d23f 94SWT_CLASSPATH=$HOME/.java/swt.jar
41cd6c47
KR
95LIB=$THISDIR/lib
96
4ff184fd 97CLASSPATH=.:$DEMOS_BUILDDIR/jogl-demos.jar:$DEMOS_BUILDDIR/jogl-demos-util.jar:$DEMOS_BUILDDIR/jogl-demos-data.jar:$GLUEGEN_JAR:$JOGL_CLASSPATH:$SWT_CLASSPATH:$JUNIT_JAR:$ANT_JARS
41cd6c47
KR
98for i in $LIB/*jar ; do
99 CLASSPATH=$CLASSPATH:$i
100done
101export CLASSPATH
e69b06ad
SG
102# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR
103# export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR
41cd6c47 104
dbf66ad9
SG
105echo CLASSPATH: $CLASSPATH
106echo
107echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true" for running demos without AWT, e.g. NEWT
19528b88 108echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true com.jogamp.newt.util.MainThread" for running demos with NEWT
dbf66ad9
SG
109
110PATH=$J2RE_HOME/bin:$JAVA_HOME/bin:$PATH
111export PATH
41cd6c47
KR
112
113
http://JogAmp.org git info: FAQ, tutorial and man pages.