-
Notifications
You must be signed in to change notification settings - Fork 9
/
buildFrameworks
executable file
·249 lines (226 loc) · 6.55 KB
/
buildFrameworks
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#! /bin/sh
# buildFrameworks
#----------------------------------------------------------------------------------------
# Script Name: buildFrameworks
#
# Edit Number: 000002
#
# Description: This file is a shell script which will cause the compilation of
# an XCode project in the current directory and install it with
# the intent of allowing for the debugging of that framework. In
# otherwords it does not compile for install, but rather compiles
# for debug using a defined configuration. By default that
# configuration is named RemoteUsers. After the framework
# has been compiled the script will copy it to the install location
# so that an application can be linked against it and debugged, AND
# so the debug code is not stripped.
#
# the configuration name and install location can be overridden
# using command line options. See usage for more information.
#
# Author Date Edit Description
# ------- --------- ------ ---------------------------------------------------
# Tom 7-20-2011 000002 Complete re-write and now takes command line options.
#----------------------------------------------------------------------------------------
CONFIG=Default
DEST="/"
SDIR='EOControl EOAccess EOInterface Adaptors'
ADAPTOR_TARGET=Oracle
MAKETOOL="xcodebuild"
usage()
{
echo
echo "Usage: buildFrameworks [-c <configname>]"
echo " This script will build EOControl, EOAccess and Adaptors frameworks"
echo " -c <configname>"
echo " The project config to use. By default this is Default."
echo " You can override this by specifying a different config name"
echo ""
echo "Example: buildFrameworks -c Development"
echo " This will build all the frameworks for debug and then"
echo " install the result to /Library/Frameworks"
echo
exit 1
}
warning()
{
echo "WARNING!: This script will install frameworks DIRECLTY into /Library/Frameworks"
echo " and into '/Library/Database Adaptors'. If you don't want that to"
echo " happen then quit NOW!"
echo ""
echo " Frameworks to be installed are:"
echo " EOControl"
echo " EOAccess"
echo " EOInterface"
echo " Database Adaptors (Bundles) are written to:"
echo " /Library/Database Adaptors"
echo ""
echo "Please Note: In order to create the Oracle Adaptor the Oracle libraries must"
echo " already be installed in /usr/local/lib"
}
echoPlan()
{
warning
echo
echo
echo "This is the plan:"
echo " Compile the project $F"
echo " Config = $CONFIG"
echo " Install location = $DEST"
echo " Database Adaptor = (You will be promted to choose)"
echo
echo
}
buildAdaptor()
{
sudo $MAKETOOL -configuration $CONFIG -target $ADAPTOR_TARGET clean install DSTROOT=$DEST
CSTAT=$?
if [ $CSTAT -eq 1 ]
then
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo !!! The Adaptor failed to compile !!!
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
exit 1
fi
}
chooseAdaptor()
{
FINISHED=0
while [ $FINISHED -lt 1 ]; do
echo ""
PS3="Choose a Database Adaptor to compile/install "
options=(
"Oracle"
"MySQL"
"SQLite"
"PostgreSQL"
"OpenBase"
"Done"
)
select option in "${options[@]}"; do
case "$REPLY" in
1)
ADAPTOR_TARGET=Oracle
buildAdaptor
break ;;
2)
ADAPTOR_TARGET=MySQL
buildAdaptor
break ;;
3)
ADAPTOR_TARGET=SQLite
buildAdaptor
break ;;
4)
ADAPTOR_TARGET=PostgreSQL
buildAdaptor
break ;;
5)
ADAPTOR_TARGET=OpenBase
buildAdaptor
break ;;
6)
FINISHED=1
break ;;
esac
done
done
}
sanityCheck()
{
if [ -r EOControl ]
then
OK=1
else
echo "No EOControl folder was found in the current directory, Make sure your current directory is the ajrdatabase directory."
exit 1
fi
}
# if an argument is a single character or a single character with a '-' prefix, then it is not good.
argTest()
{
if [ "`echo "$1" | grep ^-.$`" ]
then
echo "Invalid option argument specified."
usage
fi
if [ "`echo "$1" | grep ^.$`" ]
then
echo "Invalid option argument specified."
usage
fi
}
options()
{
while getopts 'c:d:' opt; do
case $opt in
c) CONFIG=$OPTARG
argTest $OPTARG;;
[?])
echo "Invalid option flag specified."
usage
;;
:)
echo "Option -${OPTARG} (source) was missing the argument of the source dir."
usage
;;
esac
done
# if we got this far we are okay!
echoPlan
}
buildProject()
{
s=$1
if [ ! -d $s ]
then
echo -------------------------------------------------------------------------
echo --- EXPECTED SOURCE DIRECTORY "$s" NOT FOUND
echo -------------------------------------------------------------------------
exit 1
fi
echo ' '
echo ----------------------------------------------------------------
echo `date`
echo $s
echo ----------------------------------------------------------------
cd $s
if [ "$s" = "Adaptors" ]
then
chooseAdaptor
else
sudo $MAKETOOL -configuration $CONFIG clean install DSTROOT=$DEST
CSTAT=$?
if [ $CSTAT -eq 1 ]
then
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo !!! The framework failed to compile !!!
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
exit 1
fi
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " The framework $Framework compiled"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
fi
cd ..
}
buildFrameworks()
{
# build normal Frameworks
for s in $SDIR
do
buildProject $s
done
echo ' '
echo ----------------------------------------------------------------
echo `date`
echo Build Complete
echo ----------------------------------------------------------------
}
main()
{
sanityCheck
options $*
buildFrameworks
}
main $*