Skip to content
This repository was archived by the owner on Mar 25, 2019. It is now read-only.

Commit 6f6c8d5

Browse files
author
ericwlange
committed
2 parents 6096651 + 24c7cf4 commit 6f6c8d5

1 file changed

Lines changed: 20 additions & 90 deletions

File tree

README.md

Lines changed: 20 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -140,31 +140,36 @@ Then download `AndroidJSCore-2.1-release.aar` from the [latest release] and
140140
copy it into `~/AndroidJSCore/lib`. Now you can open `~/AndroidJSCore/examples/AndroidJSCoreExample`
141141
in Android Studio and run it.
142142

143-
# Note: The instructions below are valid only for 2.1 and below, and will not work on HEAD
144-
145-
I am moving to a completely new build process which has a number of advantages. Documentation to be updated shortly.
146-
147-
Building AndroidJSCore-2.1 library
143+
Building AndroidJSCore-2.2 library
148144
-------------------------------
149145

150146
If you are interested in building the library directly and possibly contributing, you must
151147
do the following:
152148

153149
#### TL;DR - do this
154150

155-
Set `ANDROID_HOME` and `ANDROID_NDK_ROOT` environment variables
151+
##### Step 1: Get `hemroid` package manager and build JavaScriptCore
156152

157-
% git clone --recursive https://github.com/ericwlange/AndroidJSCore.git
158-
% mkdir build
159-
% cd build
160-
% ../AndroidJSCore/scripts/build
153+
% git clone https://github.com/ericwlange/hemroid.git
154+
% export PATH=$PATH:$PWD/hemroid
155+
% export ANDROID_NDK=/path/to/ndk
156+
% export ANDROID_SDK=/path/to/sdk
157+
% hemroid install javascriptcore
161158

162159
Note that this requires [GIT LFS](https://git-lfs.github.com/). If you don't already have it installed,
163160
you will need to install it.
164161

165-
Note the `--recursive` option in `git clone`. This is required for building the
166-
library, but not if you are just downloading the released library as with the example app above.
167-
Your library now sits in `lib/AndroidJSCore-2.1-release.aar`. To use it, simply
162+
##### Step 2: Build AndroidJSCore
163+
164+
git clone https://github.com/ericwlange/AndroidJSCore.git
165+
cd AndroidJSCore/AndroidJSCore
166+
echo ndk.dir=$ANDROID_NDK > local.properties
167+
echo sdk.dir=$ANDROID_SDK >> local.properties
168+
./gradlew assembleRelease
169+
mkdir -p ../lib
170+
cp AndroidJSCore/build/outputs/aar/* ../lib
171+
172+
Your library now sits in `lib/AndroidJSCore-2.2-pre1-release.aar`. To use it, simply
168173
add the following to your app's `build.gradle`:
169174

170175
repositories {
@@ -174,86 +179,11 @@ add the following to your app's `build.gradle`:
174179
}
175180

176181
dependencies {
177-
compile(name:'AndroidJSCore-2.1-release', ext:'aar')
182+
compile(name:'AndroidJSCore-2.2-pre1-release', ext:'aar')
178183
}
179184

180-
If something goes wrong or you want to understand what's going on, read on.
181-
182-
#### Step 1 - Set up required tools
183-
184-
This has all been verified to work on Mac OSX (specifically 10.11.2 El Capitan)
185-
and Linux (Ubuntu 14.04 LTS). If anyone else is married to that OS from Seattle,
186-
please feel free to get it working and contribute!
187-
188-
1. Download and install the latest version of [Android Studio], including the [NDK]
189-
2. Set two environment variables: `ANDROID_HOME` and `ANDROID_NDK_ROOT` to point to the SDK and NDK directories, respectively
190-
3. Clone the repo: `git clone --recursive https://github.com/ericwlange/AndroidJSCore.git`
191-
192-
This last step will grab both the AndroidJSCore repo, as well as my fork of the
193-
[webkit] repo. The latter part is huge, like 6 GBs or something, so settle in. Note that
194-
the recursive clone is required for building the lib, but is not if you just want to
195-
build the example app.
196-
197-
The build process requires a bunch of other standard UNIX tools, too. The below script will
198-
complain if it can't find something, but you should expect to have the command-line
199-
tools (OSX), `gcc`, `make`, `cmake`, `python`, `perl`, `gperf`, `bison`, `ruby` and
200-
a smattering of other standard developer tools installed.
201-
202-
#### Step 2 - Create a build directory
203-
204-
This directory can be anywhere, but an out-of-source build is always recommended, as
205-
you can blow the whole thing away and start over if something goes awry.
206-
207-
% mkdir build
208-
% cd build
209-
210-
#### Step 3 - Build AndroidJSCore-2.1-release.aar
211-
212-
From the `build` (or whatever you named it) directory, run the `build` script in `scripts/`:
213-
214-
% ../AndroidJSCore/scripts/build
215-
216-
Note, the above assumes that your build directory is at the same level as the `AndroidJSCore`
217-
project. Salt to taste.
218-
219-
This can take an hour, as it does a lot. Roughly, it will:
220-
1. Download the `iconv`, `ffi`, `gettext`, `glib-2.0`, and `icu` library sources
221-
2. Patch the sources to make them build on Android
222-
3. Build the `icu` library for your host OS
223-
224-
And then for each architecture (`armeabi`, `armeabi-v7a`, `arm64-v8a`, `x86`, `x86_64`, `mips`, and `mips64`), it will:
225-
1. Install the prebuilt toolchain for the ABI
226-
2. Build the five libraries downloaded above
227-
3. Build the appropriate sections of WebKit required for `JavaScriptCore`
228-
229-
Finally, it will pull it all together by building the `AndroidJSCore-2.1-release.aar`
230-
library. That file will be installed in the `lib/` directory of the `AndroidJSCore`
231-
source tree.
232-
233-
The `build` script has some options:
234-
235-
`--link-icu-data` will force the ICU data library to be linked to the source. By default,
236-
this library is stubbed out. The ICU data library adds a whopping 15MB or so to each
237-
arch (uncompressed). This library is used for unicode strings, and it isn't clear whether
238-
it is truly required for JavaScriptCore to function or not. It is definitely required for
239-
WebKit as a whole, but it doesn't seem to impact JavaScript to leave it out. If for some
240-
reason your project isn't working because of this, you can link the lib back in with this
241-
option.
242-
243-
`--disable-jit` will disable just-in-time compilation for all architectures. Currently, it
244-
is disabled by default for `armeabi` and `mips` because they will not even compile, and it
245-
is turned off for `armeabi-v7a` because it causes the app to crash on load. In subsequent
246-
releases, I will try to get `armeabi-v7a` to work. This should theoretically significantly improve
247-
the speed of JavaScript execution, and is currently enabled by default for `x86` and the
248-
64-bit arches.
249-
250-
`--force-jit` will force enable just-in-time compilation even for arches that don't work.
251-
Don't use this option unless you are trying to debug JIT. This option overrides `--disable-jit`
252-
if used together.
253185

254-
You may also specify target architectures explicitly. By default, all architectures
255-
(`armeabi`, `armeabi-v7a`, `x86`, `mips`, `arm64-v8a`, `x86_64`, and `mips64`) will build,
256-
but if you only want to build a subset, just specify them on the command line.
186+
More details to come ...
257187

258188
Work in Progress
259189
----------------

0 commit comments

Comments
 (0)