Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 4.58 KB

webkit_fork_and_compilation.md

File metadata and controls

45 lines (38 loc) · 4.58 KB

WebKit Fork and Compilation

jscshim and node-jsc ship with WebKit, which is compiled during the node-jsc build process.

WebKit Port and Compilation

jscshim\node-jsc's initial goals for building WebKit:

  • Use just what we need from WebKit: JavaScriptCore and WTF ("Web Template Framework").
  • Compile JSC and WTF as a static libraries, if possible.
  • Use the optimized assembly version of LLInt (JSC's interpreter), not cloop. This requires enabling JIT support, although we won't be using the JIT (but we can omit the FTL jit).

WebKit provides a several building options:

  • CMake: Offers cross platform support and customization options, through several different "ports": AppleWin, WinCairo, Mac, etc.
    • A port JSCOnly, (originally) not intended for production, aims to make it easier to build just JavaScriptCore, reducing dependencies as much as possible.
    • It seems that the CMake scripts are sometimes outdated\not as maintained as the other, platform specific, options (at least compated to the XCode projects).
  • For macOS and iOS, there are Xcode projects.
  • For Windows there are vcxproj\sln files. Theses options can be used directly, or through WebKit's building scripts: build-webkit and build-jsc (under Tools/Scripts).

CMake seemed like a good options, since it will allow us to support multiple platform more easily, and it offers the "JSCOnly" port. JSCOnly port, compiled as a static library, is exactly what we need. The downside of using the JSCOnly port is that it wasn't intended for production use, thus have some limitations (like not leveragin CF RunLoops on iOS\macOS). Still, jscshim currently use CMake to build the JSCOnly port (after some modifications).

When building node-jsc, jscshim gyp (webkit.gyp) will invoke jscshim's build_jsc.py to build WebKit:

  • For any target other than iOS, build_jsc.py will use WebKits build-jsc script.
  • After having trouble with compiling JSCOnly port for iOS with build-jsc, I decided to skip build-jsc and use cmake\xcodebuild direclty, providing cmake with a custom iOS "toolchain" file. I used NativeScript as a reference, as they are also compiling WebKit from cmake, although they are doing a few things differently (they compile it as part of their own cmake compilation, and they use the "Mac" port).

See build_jsc.py for more detailed information and configuration paramters used.

WebKit Fork

During the development of jscshim, I needed to make some changes to WebKit, thus we have our own fork. The changes were mainly either to add needed features, fix problems or support the JSCOnly compilation. Hopefully we could merge at least some of the upstream.

The major changes\addtions in our fork: