Last active
June 27, 2016 21:45
-
-
Save danylokos/c8f68cfa700e707fc11f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Cleaning up..." | |
rm -rf bin/ src/ | |
echo "Copying sources..." | |
mkdir src/ | |
find SSLKillSwitch -type f \( -name "*.h" -o -name "*.m" -o -name "*.c" \) -exec cp {} src/ \; | |
BIN_NAME="SSLKillSwitch2.dylib" | |
IOS_VERSION_MIN=7.0 | |
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" | |
SDK_ROOT_OS=$DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk | |
ARCHS="armv7 arm64" | |
INPUT=`find src -type f \( -name "*.m" -o -name "*.c" \)` | |
for ARCH in ${ARCHS} | |
do | |
DIR=bin/${ARCH} | |
mkdir -p ${DIR} | |
echo "Building for ${ARCH}..." | |
SDK_ROOT=${SDK_ROOT_OS} | |
IOS_VERSION_MIN_FLAG=-mios-version-min | |
FRAMEWORKS=${SDK_ROOT}/System/Library/Frameworks/ | |
INCLUDES=${SDK_ROOT}/usr/include/ | |
LIBRARIES=${SDK_ROOT}/usr/lib/ | |
clang -I${INCLUDES} -F${FRAMEWORKS} -L${LIBRARIES} -Os -dynamiclib -isysroot ${SDK_ROOT} -arch ${ARCH} -fobjc-arc ${IOS_VERSION_MIN_FLAG}=${IOS_VERSION_MIN} -framework Foundation ${INPUT} -o ${DIR}/${BIN_NAME} | |
done | |
echo "Creating universal binary..." | |
FAT_BIN_DIR="bin/universal" | |
mkdir -p ${FAT_BIN_DIR} | |
lipo -create bin/**/${BIN_NAME} -output ${FAT_BIN_DIR}/${BIN_NAME} | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment