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.
Cheers
Rich
- 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:
http://devs.openttd.org/%7Etruebrain/compile-farm/apple-darwin9.txt
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.
-
Downloading XCode/SDK
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):
https://github.com/shinh/maloader/blob/master/unpack_xcode.sh
-
Structure of IPA (*.ipa) zip-based IOS app bundle file
The structure of an IPA:
/Payload/
/Payload/Application.app
/iTunesArtwork
/iTunesMetadata.plist
-
Signing a *.ipa IOS app bundle for distribution to the app store - ‘codesign’ command line utilty
http://www.raywenderlich.com/2915/ios-code-signing-under-the-hood
http://furbo.org/2008/11/12/the-final-test
http://dansdevdiary.tumblr.com/post/3255871033/further-adventures-in-resigning-for-ios
**** Apple’s codesign CPP source - as used by Marmalade on Windows etc.
http://opensource.apple.com/source/security_systemkeychain/security_systemkeychain-55002/src/codesign.cpp
#Apple FOSS code mirror (includes codesign.h/cpp etc.)
https://github.com/Apple-FOSS-Mirror/security_systemkeychain/tree/master/src
The following Bash script outlines signing an IPA (*.ipa) IOS zip bundle with a ‘codesign’ utility
#!/bin/sh
#======ipaCodesign.sh=============
Found at http://stackoverflow.com/a/10515547/304330
#Given that the application name is MyApplication.ipa
export ARCHIVE_NAME=“MyApplication”
#As indicated in the keychain certifcate common name
export CERTFICATE_NAME=“MyCertificate”
rm -rf ./Payload
echo “$ARCHIVE_NAME”".ipa" “$ARCHIVE_NAME”".backup"
unzip “$ARCHIVE_NAME”".ipa"
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”
#======End ipaCodesign.sh=============
*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://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/plutil.1.html
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html
http://www.quantum-step.com/download/sources/mystep/Tools/PlistBuddy.m ← tool for plist key addition
http://hg.openpanel.com/grace/file/05c5081a23e0/schemas/com.apple.plist.schema.xml
http://code.google.com/p/plist ← IOS-compatible Java-based PList (XML) modification library
http://sourceforge.net/p/plist
http://code.google.com/p/xmlwise
#Misc. related links
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/ditto.1.html ← IPA-capable app-bundler
http://cakoose.com/wiki/plist_xml_is_pointless
https://gist.github.com/sharpland/1365444 ← ReCodeSign
http://floatlearning.com/2011/11/re-signing-an-ios-app-without-xcode
http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload
http://support.brightcove.com/en/app-cloud/docs/step-step-guide-publishing-apple-app-store-using-windows
http://darling.dolezel.info/en/Darling
https://github.com/LubosD/darling ← Darwin on Linux (like Wine)
http://speirs.org/blog/2007/12/5/what-are-xib-files.html
http://kosmaczewski.net/projects/nib2objc