<commit_before># BUILDING external libs

Based on https://forum.getmonero.org/5/support/87643/building-monero-v0-10-3-1-for-android and the internet.

Do not follow this blindly. These instructions are for 32-bit only. 64-bit building mostly involves
replacing "32" with "64".

## Prepare Ubuntu environment

```
sudo apt-install build-essential cmake tofrodos
sudo mkdir /opt/android
sudo chown $LOGNAME /opt/android
```

## Install Android NDK
```
cd /opt/android
wget https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip
unzip android-ndk-r15c-linux-x86_64.zip
android-ndk-r15c/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch arm --install-dir /opt/android/tool32
```

## Build OpenSSL
Best is to compile openssl from sources. Copying from your phone or elsewhere (don't!) ends up in misery.

### Setup environment
```
cd /opt/android
wget https://wiki.openssl.org/images/7/70/Setenv-android.sh
fromdos Setenv-android.sh
```

Edit Setenv-android.sh:
```
_ANDROID_EABI="arm-linux-androideabi-4.9"
_ANDROID_API="android-21"
```
Then:
```<commit_msg>Update BUILDING-external-libs.md<commit_after># BUILDING external libs

Based on https://forum.getmonero.org/5/support/87643/building-monero-v0-10-3-1-for-android and the internet.

Do not follow this blindly. These instructions are for 32-bit only. 64-bit building mostly involves
replacing "32" with "64".

## Prepare Ubuntu environment

```
sudo apt-get install build-essential cmake tofrodos
sudo mkdir /opt/android
sudo chown $LOGNAME /opt/android
```

## Install Android NDK
```
cd /opt/android
wget https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip
unzip android-ndk-r15c-linux-x86_64.zip
android-ndk-r15c/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch arm --install-dir /opt/android/tool32
```

## Build OpenSSL
Best is to compile openssl from sources. Copying from your phone or elsewhere (don't!) ends up in misery.

### Setup environment
```
cd /opt/android
wget https://wiki.openssl.org/images/7/70/Setenv-android.sh
fromdos Setenv-android.sh
```

Edit Setenv-android.sh:
```
_ANDROID_EABI="arm-linux-androideabi-4.9"
_ANDROID_API="android-21"
```
Then:
```
{'fraction_non_alphanumeric': 0.13704206241519673, 'fraction_numerical': 0.03980099502487562, 'mean_word_length': 4.421568627450981, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '2859160', 'n_tokens_mistral': 870, 'n_tokens_neox': 776, 'n_words': 190}