74
74
# to be built. It's VERS but only up to the second '.' (if there is one).
75
75
MAJ_VERS=` echo $VERS | sed ' s/\([0-9]*\.[0-9]*\)[.-].*/\1/' `
76
76
77
- # APPLE LOCAL begin ARM ARM_CONFIGFLAGS
78
- # For ARM, grab all system files from an SDK.
79
- ARM_SYSROOT=" /Developer/SDKs/Extra"
80
- ARM_LIBSTDCXX_VERSION=4.2.1
81
- ARM_CONFIGFLAGS=" --with-sysroot=\" $ARM_SYSROOT \" \
82
- --with-gxx-include-dir=\$ {prefix}/include/c++/$ARM_LIBSTDCXX_VERSION "
83
- # APPLE LOCAL end ARM ARM_CONFIGFLAGS
84
-
85
77
# This is the libstdc++ version to use.
86
78
LIBSTDCXX_VERSION=4.2.1
87
79
if [ ! -d " $DEST_ROOT /include/c++/$LIBSTDCXX_VERSION " ]; then
@@ -92,6 +84,60 @@ NON_ARM_CONFIGFLAGS="--with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VE
92
84
DARWIN_VERS=` uname -r | sed ' s/\..*//' `
93
85
echo DARWIN_VERS = $DARWIN_VERS
94
86
87
+ # APPLE LOCAL begin ARM
88
+ ARM_LIBSTDCXX_VERSION=4.2.1
89
+ ARM_CONFIGFLAGS=" --with-gxx-include-dir=/usr/include/c++/$ARM_LIBSTDCXX_VERSION "
90
+
91
+ ARM_PLATFORM=/Developer/Platforms/iPhoneOS.platform
92
+ ARM_IPHONE_SDK=iPhoneOS${IPHONEOS_DEPLOYMENT_TARGET} .Internal.sdk
93
+ ARM_EXTRA_SDK=/Developer/SDKs/Extra
94
+
95
+ # Check if the build system is running Leopard or earlier. If the Legacy PDK
96
+ # is not installed, the toolchain in / will not support ARM. Use the iPhone
97
+ # platform directory instead.
98
+ # ALQAAHIRA LOCAL do not use default tools without the Legacy PDK
99
+ if [ $DARWIN_VERS -le 999 -a ! -d $ARM_EXTRA_SDK ]; then
100
+ ARM_TOOLROOT=$ARM_PLATFORM
101
+ else
102
+ ARM_TOOLROOT=/
103
+ fi
104
+
105
+ # ARM may require a sysroot option.
106
+ ARM_SYSROOT=$ARM_EXTRA_SDK
107
+ # If the default sysroot does not exist, try a different location.
108
+ if [ ! -d $ARM_SYSROOT ]; then
109
+ ARM_SYSROOT=$ARM_PLATFORM /Developer/SDKs/$ARM_IPHONE_SDK
110
+ fi
111
+
112
+ # ALQAAHIRA LOCAL use --with-sysroot regardless of the MacOS version
113
+ # # Split the MACOSX_DEPLOYMENT_TARGET into major/minor versions.
114
+ # if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then
115
+ # # Anything 10.5 or earlier is treated the same below.
116
+ # MACOSX_DEPLOYMENT_MAJOR=10
117
+ # MACOSX_DEPLOYMENT_MINOR=5
118
+ # else
119
+ # MACOSX_DEPLOYMENT_MAJOR=`echo $MACOSX_DEPLOYMENT_TARGET | sed 's/\..*//'`
120
+ # MACOSX_DEPLOYMENT_MINOR=`echo $MACOSX_DEPLOYMENT_TARGET | sed 's/[0-9]*\.\([0-9]*\).*/\1/'`
121
+ # fi
122
+ if true ; then
123
+ ARM_CONFIGFLAGS=" $ARM_CONFIGFLAGS --with-sysroot=\" $ARM_SYSROOT \" "
124
+ else
125
+ ARM_SYSROOT=/
126
+ fi
127
+
128
+ # If building an ARM target, check that the required directories exist.
129
+ if echo $TARGETS | grep arm; then
130
+ if [ ! -d $ARM_SYSROOT ]; then
131
+ echo " Error: cannot find ARM SDK to build ARM target"
132
+ exit 1
133
+ fi
134
+ if [ ! -d $ARM_TOOLROOT ]; then
135
+ echo " Error: $ARM_TOOLROOT directory is not installed"
136
+ exit 1
137
+ fi
138
+ fi
139
+ # APPLE LOCAL end ARM
140
+
95
141
# If the user has CC set in their environment unset it now
96
142
unset CC
97
143
@@ -171,18 +217,34 @@ mkdir $DIR/bin || exit 1
171
217
for prog in ar nm ranlib strip lipo ld ; do
172
218
for t in ` echo $TARGETS $HOSTS | sort -u` ; do
173
219
P=$DIR /bin/${t} -apple-darwin$DARWIN_VERS -${prog}
220
+ # APPLE LOCAL begin toolroot
221
+ if [ $t = " arm" ]; then
222
+ toolroot=$ARM_TOOLROOT
223
+ else
224
+ toolroot=
225
+ fi
226
+ # APPLE LOCAL end toolroot
174
227
echo ' #!/bin/sh' > $P || exit 1
175
- echo ' exec /usr/bin/' ${prog} ' "$@"' >> $P || exit 1
228
+ # APPLE LOCAL insert toolroot below
229
+ echo ' exec ' ${toolroot} ' /usr/bin/' ${prog} ' "$@"' >> $P || exit 1
176
230
chmod a+x $P || exit 1
177
231
done
178
232
done
179
233
for t in ` echo $1 $2 | sort -u` ; do
180
234
gt=` echo $t | $TRANSLATE_ARCH `
181
235
P=$DIR /bin/${gt} -apple-darwin$DARWIN_VERS -as
236
+ # APPLE LOCAL begin toolroot
237
+ if [ $gt = " arm" ]; then
238
+ toolroot=$ARM_TOOLROOT
239
+ else
240
+ toolroot=
241
+ fi
242
+ # APPLE LOCAL end toolroot
182
243
echo ' #!/bin/sh' > $P || exit 1
183
244
184
- echo ' for a; do case $a in -arch) exec /usr/bin/as "$@";; esac; done' >> $P || exit 1
185
- echo ' exec /usr/bin/as -arch ' ${t} ' "$@"' >> $P || exit 1
245
+ # APPLE LOCAL insert toolroot below
246
+ echo ' for a; do case $a in -arch) exec ' ${toolroot} ' /usr/bin/as "$@";; esac; done' >> $P || exit 1
247
+ echo ' exec ' ${toolroot} ' /usr/bin/as -arch ' ${t} ' "$@"' >> $P || exit 1
186
248
chmod a+x $P || exit 1
187
249
done
188
250
PATH=$DIR /bin:$PATH
0 commit comments