OLD | NEW |
(Empty) | |
| 1 # Prerequisites |
| 2 * a Linux/Mac workstation |
| 3 * v8 r12178 (on Google Code) or later |
| 4 * an Android emulator or device with matching USB cable |
| 5 * make sure [building with GYP](http://code.google.com/p/v8-wiki/wiki/Building
WithGYP) works |
| 6 |
| 7 |
| 8 # Get the code |
| 9 |
| 10 * Use the instructions from https://code.google.com/p/v8-wiki/wiki/UsingGit to
get the code |
| 11 * Once you need to add the android dependencies: |
| 12 ``` |
| 13 v8$ echo "target_os = ['android']" >> ../.gclient && gclient sync --nohooks |
| 14 ``` |
| 15 * The sync will take a while the first time as it downloads the Android NDK to
v8/third\_party |
| 16 * If you want to use a different NDK, you need to set the gyp variable android
\_ndk\_root |
| 17 |
| 18 |
| 19 # Get the Android SDK |
| 20 * tested version: `r15` |
| 21 * download the SDK from http://developer.android.com/sdk/index.html |
| 22 * extract it |
| 23 * install the "Platform tools" using the SDK manager that you can start by run
ning `tools/android` |
| 24 * now you have a `platform_tools/adb` binary which will be used later; put it
in your `PATH` or remember where it is |
| 25 |
| 26 |
| 27 # Set up your device |
| 28 * Enable USB debugging (Gingerbread: Settings > Applications > Development > U
SB debugging; Ice Cream Sandwich: Settings > Developer Options > USB debugging) |
| 29 * connect your device to your workstation |
| 30 * make sure `adb devices` shows it; you may have to edit `udev` rules to give
yourself proper permissions |
| 31 * run `adb shell` to get an ssh-like shell on the device. In that shell, do: |
| 32 ``` |
| 33 cd /data/local/tmp |
| 34 mkdir v8 |
| 35 cd v8 |
| 36 ``` |
| 37 |
| 38 |
| 39 # Push stuff onto the device |
| 40 * make sure your device is connected |
| 41 * from your workstation's shell: |
| 42 ``` |
| 43 adb push /file/you/want/to/push /data/local/tmp/v8/ |
| 44 ``` |
| 45 |
| 46 |
| 47 # Compile V8 for Android |
| 48 Currently two architectures (`android_arm` and `android_ia32`) are supported, ea
ch in `debug` or `release` mode. The following steps work equally well for both
ARM and ia32, on either the emulator or real devices. |
| 49 * compile: |
| 50 ``` |
| 51 make android_arm.release -j16 |
| 52 ``` |
| 53 * push the resulting binary to the device: |
| 54 ``` |
| 55 adb push out/android_arm.release/d8 /data/local/tmp/v8/d8 |
| 56 ``` |
| 57 * the most comfortable way to run it is from your workstation's shell as a one
-off command (rather than starting an interactive shell session on the device),
that way you can use pipes or whatever to process the output as necessary: |
| 58 ``` |
| 59 adb shell /data/local/tmp/v8/d8 <parameters> |
| 60 ``` |
| 61 * warning: when you cancel such an "adb shell whatever" command using Ctrl+C,
the process on the phone will sometimes keep running. |
| 62 * Alternatively, use the `.check` suffix to automatically push test binaries a
nd test cases onto the device and run them. |
| 63 ``` |
| 64 make android_arm.release.check |
| 65 ``` |
| 66 |
| 67 |
| 68 # Profile |
| 69 * compile a binary, push it to the device, keep a copy of it on the host |
| 70 ``` |
| 71 make android_arm.release -j16 |
| 72 adb push out/android_arm.release/d8 /data/local/tmp/v8/d8-version.under.test |
| 73 cp out/android_arm.release/d8 ./d8-version.under.test |
| 74 ``` |
| 75 * get a profiling log and copy it to the host: |
| 76 ``` |
| 77 adb shell /data/local/tmp/v8/d8-version.under.test benchmark.js --prof |
| 78 adb pull /data/local/tmp/v8/v8.log ./ |
| 79 ``` |
| 80 * open `v8.log` in your favorite editor and edit the first line to match the f
ull path of the `d8-version.under.test` binary on your workstation (instead of t
he `/data/local/tmp/v8/` path it had on the device) |
| 81 * run the tick processor with the host's `d8` and an appropriate `nm` binary: |
| 82 ``` |
| 83 cp out/ia32.release/d8 ./d8 # only required once |
| 84 tools/linux-tick-processor --nm=$ANDROID_NDK_ROOT/toolchain/bin/arm-linux-androi
deabi-nm |
| 85 ``` |
| 86 |
| 87 # Compile SpiderMonkey for Lollipop |
| 88 ``` |
| 89 cd firefox/js/src |
| 90 autoconf2.13 |
| 91 ./configure \ |
| 92 --target=arm-linux-androideabi \ |
| 93 --with-android-ndk=$ANDROID_NDK_ROOT \ |
| 94 --with-android-version=21 \ |
| 95 --without-intl-api \ |
| 96 --disable-tests \ |
| 97 --enable-android-libstdcxx \ |
| 98 --enable-pie |
| 99 make |
| 100 adb push -p js/src/shell/js /data/local/tmp/js |
| 101 ``` |
OLD | NEW |