radare2/sys/ios-sdk-gcc
2014-11-06 11:57:51 +01:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH
CWD=`dirname $0`
if [ -z "${CPU}" ]; then
CPU=armv7
#CPU=arm64
fi
if [ -z "${IOSVER}" ]; then
IOSVER=8.1
fi
DEVROOT=/Applications/Xcode.app/Contents/Developer
SDKROOT=${DEVROOT}/Platforms/iPhoneOS.platform
IOSROOT=${SDKROOT}/Developer/SDKs/iPhoneOS${IOSVER}.sdk
CFLAGS="-isysroot ${SDKROOT} -I${SDKROOT} -D__arm=1"
LDFLAGS="-isysroot ${SDKROOT}"
# -Wl, -syslibroot ${SDKROOT}"
export PATH=${DEVROOT}/usr/bin:${SDKROOT}/Developer/usr/bin:${PATH}
CC=${DEVROOT}/usr/bin/gcc
LD=${CC}
CFLAGS="${CFLAGS} -arch ${CPU}"
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
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} $@