rolando.cl

Compiling JavaScriptCore for iOS

While for some time now you’ve been able to add your own version of JSC to your iOS projects, there’s still no painless solution to compile the svn version yourself. So here are my steps in order to get that working:

UPDATED Feb 17th, 2012

  1. Duplicate target (rename iOSJavaScriptCore or something appropiate) and set the Base SDK and platform target to iOS
  2. remove the Info.plist created when you duplicated the target
  3. change the Product Name (and scheme name)
  4. manually edit the xcode project (the xml file) and change the target product type to com.apple.product-type.library.static (search for the name of the target)
  5. Link to proper iOS libraries (the same libraries, but point them to the iOS SDK)
  6. set the HAVE_DTRACE flag to 0 (zero) on both iOS and Simulator
  7. set OTHER_LD_FLAGS_BASE to ""
  8. set link to standard libraries to NO
  9. set targeted device family to “iPhone/iPad”
  10. Deal with the derived sources problems, for the script-generated .lut.h files. The way I did it was to manually add the include search path to the place where the files where being generated. This is by far not the best solution but it works. [EDIT] Another (apparently working better) way pointed in the same thread is to copy the Derived Sources script phases on the iOSJavaScriptCore target and make those the first phases to be run. Make sure you eliminate the dependencies after adding those phases.

I hope that helps some other iOS developers out there.

Future post: how to actually use JSC for scripting and some pointers along the way.

Btw, if someone has something similar to this list but for building JSC for android, please let me know :)

Post a comment


(lesstile enabled - surround code blocks with ---)