aboutsummaryrefslogtreecommitdiffstats
path: root/etc/profile.jogl
blob: 413c0538df79b0202ab63039e22021f4af2d0e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#! /bin/sh

function print_usage()
{
    echo "Usage: $0 {JOGL_ALL|JOGL_ALL_NOAWT|JOGL_ALL_MOBILE} [jogl-build-dir]"
}

function concat_jogl_list()
{
    ITEMDIR=$1
    shift
    for j in $ITEMDIR $ITEMDIR/jar ; do
        for i in $* ; do
            if [ -e $j/$i ] ; then 
                if [ -z "$JOGL_LIST" ] ; then
                    JOGL_LIST=$j/$i
                else
                    JOGL_LIST=$JOGL_LIST:$j/$i
                fi
            fi
        done
    done
    echo $JOGL_LIST
}

ARCH=`uname -m`
if [ "$ARCH" = "i86pc" ] ; then
    ARCH="x86"
fi

KERNEL=`uname -s | awk ' { printf "%s",tolower($0) ; } '`
if [ "$KERNEL" = "sunos" ] ; then
    KERNEL="solaris"
fi

uname -a | grep -i LINUX && OSS=x11
uname -a | grep -i Darwin && OSS=osx
uname -a | grep -i CYGWIN && OSS=win

JOGL_TEST="jogl-test.jar"

JOGL_JAR_ALL="jogl-all.jar"
JOGL_JAR_ALL_NOAWT="jogl-all-noawt.jar"
JOGL_JAR_ALL_MOBILE="jogl-all-mobile.jar"
JOGL_JAR_SWT="atomic/jogl-swt.jar"

JOGL_LIB_ALL="libnativewindow_x11.so libnativewindow_awt.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so"
JOGL_LIB_ALL_NOAWT="libnativewindow_x11.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so"
JOGL_LIB_ALL_MOBILE="libjogl_mobile.so libnewt.so"

export JOGL_JAR_ALL JOGL_JAR_ALL_NOAWT JOGL_JAR_ALL_MOBILE
export JOGL_LIB_ALL JOGL_LIB_ALL_NOAWT JOGL_LIB_ALL_MOBILE

THISDIR=`dirname $0`

JOGL_PROFILE="$1"
shift

if [ -z "$JOGL_PROFILE" ] ; then
    echo JOGL PROFILE missing
    print_usage
fi

JOGL_BUILD_DIR="$1"
shift

AUTOBUILD=0

if [ ! -z "$JOGL_BUILD_DIR" -a -e "$JOGL_BUILD_DIR" ] ; then
    AUTOBUILD=0
elif [ -e $THISDIR/jar ] ; then
    # Autobuild
    JOGL_BUILD_DIR=$THISDIR/jar
    AUTOBUILD=1
else
    echo invalid JOGL_BUILD_DIR $JOGL_BUILD_DIR and no AUTOBUILD
    print_usage
fi 
export JOGL_BUILD_DIR

JOGL_LIB_DIR=$JOGL_BUILD_DIR/lib
export JOGL_LIB_DIR

JOGL_ALL_AWT_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ALL $JOGL_TEST)
JOGL_ALL_NOAWT_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ALL_NOAWT $JOGL_TEST)
JOGL_MOBILE_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ALL_MOBILE $JOGL_TEST)
JOGL_SWT_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_SWT $JOGL_TEST)
export JOGL_ALL_AWT_CLASSPATH JOGL_ALL_NOAWT_CLASSPATH JOGL_MOBILE_CLASSPATH JOGL_SWT_CLASSPATH

if [ ! -z "$JOGL_PROFILE" ] ; then
    case "$JOGL_PROFILE" in
        JOGL_ALL)
            JOGL_CLASSPATH=$JOGL_ALL_AWT_CLASSPATH
            ;;
        JOGL_ALL_NOAWT)
            JOGL_CLASSPATH=$JOGL_ALL_NOAWT_CLASSPATH
            ;;
        JOGL_ALL_MOBILE)
            JOGL_CLASSPATH=$JOGL_MOBILE_CLASSPATH
            ;;
    esac
else
    JOGL_CLASSPATH=$JOGL_ALL_AWT_CLASSPATH
fi
export JOGL_CLASSPATH

if [ "$KERNEL" = "linux" ] ; then
    SWT_SUB="gtk"
elif [ "$KERNEL" = "solaris" ] ; then
    SWT_SUB="gtk"
elif [ "$KERNEL" = "darwin" ] ; then
    SWT_SUB="cocoa"
    KERNEL="macosx"
    ARCH="x86_64"
fi
if [ -z "$SWT_CLASSPATH" ] ; then
    SWT_CLASSPATH_0=$JOGL_BUILD_DIR/../make/lib/swt/$SWT_SUB-$KERNEL-$ARCH/swt-debug.jar
    SWT_CLASSPATH_1=$HOME/.java/swt.jar
    if [ ! -e "$SWT_CLASSPATH_0" ] ; then 
        echo Info: NO JOGL SWT $SWT_CLASSPATH_0
        if [ ! -e "$SWT_CLASSPATH_1" ] ; then 
            echo Info: NO Users SWT $SWT_CLASSPATH_1
        else
            export SWT_CLASSPATH=$SWT_CLASSPATH_1
            echo Info: Using Users SWT $SWT_CLASSPATH
        fi
    else
        export SWT_CLASSPATH=$SWT_CLASSPATH_0
        echo Info: Using JOGL SWT $SWT_CLASSPATH
    fi
    if [ ! -z "$SWT_CLASSPATH" ] ; then
        export SWT_CLASSPATH
    fi
fi

if [ -z "$JOGL_CLASSPATH" ] ; then
    print_usage
fi