forked from tdmartin102/ajrdatabase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildFrameworks
executable file
·246 lines (219 loc) · 6.85 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
#! /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=NONE
SDIR='EOControl EOAccess Adaptors'
ADAPTOR_TARGET=Oracle
BUNDLE=eoadaptor
usage()
{
echo
echo "Usage: buildFrameworks [-c <configname>] [-d <installdest>]"
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 " -d <installdest>"
echo " The install location for the compiled framework. If you specify"
echo " something here the compiled frameworks will be copied to the"
echo " specified location. This makes compiling for debug and then"
echo " installing the frameworks so that they can easily be debuged"
echo " without striping the debug code much easier."
echo ""
echo "Example: buildFrameworks -c Development -d /Library/Frameworks"
echo " This will build all the frameworks for debug and then"
echo " copy the result to /Library/Frameworks"
echo
exit 1
}
echoPlan()
{
echo
echo
echo "This is the plan:"
echo " Compile the project $F"
echo " Config = $CONFIG"
echo " Install location = $DEST"
echo
echo
}
sanityCheck()
{
#--- capture the OS version here
MajorVersion=`sw_vers | grep ProductVersion | awk '{ print $2 }' | sed 's/\.//'`
Tiger="104"
MajorVersion=`echo $MajorVersion | sed 's/\..*//'`
# Use Project Builder if older than Tiger, us xcode if tiger or above.
if [ $MajorVersion -ge $Tiger ]
then
MAKETOOL="xcodebuild"
else
echo This will only work with XCode on Tiger and above
exit 1
fi
projExt="xcodeproj"
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
d) DEST=$OPTARG
argTest $DEST;;
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
# catch errors
if [ "$DEST" != "NONE" ]
then
if [ ! -d "$DEST" ]
then
echo "specified install directory not found."
usage
fi
fi
# 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
sudo $MAKETOOL -configuration $CONFIG -target $ADAPTOR_TARGET clean
$MAKETOOL -configuration $CONFIG -target $ADAPTOR_TARGET
CSTAT=$?
if [ $CSTAT -eq 1 ]
then
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo !!! The Adaptor failed to compile !!!
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
exit 1
fi
if [ -d "build/${CONFIG}/${ADAPTOR_TARGET}.${BUNDLE}" ]; then
echo "Found Adaptor product"
else
echo "Can not find the compiled Adaptor, exiting"
exit 1
fi
if [ "$DEST" != "NONE" ]
then
# remove currently installed Adaptor
sudo rm -fR "/Library/Database Adaptors/${ADAPTOR_TARGET}.${BUNDLE}"
# copy compiled framework to install location
sudo ditto build/${CONFIG}/${ADAPTOR_TARGET}.${BUNDLE} "/Library/Database Adaptors/${ADAPTOR_TARGET}.${BUNDLE}"
fi
else
sudo $MAKETOOL -configuration $CONFIG clean
$MAKETOOL -configuration $CONFIG
CSTAT=$?
if [ $CSTAT -eq 1 ]
then
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo !!! The framework failed to compile !!!
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
exit 1
fi
if [ -d "build/${CONFIG}/${s}.framework" ]; then
Framework=${s}.framework
else
echo "Can not find the compiled framework, exiting"
exit 1
fi
if [ "$DEST" != "NONE" ]
then
# remove currently instlled framework
sudo rm -fR ${DEST}/${Framework}
# copy compiled framework to install location
sudo ditto build/${CONFIG}/${Framework} ${DEST}/${Framework}
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 $*