Debian Codegraph @

Xpjproject/configure-iphone

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 F="configure-iphone"
4
5 if testscip-shell system . . test. "$*" = "--help" -o "$*" = "-h"; then
6 echoscip-shell system . . echo. "$F [OPTIONS]"
7 echoscip-shell system . . echo. ""
8 echoscip-shell system . . echo. "where:"
9 echoscip-shell system . . echo. " OPTIONS Other options that will be passed directly to"
10 echoscip-shell system . . echo. " ./aconfigure script. Run ./aconfigure --help"
11 echoscip-shell system . . echo. " for more info."
12 echoscip-shell system . . echo. ""
13 echoscip-shell system . . echo. "Environment variables:"
14 echoscip-shell system . . echo. " IPHONESDK Optionally specify which SDK to use. Value is the full "
15 echoscip-shell system . . echo. " path of the SDK. By default, the latest SDK installed"
16 echoscip-shell system . . echo. " will be used."
17 echoscip-shell system . . echo. " CC Optionally specify the path of the ARM cross compiler"
18 echoscip-shell system . . echo. " to use. By default, the compiler is deduced from the"
19 echoscip-shell system . . echo. " SDK."
20 echoscip-shell system . . echo. " ARCH Optional flags to specify target architecture, e.g."
21 echoscip-shell system . . echo. " ARCH=\"-arch armv7\". Default is arm64."
22 echoscip-shell system . . echo. " MIN_IOS Optional flags to specify minimum supported iOS"
23 echoscip-shell system . . echo. " versions, e.g. MIN_IOS=\"-miphoneos-version-min=11.0\". "
24 echoscip-shell system . . echo. " Default is 11.0."
25 echoscip-shell system . . echo. ""
26 exit 0
27 fi
28
29 # Set the main iPhone developer directory, if not set
30 if testscip-shell system . . test. "x${DEVPATH}" = "x"; then
31 DEVPATH=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developerscip-shell filesystem . . `/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer`.
32 if testscip-shell system . . test. ! -d $DEVPATH; then
33 DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developerscip-shell filesystem . . `/Developer/Platforms/iPhoneOS.platform/Developer`.
34 fi
35 echoscip-shell system . . echo. "$F: DEVPATH is not specified, using ${DEVPATH}"
36 fi
37
38 # Make sure $DEVPATH directory exist
39 if testscip-shell system . . test. ! -d $DEVPATH; then
40 echoscip-shell system . . echo. "$F error: directory $DEVPATH does not exist. Please install iPhone development kit"
41 exit 1
42 fi
43
44 # Choose SDK version to use
45 if testscip-shell system . . test. "$IPHONESDK" = ""; then
46 # If IPHONESDK is not set, use the latest one
47 for f in `lsscip-shell system . . ls. $DEVPATH/SDKs/`; do echoscip-shell system . . echo. $f | sedscip-shell system . . sed. 's/\(.sdk\)//'; done | sortscip-shell system . . sort. | tailscip-shell system . . tail. -1 > tmpsdkname
48 IPHONESDK=`catscip-shell system . . cat. tmpsdkname`.sdk
49 rmscip-shell system . . rm. -f tmpsdkname
50 SDKPATH=${DEVPATH}/SDKs/${IPHONESDK}
51 echoscip-shell system . . echo. "$F: IPHONESDK is not specified, choosing ${IPHONESDK}"
52 elif testscip-shell system . . test. -d ${IPHONESDK}; then
53 # .. else if IPHONESDK is set and it points to a valid path, just use it
54 SDKPATH=${IPHONESDK}
55 else
56 # .. else assume the SDK name is used.
57 SDKPATH=${DEVPATH}/SDKs/${IPHONESDK}
58 fi
59
60 # Test the SDK directory
61 if testscip-shell system . . test. ! -d ${SDKPATH}/usr/include; then
62 echoscip-shell system . . echo. "$F error: unable to find valid iPhone SDK in ${SDKPATH}"
63 exit 1
64 fi
65
66 # Default CFLAGS if it's not specified
67 if testscip-shell system . . test. "$CFLAGS" = ""; then
68 CFLAGS="-O2 -Wno-unused-label"
69 fi
70
71 # Default LDFLAGS if it's not specified
72 if testscip-shell system . . test. "$LDFLAGS" = ""; then
73 LDFLAGS="-O2"
74 fi
75
76 # Test the toolchain directory
77 TCPATH="${DEVPATH}/../../../Toolchains/XcodeDefault.xctoolchain"
78 if testscip-shell system . . test. ! -d ${TCPATH}/usr/bin; then
79 TCPATH="${DEVPATH}"
80 fi
81
82 # Determine which gcc for this SDK. Binaries should have the
83 # full path as it's not normally in user's PATH
84
85 if testscip-shell system . . test. "${CC}" = ""; then
86 # Try to use clang if available
87 ccpath="${TCPATH}/usr/bin/clang"
88 # Next, try to use llvm-gcc
89 gccpath="${DEVPATH}/usr/bin/llvm-gcc"
90 if testscip-shell system . . test. -e ${ccpath}; then
91 export CC="${ccpath}"
92 elif testscip-shell system . . test. -e ${gccpath}; then
93 export CC="${gccpath}"
94 else
95 for archpath in `lsscip-shell system . . ls. -d ${SDKPATH}/usr/lib/gcc/arm-apple-darwin*`; do
96 archname=`basenamescip-shell system . . basename. ${archpath}`
97 for gccver in `lsscip-shell system . . ls. ${archpath}`; do
98 gccpath="${DEVPATH}/usr/bin/${archname}-gcc-${gccver}"
99 if testscip-shell system . . test. -e ${gccpath}; then
100 export CC="${gccpath}"
101 fi
102 done
103 done
104 fi
105 if testscip-shell system . . test. ! "${CC}" = ""; then
106 echoscip-shell system . . echo. "$F: CC is not specified, choosing ${CC}"
107 fi
108 fi
109
110 if testscip-shell system . . test. "${CC}" = ""; then
111 echoscip-shell system . . 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."
112 exit 1
113 fi
114
115 if testscip-shell system . . test. "${ARCH}" = ""; then
116 export ARCH="-arch arm64"
117 echoscip-shell system . . echo. "$F: ARCH is not specified, choosing ${ARCH}"
118 fi
119 export ARCH_VAL=`echoscip-shell system . . echo. ${ARCH} | sedscip-shell system . . sed. 's/\-arch //' | sedscip-shell system . . sed. -e 's/^[ \t]*//;s/[ \t]*$//' `
120
121 if testscip-shell system . . test. "${ARCH_VAL}" = "arm64e"; then
122 export ARCH_VAL="arm64"
123 fi
124
125 if testscip-shell system . . test. "${MIN_IOS}" = ""; then
126 MIN_IOS_VER="11.0"
127 echoscip-shell system . . echo. "$F: MIN_IOS is not specified, choosing ${MIN_IOS_VER}"
128 MIN_IOS="-miphoneos-version-min=${MIN_IOS_VER}"
129 fi
130 CFLAGS="${CFLAGS} ${MIN_IOS}"
131 LDFLAGS="${LDFLAGS} ${MIN_IOS}"
132
133
134 # Set CXX if not set
135 if testscip-shell system . . test. "${CXX}" = ""; then
136 export CXX=`echoscip-shell system . . echo. ${CC} | sedscip-shell system . . sed. 's/clang/clang++/'`
137 echoscip-shell system . . echo. "$F: CXX is not specified, using ${CXX}"
138 fi
139
140 # Other settings to feed to configure script.
141 #ARCH="-arch armv6"
142 export CFLAGS="${CFLAGS} -DPJ_SDK_NAME=\"\\\"`basenamescip-shell system . . basename. $SDKPATH`\\\"\" ${ARCH} -isysroot ${SDKPATH}"
143 export LDFLAGS="${LDFLAGS} ${ARCH} -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation"
144 export AR="${TCPATH}/usr/bin/libtool -static -o"
145 export AR_FLAGS=" "
146 export RANLIB="echo ranlib"
147 # Use gcc -E as preprocessor instead of cpp, since cpp will find the
148 # header files in standard /usr/include instead of in isysroot
149 export CPP="${CC} ${ARCH} -E -isysroot ${SDKPATH}"
150
151 # Print settings
152 if testscip-shell system . . test. "1" = "1"; then
153 echoscip-shell system . . echo. "$F: calling ./aconfigure with env vars:"
154 echoscip-shell system . . echo. " MIN_IOS = ${MIN_IOS}"
155 echoscip-shell system . . echo. " CC = ${CC}"
156 echoscip-shell system . . echo. " CXX = ${CXX}"
157 echoscip-shell system . . echo. " SDKPATH = ${SDKPATH}"
158 echoscip-shell system . . echo. " CFLAGS = ${CFLAGS}"
159 echoscip-shell system . . echo. " LDFLAGS = ${LDFLAGS}"
160 echoscip-shell system . . echo. " AR = ${AR}"
161 echoscip-shell system . . echo. " RANLIB = ${RANLIB}"
162 echoscip-shell system . . echo. " ARCH = ${ARCH_VAL}"
163 fi
164
165 # And finally invoke the configure script itself
166 ./aconfigure --host=${ARCH_VAL}-apple-darwin_ios --disable-sdl $*
167
168 if testscip-shell system . . test. "$?" = "0"; then
169 echoscip-shell system . . echo. "Done configuring for `basenamescip-shell system . . basename. $SDKPATH`"
170 echoscip-shell system . . echo. ""
171 fi
172