Ignore:
Timestamp:
May 17, 2010 1:07:39 PM (14 years ago)
Author:
ming
Message:

Merge #1050, #1052, #1053, #1054 into the main trunk.

Location:
pjproject/trunk
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/configure-iphone

    r3168 r3175  
    11#!/bin/bash 
    22 
     3F="configure-iphone" 
     4 
    35if test "$*" = "--help" -o "$*" = "-h"; then 
    4   echo "configure-iphone [SDK=name_path] [OPTIONS]" 
     6  echo "$F [OPTIONS]" 
    57  echo "" 
    6   echo "SDK=name_path   Choose which SDK to use. Value can be SDK name (e.g." 
    7   echo "                iPhoneOS2.2.1.sdk) or the full path of the SDK" 
    8   echo "OPTIONS         Other options that will be passed directly to " 
    9   echo "                ./aconfigure script. Run ./aconfigure --help for" 
    10   echo "                more info." 
     8  echo "where:" 
     9  echo "  OPTIONS    Other options that will be passed directly to" 
     10  echo "             ./aconfigure script. Run ./aconfigure --help" 
     11  echo "             for more info." 
     12  echo "" 
     13  echo "Environment variables:" 
     14  echo "  IPHONESDK  Optionally specify which SDK to use. Value is the full " 
     15  echo "             path of the SDK. By default, the latest SDK installed" 
     16  echo "             will be used." 
     17  echo "  CC         Optionally specify the path of the ARM cross compiler" 
     18  echo "             to use. By default, the compiler is deduced from the" 
     19  echo "             SDK." 
    1120  echo "" 
    1221  exit 0 
    1322fi 
    1423 
    15 F="configure-iphone" 
    16  
    1724# Set the main iPhone developer directory, if not set 
    1825if test "x${DEVPATH}" = "x"; then 
    1926  DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer 
     27  echo "$F: DEVPATH is not specified, using ${DEVPATH}" 
    2028fi 
    2129 
     
    2735 
    2836# Choose SDK version to use 
    29 if test "x$SDK" = "x"; then 
    30   # If SDK is not set, use the latest one 
     37if test "$IPHONESDK" = ""; then 
     38  # If IPHONESDK is not set, use the latest one 
    3139  for f in `ls $DEVPATH/SDKs/`; do echo $f | sed 's/\(.sdk\)//'; done | sort | tail -1 > tmpsdkname 
    32   SDK=`cat tmpsdkname`.sdk 
     40  IPHONESDK=`cat tmpsdkname`.sdk 
    3341  rm -f tmpsdkname 
    34   echo "$F info: using ${SDK}" 
    35   SDKPATH=${DEVPATH}/SDKs/${SDK} 
    36 elif test -d ${SDK}; then 
    37   # .. else if SDK is set and it points to a valid path, just use it 
    38   SDKPATH=${SDK} 
     42  SDKPATH=${DEVPATH}/SDKs/${IPHONESDK} 
     43  echo "$F: IPHONESDK is not specified, choosing ${IPHONESDK}" 
     44elif test -d ${IPHONESDK}; then 
     45  # .. else if IPHONESDK is set and it points to a valid path, just use it 
     46  SDKPATH=${IPHONESDK} 
    3947else 
    4048  # .. else assume the SDK name is used. 
    41   SDKPATH=${DEVPATH}/SDKs/${SDK} 
     49  SDKPATH=${DEVPATH}/SDKs/${IPHONESDK} 
    4250fi 
    4351 
     
    4856fi 
    4957 
    50 # Settings to feed to configure script 
    51 export CFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH}" 
    52 export LDFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation" 
     58# Default CFLAGS if it's not specified 
     59if test "$CFLAGS" = ""; then 
     60  CFLAGS="-O2 -Wno-unused-label" 
     61fi 
     62 
     63# Default LDFLAGS if it's not specified 
     64if test "$LDFLAGS" = ""; then 
     65  LDFLAGS="-O2" 
     66fi 
     67 
     68# Determine which gcc for this SDK. Binaries should have the 
     69# full path as it's not normally in user's PATH 
     70 
     71if test "${CC}" = ""; then 
     72  for archpath in `ls -d ${SDKPATH}/usr/lib/gcc/arm-apple-darwin*`; do 
     73    archname=`basename ${archpath}` 
     74    for gccver in `ls ${archpath}`; do 
     75       gccpath="${DEVPATH}/usr/bin/${archname}-gcc-${gccver}" 
     76       if test -e ${gccpath}; then 
     77          export CC="${gccpath}" 
     78          break 
     79       fi 
     80    done 
     81    if test ! "${CC}" = ""; then 
     82       echo "$F: CC is not specified, choosing ${CC}" 
     83       break 
     84    fi 
     85  done 
     86fi 
     87 
     88if test "${CC}" = ""; then 
     89    echo "$F error: unable to find gcc for ${IPHONESDK}. If you think you have the right gcc, set the full path in CC environment variable." 
     90    exit 1 
     91fi 
     92 
     93# Set CXX if not set 
     94if test "${CXX}" = ""; then 
     95  export CXX=`echo ${CC} | sed 's/gcc/g++/'` 
     96  echo "$F: CXX is not specified, using ${CXX}" 
     97fi 
     98 
     99# Other settings to feed to configure script.  
     100#ARCH="-arch armv6" 
     101export CFLAGS="${CFLAGS} ${ARCH} -isysroot ${SDKPATH}" 
     102export LDFLAGS="${LDFLAGS} ${ARCH} -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation" 
    53103export AR="${DEVPATH}/usr/bin/libtool -static -o" 
    54104export RANLIB="echo ranlib" 
    55105# Use gcc -E as preprocessor instead of cpp, since cpp will find the 
    56 # header files in standard /usr/include 
    57 export CPP="${DEVPATH}/usr/bin/arm-apple-darwin9-gcc -E -isysroot ${SDKPATH}" 
     106# header files in standard /usr/include instead of in isysroot 
     107export CPP="${CC} -E -isysroot ${SDKPATH}" 
    58108 
    59 # And finally invoke configure script itself 
     109# Print settings 
     110if test "1" = "1"; then 
     111  echo "$F: calling ./aconfigure with env vars:" 
     112  echo " CC = ${CC}" 
     113  echo " CXX = ${CXX}" 
     114  echo " SDKPATH = ${SDKPATH}" 
     115  echo " CFLAGS = ${CFLAGS}" 
     116  echo " LDFLAGS = ${LDFLAGS}" 
     117  echo " AR = ${AR}" 
     118  echo " RANLIB = ${RANLIB}" 
     119fi 
     120 
     121# And finally invoke the configure script itself 
    60122./aconfigure --host=arm-apple-darwin9 --disable-floating-point $* 
    61123 
     124if test "$?" = "0"; then 
     125  echo "Done configuring for `basename $SDKPATH`" 
     126  echo "" 
     127fi 
     128 
Note: See TracChangeset for help on using the changeset viewer.