forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathios-sdk-gcc
executable file
·63 lines (57 loc) · 1.63 KB
/
ios-sdk-gcc
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
#!/bin/sh
export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH
CWD=`dirname $0`
#CPU="armv7 arm64"
if [ -z "${CPU}" ]; then
CPU=armv7
#CPU=arm64
fi
if [ -z "${IOSVER}" ]; then
IOSVER=8.3
fi
# USE_SIMULATOR=1
if [ -z "${USE_SIMULATOR}" ]; then
USE_SIMULATOR=0
fi
DEVROOT=/Applications/Xcode.app/Contents/Developer
if [ "${USE_SIMULATOR}" = 1 ]; then
CPU=i386
CFLAGS="${CFLAGS} -miphoneos-version-min=7.0"
SDKROOT=${DEVROOT}/Platforms/iPhoneSimulator.platform
IOSROOT=${SDKROOT}/Developer/SDKs/iPhoneSimulator${IOSVER}.sdk
CFLAGS="${CFLAGS} -isysroot ${SDKROOT} -I${SDKROOT}"
LDFLAGS="-static"
else
SDKROOT=${DEVROOT}/Platforms/iPhoneOS.platform
IOSROOT=${SDKROOT}/Developer/SDKs/iPhoneOS${IOSVER}.sdk
CFLAGS="-isysroot ${SDKROOT} -I${SDKROOT} -D__arm=1"
fi
LDFLAGS="-isysroot ${SDKROOT}"
# -Wl, -syslibroot ${SDKROOT}"
export PATH=${DEVROOT}/usr/bin:${SDKROOT}/Developer/usr/bin:${PATH}
CC=${DEVROOT}/usr/bin/gcc
LD=${CC}
for a in ${CPU} ; do
CFLAGS="${CFLAGS} -arch ${a}"
done
if [ "${USE_SIMULATOR}" != 1 ]; then
if [ -z "${IOSINC}" ]; then
IOSINC=${CWD}/ios-include
IOSINC=/Users/pancake/prg/radare2/sys/ios-include
fi
if [ -n "${IOSINC}" ]; then
CFLAGS="${CFLAGS} -I${IOSINC}"
fi
fi
CFLAGS="${CFLAGS} -I${IOSROOT}/usr/include"
#CFLAGS="${CFLAGS} -I${IOSROOT}/usr/include"
LDFLAGS="-L ${IOSROOT}/usr/lib/system ${LDFLAGS}"
LDFLAGS="-L ${IOSROOT}/usr/lib/ ${LDFLAGS}"
# Workaround
#if [ ! -e ${IOSROOT}/usr/lib/system/libcrypto.dylib ]; then
#sudo cp \
# ${IOSROOT}/usr/lib/system/libcorecrypto.dylib \
# ${IOSROOT}/usr/lib/system/libcrypto.dylib
#fi
# arm64
${CC} ${CFLAGS} ${LDFLAGS} "$@"