mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-25 06:09:50 +00:00
79 lines
2.0 KiB
Bash
Executable File
79 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
[ -z "${CPU}" ] && CPU="armv7"
|
|
# CPU=arm64
|
|
[ -z "${IOSINC}" ] && IOSINC="${CWD}/ios-include"
|
|
CWD="$(dirname "$0")"
|
|
#CC="xcrun --sdk iphoneos gcc -arch armv7 -I${CWD}/ios-include"
|
|
CC="xcrun --sdk iphoneos gcc -arch ${CPU} -I${IOSINC}"
|
|
#CC="xcrun --sdk iphoneos gcc -arch arm64"
|
|
exec ${CC} $*
|
|
exit 1
|
|
|
|
export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH
|
|
|
|
#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
|
|
CC="xcrun --sdk iphoneos gcc"
|
|
CXX="xcrun --sdk iphoneos g++"
|
|
LD=${CC}
|
|
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
|
|
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
|
|
# shellcheck disable=SC2048
|
|
# shellcheck disable=SC2086
|
|
${CC} "${CFLAGS}" "${LDFLAGS}" $*
|