Last active
December 21, 2015 08:09
-
-
Save lukexi/6276169 to your computer and use it in GitHub Desktop.
GHC-iOS arm-apple-darwin10-gcc script for ARMv7/v7s fat binaries
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
#!/bin/sh | |
TARGET_PLATFORM=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk | |
TARGET_BIN="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin" | |
TARGET_GCC=$TARGET_BIN/arm-apple-darwin10-llvm-gcc-4.2 | |
TARGET_CFLAGS="-isysroot $TARGET_PLATFORM -mcpu=cortex-a8 -mfpu=neon" | |
allArgs=$@ | |
# Only need lipo when we're building object files | |
if [[ "$allArgs" == *.o* ]] | |
then | |
# Find the filename | |
fileName=$(echo "$allArgs" | sed 's|.*-o \([^.]*\)\.o.*|\1|') | |
# Create filename variants for armV7 and armV7s | |
fileNameForArmv7=$fileName-armv7 | |
fileNameForArmv7s=$fileName-armv7s | |
# Call gcc twice, once for each architecture, outputting to our filename variants | |
$TARGET_GCC $TARGET_CFLAGS "-march=armv7" ${allArgs//$fileName.o/$fileNameForArmv7.o} | |
$TARGET_GCC $TARGET_CFLAGS "-march=armv7s" ${allArgs//$fileName.o/$fileNameForArmv7s.o} | |
# Lipo the two filename variants together | |
lipo $fileNameForArmv7.o $fileNameForArmv7s.o -create -output $fileName.o | |
else | |
# If not building object files, call regularly. | |
exec $TARGET_GCC $TARGET_CFLAGS "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment