Thursday, February 4, 2016

make-ios - peace out XCODE IDE!

So awhile ago, I got so frustrated with Android Studio and the crappy build system that is gradle, that I decided to create a Makefile so I understood what was going on (http://orphanware.blogspot.com/2014/08/androids-bloated-build-system-be-damned.html). It turned out the actual commands to run and create an Android project are not hard, but rather interesting.

Anyway, more recently I decided to do the same with iOS.  The results were MUCH simpler than the Android version since android has to convert java *.class files to a *.dex file, among other tedious steps. You still need to download XCODE from the App Store as the only way that I'm aware of getting the iOS SDK is to download the IDE.  Anyway without further blabbering.  Will upload as sample app to github in a later post:


SRC=`pwd`/src/objc/m/** INC=-I`pwd`/src/objc/h/ LIB=-l xml2.2 `pwd`/lib/dummylib -l z.1.2.5 FRAMEWORKS=-framework Foundation -framework UIKit -framework AVFoundation -framework CoreGraphics ISYSROOT=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ ARCH64=-arch arm64 -miphoneos-version-min=6 ARCHV7=-arch armv7 -miphoneos-version-min=6 TMP_ARCH64_BIN=tmp/ioscliapp_arch64 TMP_ARCHV7_BIN=tmp/ioscliapp_archv7 BIN=bin/Payload/iosapp.app/iosapp #this is just the string value that you find in your OSX keychain for your certificate CERT=`cat /etc/ios_cert_name` BUNDLEID="org.orphanware.iosapp" default: pre arch64 archv7 post pre: @mkdir -p bin/Payload/iosapp.app/ @mkdir -p tmp/obj/ @cp etc/Info.plist bin/Payload/iosapp.app/ @cp etc/ProvisionProfile.mobileprovision bin/Payload/iosapp.app/embedded.mobileprovision post: @lipo -create $(TMP_ARCH64_BIN) $(TMP_ARCHV7_BIN) -output $(BIN) @codesign -f -s "$(CERT)" --entitlements etc/entitlements.plist bin/Payload/iosapp.app @cd bin/; zip -qr iosapp.ipa Payload/ arch64: @gcc -Wall -g -c -ObjC $(SRC) $(INC) $(ISYSROOT) $(ARCH64) @mv *.o tmp/obj/ @gcc -o $(TMP_ARCH64_BIN) tmp/obj/** -ObjC $(LIB) $(ISYSROOT) $(FRAMEWORKS) $(ARCH64) @rm tmp/obj/* archv7: @gcc -Wall -g -c -ObjC $(SRC) $(INC) $(ISYSROOT) $(ARCHV7) @mv *.o tmp/obj/ @gcc -o $(TMP_ARCHV7_BIN) tmp/obj/** -ObjC $(LIB) $(ISYSROOT) $(FRAMEWORKS) $(ARCHV7) @rm tmp/obj/* clean: @rm -rf tmp/ @rm -rf bin/*