rebol/rebol — pull request #191 by earl (2014-02-24 19:50:07+00:00)
Title: Build CLI binaries for Android

This is a slightly modified version (and replacement) of @giuliolunati's #190 adding a `4.21` build target for "Android CLI" binaries.

__Why is that a "Linux" number?__ Underneath, Android is a Linux with a different libc (called Bionic). As such, the CLI binary is much more Linux-like and distinct from a "proper" Android GUI application (.apk; for which we'd have the 13.x platform numbers reserved).

With these changes, @giuliolunati, @BrianHawley, and myself independently managed to build natively on Android directly and/or cross-compile for Android with the NDK.

**Cross-compilation: Build steps I used with the Android NDK r9c-1**

This needs a pre-built `r3-make` binary already in the `make/` folder, for the `make prep` step.

0. `export NDKROOT=/opt/android-ndk` - a custom environment variable I set to point to my NDK install
1. `export TOOLCHAIN=$NDKROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/` - a custom environment variable to point to the NDK toolchain I want to use
2. `make make OS_ID=0.4.21`
3. `make prep`
4. Build R3 with custom TOOLS, INCL, and CC settings:

```
make \
TOOLS=$TOOLCHAIN/bin/arm-linux-androideabi- \
INCL=$TOOLCHAIN/include/ \
CC="$TOOLCHAIN/bin/arm-linux-androideabi-gcc --sysroot=$NDKROOT/platforms/android-14/arch-arm/"
```

**Native on-target compilation: Build steps I used on an Android device with TerminalIDE**

This needs a pre-built `r3-make` Android CLI binary already in the `make/` folder, for the `make prep` step. That can initially via obtained by cross-compilation.

0. `make make OS_ID=0.4.21`
1. `make prep`
2. `make CC=terminal-gcc TOOLS=arm-eabi-`

Thanks to @giuliolunati and @BrianHawley for their work on getting this built!