from: http://phoboslab.org/log/2011/06/javascriptcore-project-files-for-ios

github: https://github.com/phoboslab/JavaScriptCore-iOS


Some weeks ago I released a compiled version of the JavaScriptCore library for iOS as part of my game engine. Since then I had many people asking for the project files necessary to build the library - and I promised to release them as well. But before I do so, let me just rant about Apple's politics real quick:

They suck.

You see, JavaScriptCore is an Open Source library. In fact the whole WebKit project is. It's licensed under BSD and LGPL licenses. The latter of which requires that if you modify the software you have to release your modified version – including the complete source – under the LGPL as well. Furthermore, itstates"For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files,plus the scripts used to control compilation and installation of the library."

Yet the JavaScriptCore sources that you get from Apple's Open Source page come without a project file. So while you get the source code for the library, it's useless because you can't compile it.

Luckily you can also get the current JavaScriptCore sources directly from the SVN repository – and behold, they even come with an Xcode project file, ready to be build for MacOSX with the touch of a button. But – and here's the kicker – this project file curiously misses the iOS platform target. You can't build it for the iPhone or iPad.

Adding this iOS target to the project file is by no means a trivial endeavor, mind you. Especially not in Xcode. I ended up duplicating the MacOSX target, setting the Base SDK to Latest iOS, changing the Supported Platforms to iphoneos iphonesimulator and poking around in the project file with a text editor to change the productType to library.static, because you're not allowed to build a framework for iOS.

After some more changes that I can't remember (I'll be sure to document this next time I do it), I was finally able to compile the library for iOS. I submitted my game Biolab Disaster to the App Store only to see that it was rejected the next day.

JavaScriptCore utilizes the libicucore library to sort strings in a unicode fashion. Apparently libicucore is a "private" API on iOS – which is curious because I can add this library to my iOS project without any dirty hacks, I'm just not allowed to use any functions of it. So I compiled JavaScriptCore again, this time setting theUCONFIG_NO_COLLATION preprocessor macro to disable unicode sorting.

Did I mention Apple's politics suck?

Update December 2nd 2012: an up-to-date version can be found on github. The old version and instructions follow.

Anyway, here's the statically compiled libiOSJavaScriptCore.athat you can use in your iOS projects and the source and project file if you want to build it yourself for whatever reason:

This all is based on the slightly outdated 534.27 version of JavaScriptCore, but at least this version seems to be AppStore compatible.

Using libiOSJavaScriptCore.a in your Project:

  • Copy the JavaScriptCore directory with the header files from the ZIP to your project folder and add them to your Xcode project
  • Copy the libiOSJavaScriptCore.a into your project folder
  • Add the libstdc++.dyliblibicucore.dylib from the list and the libiOSJavaScriptCore.a from "Add other..." like so
  • import <JavaScriptCore/JavaScriptCore.h>

Building JavaScriptCore from the Source:

  • Select iOSJavaScriptCore iPhone as the active Scheme and build
  • Select iOSJavaScriptCore iPhone Simulator as the active Scheme and build
  • Navigate your terminal to the build directory: depending on your Xcode settings either build/Products/ directly in your project directory or~/Library/Developer/Xcode/DerivedData/JavaScriptCore-xxx/Build/Products/
  • Combine the ARM6/7 and x86 (Simulator) libs into one: lipo -create Production-iphoneos/libiOSJavaScriptCore.a Production-iphonesimulator/libiOSJavaScriptCore.a -output libiOSJavaScriptCore.a

Btw.: AppCelerator maintains their own version of JavaScriptCorethat they use in Titanium, but I have no idea how to build it. Any hints are greatly appreciated!

If you want to support me, please consider buying a license of my game engine. It also makes a great gift ;-)

[转]编译 JavaScriptCore For iOS的更多相关文章

  1. 多媒体开发(7):编译Android与iOS平台的FFmpeg

    编译FFmpeg,一个古老的话题,但小程还是介绍一遍,就当记录.之前介绍怎么给视频添加水印时,就已经提到FFmpeg的编译,并且在编译时指定了滤镜的功能. 但是,在手机盛行的时代,读者可能更需要的是能 ...

  2. 编译x264 for ios

    Tested with: x264-snapshot-20140914-2245  我用的是x264-snapshot-20150813-2245.tar.bz2 Xcode 7 依赖gas-prep ...

  3. [转]JavaScriptCore and iOS 7

    原文:http://www.bignerdranch.com/blog/javascriptcore-and-ios-7/ As a rule, iOS programmers don't think ...

  4. 编译VLC for IOS

    之前接触VLC是因为Winrt的项目,后来似乎ARM版本的始终搞不定(没有针对于ARM-COFF的GCC编译器),vlc for winrt的项目好久没有更新了,自己也没有深入研究.有一天跟同事聊,他 ...

  5. 编译FFmpeg for iOS

    2项依赖: gas-preprocessor(见附录:gas-preprocessor简介) yasm 1.2.0 如果要集成x264和fdk_aac,需要先编译x264和fdk_aac. Usage ...

  6. 转载 iOS js oc相互调用(JavaScriptCore) --iOS调用js

    iOS js oc相互调用(JavaScriptCore)   从iOS7开始 苹果公布了JavaScriptCore.framework 它使得JS与OC的交互更加方便了. 下面我们就简单了解一下这 ...

  7. xcode6 如何编译64位iOS应用

    原文:http://mobile.51cto.com/hot-412500.htm 随着iPhone5S的推出,大家开始关心5S上所使用的64位CPU A7. 除了关心A7的性能以外,大家还会关心一个 ...

  8. 如何提升代码编译的速度 iOS

    前阵子有遇到代码编译速度慢的问题,特别是在swift和object-c混编的过程中问题很突显. 网上找到一篇蛮好的文章里面又一些解决方法 推荐一下 http://www.open-open.com/l ...

  9. 编译fdk-aac for ios

    Build all: build-fdk-aac.sh Build for some architectures: build-fdk-aac.sh armv7s x86_64 Build unive ...

随机推荐

  1. 使用CNN(convolutional neural nets)关键的一点是检测到的面部教程(四):学习率,学习潜能,dropout

    第七部分 让 学习率 和 学习潜能 随时间的变化 光训练就花了一个小时的时间.等结果并非一个令人心情愉快的事情.这一部分.我们将讨论将两个技巧结合让网络训练的更快! 直觉上的解决的方法是,開始训练时取 ...

  2. sicily 1007 To and Fro (基地称号)

    链接:http://soj.me/show_problem.php?pid=1007 Description Mo and Larry have devised a way of encrypting ...

  3. 心有多宽 路就有多宽-- BreezeMH源码公布

    非常多话想说,但不知道从何说起~ 去年暑假做自己的第一个外挂,然后是Breeze‘s魔兽系列工具,測试版.正式版,看着自己进大学时的梦想慢慢的变成现实,那种喜悦感无法言表,于是就想着让很多其它的在校大 ...

  4. Windows 10技术布局,谈微软王者归来

    Windows 10技术布局,谈微软王者归来 每个时代都有王者,王者的成功,往往是因为恰逢其时地发布了一个成功的产品(具有里程碑意义,划时代的产品).Windows 95的成功标示着微软是PC时代的王 ...

  5. PL/SQL联系oracle成功可以sql解决的办法是检查表的名称无法显示

    有时,因为机器突然断电或其他原因PL/SQL它甚至不能在数据库表后显示.序列和其它元素.使用SQL Windows运行查询一般查询,登录或同样的现象再次. 我是不是可以解决因重复登录的猜测是,PLSQ ...

  6. android网络操作使用汇总(http)

    Android是作为智能手机的操作系统,我们开发的应用,大多数也都须要连接网络,通过网络发送数据.获取数据,因此作为一个应用开发人员必须熟悉怎么进行网络訪问与连接. 通常android中进行网络连接通 ...

  7. [Cocoa]深入浅出 Cocoa 之消息

    深入浅出 Cocoa 之消息    罗朝辉(http://blog.csdn.net/kesalin) 转载请注明出处 在入门级别的ObjC 教程中,我们常对从C++或Java 或其它面向对象语言转过 ...

  8. java设计模式之六适配器模式(Adapter)

    适配器模式将某个类的接口转换成客户端期望的另一个接口表示,目的是消除由于接口不匹配所造成的类的兼容性问题.主要分为三类:类的适配器模式.对象的适配器模式.接口的适配器模式.首先,我们来看看类的适配器模 ...

  9. linux c socket programming

    原文:linux c socket programming http://54min.com/post/http-client-examples-using-c.html 好文章 PPT http:/ ...

  10. [Elasticsearch] 邻近匹配 (一) - 短语匹配以及slop參数

    本文翻译自Elasticsearch官方指南的Proximity Matching一章. 邻近匹配(Proximity Matching) 使用了TF/IDF的标准全文搜索将文档,或者至少文档中的每一 ...