<commit_before># Instructions for building the Gonk port

## Set up an android toolchain and NDK

Follow the steps [here](https://github.com/servo/servo/wiki/Building-for-Android) for setting up the Android NDK
and toolchain.
## Build B2G

Note: this will take a long time and will take around 20GB of space

Disable the screen timeout on the device, and connect to wifi. Also connect it to your computer
with remote debugging enabled.

```
git clone https://github.com/mozilla-b2g/B2G
./config.sh flame-kk
```

If behind a firewall, put the following in your gitconfig:

```
[url "https://github"]
        insteadOf = git://github
[url "https://git.mozilla.org/external/caf"]
    insteadOf = git://codeaurora.org
```
Then run

```
./build.sh libssl libsuspend libz libGLESv2 toolbox libhardware
```

## Build B2S

Either set the corresponding `b2g` key in `.servobuild` to the path to the B2G clone (along with), or set the `$GONKDIR`
environment variable.

Do the same for the `ndk` and `toolchain` keys (`$ANDROID_NDK` and `$ANDROID_TOOLCHAIN` respectively)

Run `./mach build-gonk` from the root directory


## Copy the files to the Flame

To reduce the size of libmozjs.so (`ports/gonk/target/arm-linux-androideabi/build/mozjs-sys-*/out/libmozjs.so`),<commit_msg>Update Gonk README with bootstrap information<commit_after># Instructions for building the Gonk port

## Set up an android toolchain and NDK

Follow the steps [here](https://github.com/servo/servo/wiki/Building-for-Android) for setting up the Android NDK
and toolchain.

## Bootstrap B2G

We have a bootstrap of the require B2G prebuilt binaries, assuming that you are targeting a Flame device.

```
curl https://servo-rust.s3.amazonaws.com/B2G/B2G.tgz
tar zxvf B2G.tgz
```

## Build B2G

If you are not using a Flame or just would like to have a local build of the binaries, you can also build B2G locally. Note: this will take a long time and will take around 20GB of space

Disable the screen timeout on the device, and connect to wifi. Also connect it to your computer
with remote debugging enabled.

```
git clone https://github.com/mozilla-b2g/B2G
./config.sh flame-kk
```

If behind a firewall, put the following in your gitconfig:

```
[url "https://github"]
        insteadOf = git://github
[url "https://git.mozilla.org/external/caf"]
    insteadOf = git://codeaurora.org
```
Then run

```
./build.sh libssl libsuspend libz libGLESv2 toolbox libhardware
```

## Build B2S

Either set the corresponding `b2g` key in `.servobuild` to the path to the B2G bootstrap or clone (along with), or set the `$GONKDIR` environment variable.

Do the same for the `ndk` and `toolchain` keys (`$ANDROID_NDK` and `$ANDROID_TOOLCHAIN` respectively)

Run `./mach build-gonk` from the root directory


## Copy the files to the Flame

To reduce the size of libmozjs.so (`ports/gonk/target/arm-linux-androideabi/build/mozjs-sys-*/out/libmozjs.so`),
{'fraction_non_alphanumeric': 0.10430292598967297, 'fraction_numerical': 0.008605851979345954, 'mean_word_length': 4.089316987740806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4512946', 'n_tokens_mistral': 985, 'n_tokens_neox': 934, 'n_words': 362}