Forgive this mother-of-all brain-dumps .
“Never say never, because limits, like fears, are often just an illusion.”
― Michael Jordan
Technology is about making the impossible, possible, right? We can build IOS binaries on non-mac hardware, we just need to bring the necessary tools together.
Until recently, I was led to believe Java couldn’t be used to code for IOS, but hey, Avian/IKVM-Monotouch/RoboVM-LLVM say differently. As for building IOS executables while not using a Mac, well various development tools are doing this already, one example is the commercial Marmalade SDK (http://www.madewithmarmalade.com - I have no association).
Below is a rag-tag set of information I’ve compiled, hopefully with the idea of offering a real solution for freely and legally compiling 100% IOS-compatible applications on non-Apple hardware without the need for Mac virtualisation etc. You’ll still need an Apple developer account of some kind (free for dev tools downloads) and none of this will get around the $99 Apple fee for App Store distribution (no answer for that).
So, some ‘connect the dots’ is probably necessary, but that’s what open-source is often about, I’m just lighting the touch paper.
- Getting a non-mac IOS compiler tool chain
Quoting a StackOverFlow answer (http://stackoverflow.com/a/2406839/304330):
"The low-level toolchain for Xcode (the gcc compiler family, the gdb debugger, etc.) is all open source and common to Unix and Linux platforms..."
OK, the principle part of our ‘sauce’ would be:
https://github.com/H2CO3/xchain-ios (see https://github.com/polyvertex/xchain-ios fork for a Windows/Cygwin compatible patch).
xchain-ios is an IOS-capable GCC+tools implementation and is the designed around the research within the following document:
According to the developer, H2CO3, xchain-ios has been tested on iOS 4.2.1 on iPhone 3G and iOS 5.1.1 on iPad 3.
The required, official, XCode DMG packages can be downloaded from the following URLs using a [free] Apple developer connection developer account login. The download should be easily scriptable with Curl etc.:
- Xcode 4.3.2: http://adcdownload.apple.com/Developer_Tools/xcode_4.3.2/xcode_432_lion.dmg
- Xcode 4.4.1: http://adcdownload.apple.com/Developer_Tools/xcode_4.4.1/xcode_4.4.1_693815.dmg
- Xcode 4.5.2: http://adcdownload.apple.com/Developer_Tools/xcode_4.5.2/xcode4520418508a.dmg
- Xcode 4.6: http://adcdownload.apple.com/Developer_Tools/xcode_4.6/xcode460417218a.dmg
The following Bash script describes using 7zip to decompress and install XCode’s DMGs on non-Mac hardware (this may require HFS kernel modules):
Structure of IPA (*.ipa) zip-based IOS app bundle file
The structure of an IPA:
Signing a *.ipa IOS app bundle for distribution to the app store - ‘codesign’ command line utilty
**** Apple’s codesign CPP source - as used by Marmalade on Windows etc.
#Apple FOSS code mirror (includes codesign.h/cpp etc.)
The following Bash script outlines signing an IPA (*.ipa) IOS zip bundle with a ‘codesign’ utility
#Given that the application name is MyApplication.ipa
#As indicated in the keychain certifcate common name
rm -rf ./Payload
echo “$ARCHIVE_NAME”".ipa" “$ARCHIVE_NAME”".backup"
codesign -f -s “$CERTFICATE_NAME” ./Payload/“The package name in the Payload folder with the extension”
zip -r ./"$ARCHIVE_NAME"".zip" ./Payload
cp “$ARCHIVE_NAME”".ipa" “$ARCHIVE_NAME”".backup"
mv “$ARCHIVE_NAME”".zip" “$ARCHIVE_NAME”".ipa"
rm -rf ./Payload
echo “Finished Code Sign successfully”
*PLIST handling - see http://stackoverflow.com/a/1749248/304330
https://github.com/playhaven/sdk-ios/blob/master/example/Info-udid.plist ← Example IOS XML plist
http://scw.us/iPhone/plutil XML plist converter, Windows/Linux
http://www.quantum-step.com/download/sources/mystep/Tools/PlistBuddy.m ← tool for plist key addition
http://code.google.com/p/plist ← IOS-compatible Java-based PList (XML) modification library
#Misc. related links
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/ditto.1.html ← IPA-capable app-bundler
https://gist.github.com/sharpland/1365444 ← ReCodeSign