Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 084b8cd86cf2f3bf5753e602a88cdd22e530d1e2 (plain) (blame)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/sh
#*******************************************************************************
# Copyright (c) 2000, 2008 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at 
# http://www.eclipse.org/legal/epl-v10.html
# 
# Contributors:
#     IBM Corporation - initial API and implementation
#     Kevin Cornell (Rational Software Corporation)
#     Sumit Sarkar (Hewlett-Packard)
# Martin Oberhuber (Wind River) - [185734] Support building with gcc and debug
#*******************************************************************************
#
# Usage: sh build.sh [<optional switches>] [clean]
#
#   where the optional switches are:
#       -output <PROGRAM_OUTPUT>  - executable filename ("eclipse")
#       -os     <DEFAULT_OS>      - default Eclipse "-os" value
#       -arch   <DEFAULT_OS_ARCH> - default Eclipse "-arch" value
#       -ws     <DEFAULT_WS>      - default Eclipse "-ws" value
#		-java   <JAVA_HOME>		  - java insgtall for jni headers
#
#   All other arguments are directly passed to the "make" program.
#   This script can also be invoked with the "clean" argument.
#
#   Examples:
#   sh build.sh clean
#   sh build.sh -java /usr/j2se OPTFLAG=-g PICFLAG=-fpic

cd `dirname $0`

# Define default values for environment variables used in the makefiles.
programOutput="eclipse"
defaultOS=""
defaultOSArch=""
defaultWS="motif"
defaultJava=DEFAULT_JAVA_JNI
makefile=""
javaHome=""
outputRoot="../../bin"
if [ "$OS" = "" ];  then
    OS=`uname -s`
fi
if [ "$MODEL" = "" ];  then
    MODEL=`uname -m`
fi

case $OS in
	"AIX")
		makefile="make_aix.mak"
		defaultOS="aix"
		defaultOSArch="ppc"
		defaultWS="motif"
		MOTIF_HOME=/usr
		OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
		;;
	"Linux")
		makefile="make_linux.mak"
		defaultOS="linux"
		defaultOSArch="x86"
		defaultWS="motif"
		X11_HOME=/usr/X11R6
		MOTIF_HOME=~/motif21
		OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
		;;
	"SunOS")
#		PATH=/usr/ccs/bin:/opt/SUNWspro/bin:$PATH
		PATH=/usr/ccs/bin:/export/home/SUNWspro/bin:$PATH
		javaHome="/usr/jdk/jdk1.5.0_01"
		outputRoot="../../contributed"
		export PATH
		makefile="make_solaris.mak"
		defaultOS="solaris"
		defaultOSArch="sparc"
		defaultWS="motif"
		OS="Solaris"
		X11_HOME=/usr/openwin
		MOTIF_HOME=/usr/dt
		OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
		;;
	"HP-UX")
		X11_HOME=/usr
		MOTIF_HOME=/usr
		case $MODEL in
			"ia64")
				makefile="make_hpux_ia64_32.mak"
				defaultOS="hpux"
				defaultOSArch="ia64_32"
				defaultWS="motif"
				OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
				javaHome="/opt/java1.5"
				defaultJava=DEFAULT_JAVA_EXEC
				;;
        	*)
				makefile="make_hpux_PA_RISC.mak"
				defaultOS="hpux"
				defaultOSArch="PA_RISC"
				defaultWS="motif"
				OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
				;;
		esac
        ;;
	*)
		echo "Unknown OS -- build aborted"
		;;
esac

# Parse the command line arguments and override the default values.
extraArgs=""
while [ "$1" != "" ]; do
    if [ "$1" = "-os" ] && [ "$2" != "" ]; then
        defaultOS="$2"
        shift
    elif [ "$1" = "-arch" ] && [ "$2" != "" ]; then
        defaultOSArch="$2"
        shift
    elif [ "$1" = "-ws" ] && [ "$2" != "" ]; then
        defaultWS="$2"
        shift
    elif [ "$1" = "-output" ] && [ "$2" != "" ]; then
        programOutput="$2"
        shift
	elif [ "$1" = "-java" ] && [ "$2" != "" ]; then
        javaHome="$2"
        shift
    else
        extraArgs="$extraArgs $1"
    fi
    shift
done

# Set up environment variables needed by the makefiles.
PROGRAM_OUTPUT="$programOutput"
DEFAULT_OS="$defaultOS"
DEFAULT_OS_ARCH="$defaultOSArch"
DEFAULT_WS="$defaultWS"
JAVA_HOME=$javaHome
DEFAULT_JAVA=$defaultJava

LIBRARY_DIR="../../../org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.$defaultWS.$defaultOS.$defaultOSArch"
OUTPUT_DIR="$outputRoot/$defaultWS/$defaultOS/$defaultOSArch"

export OUTPUT_DIR PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS X11_HOME MOTIF_HOME JAVA_HOME DEFAULT_JAVA LIBRARY_DIR

# If the OS is supported (a makefile exists)
if [ "$makefile" != "" ]; then
	if [ "$extraArgs" != "" ]; then
		make -f $makefile $extraArgs
	else
		echo "Building $OS launcher. Defaults: -os $DEFAULT_OS -arch $DEFAULT_OS_ARCH -ws $DEFAULT_WS"
		make -f $makefile clean
		case x$CC in
		  x*gcc*) make -f $makefile all PICFLAG=-fpic ;;
		  *)      make -f $makefile all ;;
		esac
	fi
else
	echo "Unknown OS ($OS) -- build aborted"
fi

Back to the top