2010-05-12 10:59:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if test "$*" = "--help" -o "$*" = "-h"; then
|
2010-05-13 00:04:51 +00:00
|
|
|
echo "configure-iphone [IPHONESDK=name_path] [OPTIONS]"
|
2010-05-12 10:59:20 +00:00
|
|
|
echo ""
|
2010-05-13 00:04:51 +00:00
|
|
|
echo "IPHONESDK=name_path Choose which SDK to use. Value can be SDK name"
|
|
|
|
echo " (e.g. iPhoneOS2.2.1.sdk) or the full path of"
|
|
|
|
echo " the SDK"
|
|
|
|
echo "OPTIONS Other options that will be passed directly to"
|
|
|
|
echo " ./aconfigure script. Run ./aconfigure --help"
|
|
|
|
echo " for more info."
|
2010-05-12 10:59:20 +00:00
|
|
|
echo ""
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
F="configure-iphone"
|
|
|
|
|
|
|
|
# Set the main iPhone developer directory, if not set
|
|
|
|
if test "x${DEVPATH}" = "x"; then
|
|
|
|
DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure $DEVPATH directory exist
|
|
|
|
if test ! -d $DEVPATH; then
|
|
|
|
echo "$F error: directory $DEVPATH does not exist. Please install iPhone development kit"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Choose SDK version to use
|
2010-05-13 00:04:51 +00:00
|
|
|
if test "$IPHONESDK" = ""; then
|
|
|
|
# If IPHONESDK is not set, use the latest one
|
2010-05-12 10:59:20 +00:00
|
|
|
for f in `ls $DEVPATH/SDKs/`; do echo $f | sed 's/\(.sdk\)//'; done | sort | tail -1 > tmpsdkname
|
2010-05-13 00:04:51 +00:00
|
|
|
IPHONESDK=`cat tmpsdkname`.sdk
|
2010-05-12 10:59:20 +00:00
|
|
|
rm -f tmpsdkname
|
2010-05-13 00:04:51 +00:00
|
|
|
SDKPATH=${DEVPATH}/SDKs/${IPHONESDK}
|
|
|
|
elif test -d ${IPHONESDK}; then
|
|
|
|
# .. else if IPHONESDK is set and it points to a valid path, just use it
|
|
|
|
SDKPATH=${IPHONESDK}
|
2010-05-12 10:59:20 +00:00
|
|
|
else
|
|
|
|
# .. else assume the SDK name is used.
|
2010-05-13 00:04:51 +00:00
|
|
|
SDKPATH=${DEVPATH}/SDKs/${IPHONESDK}
|
2010-05-12 10:59:20 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Test the SDK directory
|
|
|
|
if test ! -d ${SDKPATH}/usr/include; then
|
|
|
|
echo "$F error: unable to find valid iPhone SDK in ${SDKPATH}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-05-13 00:04:51 +00:00
|
|
|
# Default CFLAGS if it's not specified
|
|
|
|
if test "$CFLAGS" = ""; then
|
|
|
|
CFLAGS="-O2 -Wno-unused-label"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Default LDFLAGS if it's not specified
|
|
|
|
if test "$LDFLAGS" = ""; then
|
|
|
|
LDFLAGS="-O2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Settings to feed to configure script. Binaries should have the
|
|
|
|
# full path as it's not normally in user's PATH
|
|
|
|
export CC="${DEVPATH}/usr/bin/arm-apple-darwin9-gcc"
|
|
|
|
export CXX="${DEVPATH}/usr/bin/arm-apple-darwin9-g++"
|
|
|
|
export CFLAGS="${CFLAGS} -arch armv6 -isysroot ${SDKPATH}"
|
|
|
|
export LDFLAGS="${LDFLAGS} -arch armv6 -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation"
|
2010-05-12 10:59:20 +00:00
|
|
|
export AR="${DEVPATH}/usr/bin/libtool -static -o"
|
|
|
|
export RANLIB="echo ranlib"
|
|
|
|
# Use gcc -E as preprocessor instead of cpp, since cpp will find the
|
2010-05-13 00:04:51 +00:00
|
|
|
# header files in standard /usr/include instead of in isysroot
|
|
|
|
export CPP="${CC} -E -isysroot ${SDKPATH}"
|
2010-05-12 10:59:20 +00:00
|
|
|
|
2010-05-13 00:04:51 +00:00
|
|
|
# And finally invoke the configure script itself
|
2010-05-12 10:59:20 +00:00
|
|
|
./aconfigure --host=arm-apple-darwin9 --disable-floating-point $*
|
|
|
|
|
2010-05-13 00:04:51 +00:00
|
|
|
if test "$?" = "0"; then
|
|
|
|
echo "Done configuring for `basename $SDKPATH`"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|