radare2/sys/ios-sdk-gcc

67 lines
1.7 KiB
Plaintext
Raw Normal View History

2014-05-17 10:27:49 +08:00
#!/bin/sh
export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH
2014-11-06 18:57:19 +08:00
CWD=`dirname $0`
#CPU="armv7 arm64"
2014-05-17 10:27:49 +08:00
if [ -z "${CPU}" ]; then
CPU=armv7
#CPU=arm64
fi
if [ -z "${IOSVER}" ]; then
2015-04-13 09:27:24 +08:00
IOSVER=8.3
2014-05-17 10:27:49 +08:00
fi
# USE_SIMULATOR=1
if [ -z "${USE_SIMULATOR}" ]; then
USE_SIMULATOR=0
fi
2014-05-17 10:27:49 +08:00
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
2014-05-17 10:27:49 +08:00
SDKROOT=${DEVROOT}/Platforms/iPhoneOS.platform
IOSROOT=${SDKROOT}/Developer/SDKs/iPhoneOS${IOSVER}.sdk
CFLAGS="-isysroot ${SDKROOT} -I${SDKROOT} -D__arm=1"
fi
2014-05-17 10:27:49 +08:00
LDFLAGS="-isysroot ${SDKROOT}"
# -Wl, -syslibroot ${SDKROOT}"
export PATH=${DEVROOT}/usr/bin:${SDKROOT}/Developer/usr/bin:${PATH}
CC=${DEVROOT}/usr/bin/gcc
2015-06-04 10:30:48 +08:00
CC="xcrun --sdk iphoneos gcc"
CXX="xcrun --sdk iphoneos g++"
2014-05-17 10:27:49 +08:00
LD=${CC}
2015-06-04 10:30:48 +08:00
export CC CXX LD
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
2014-05-17 10:27:49 +08:00
fi
CFLAGS="${CFLAGS} -I${IOSROOT}/usr/include"
2014-11-06 18:57:19 +08:00
#CFLAGS="${CFLAGS} -I${IOSROOT}/usr/include"
2014-05-17 10:27:49 +08:00
LDFLAGS="-L ${IOSROOT}/usr/lib/system ${LDFLAGS}"
LDFLAGS="-L ${IOSROOT}/usr/lib/ ${LDFLAGS}"
2014-05-17 10:27:49 +08:00
# Workaround
2014-11-06 18:57:19 +08:00
#if [ ! -e ${IOSROOT}/usr/lib/system/libcrypto.dylib ]; then
#sudo cp \
# ${IOSROOT}/usr/lib/system/libcorecrypto.dylib \
# ${IOSROOT}/usr/lib/system/libcrypto.dylib
#fi
2014-05-17 10:27:49 +08:00
# arm64
2015-04-29 16:41:18 +08:00
${CC} ${CFLAGS} ${LDFLAGS} $*