/GNU-Utils-For-Android-Build-Script

Android Build Script For Various GNU Binaries

Primary LanguageShell

Deprecated - See here for the new build script

GNU Utils for Android Build Script

This will build any of the following static GNU binaries:
bash, bc (also includes dc), coreutils (has optional selinux support) (has openssl support) (includes advanced cp/mv - progress bar functionality), cpio, diffutils (includes cmp, diff, diff3, sdiff), ed, emacs, findutils (includes find, locate, updatedb, xargs), gawk (GNU awk), grep (also includes egrep and fgrep) (has full perl regex support), gzip (also includes gunzip and gzexe), ncurses (includes capconvert, clear, infocmp, tabs, tic, toe, tput, tset), patch, sed, tar

Build instructions

sudo apt install build-essential gcc-multilib libgnutls28-dev lzip # For debian/ubuntu based distributions - install equivalent dev tools and dependencies for yours
./build.bash --help # For more info on usage

Note

If mirrors.kernel.org is down, replace all instances of that in build script with ftp.gnu.org

Compatibility

The below table notes if the binary is compatible with android ndk, linaro, or gcc compilers. If static or dynamic is listed, then only that link method is working

NDK? Linaro? GCC?
bash Static Yes Yes
bc Yes Yes Yes
coreutils Yes Static Static
cpio Yes Yes Yes
diffutils Yes Yes Yes
ed Yes No No
findutils Yes Dynamic Dynamic
gawk Yes Yes Yes
grep Yes Yes Yes
gzip Yes Yes Yes
nano Static No No
ncurses Yes Yes Yes
patch Yes Yes Yes
sed Yes Yes Yes
tar Yes Yes Yes
  • Pwcat and Grcat (part of gawk) seg fault when ndk is used, compile without it to use them
  • Haven't tested nano outside of NDK much at this point
  • Coreutils won't build with selinux with dynamic link - static only

Dynamic link Issue

If the binary wasn't compiled with NDK, it'll have library depenencies on non existent libraries. Some of these can be remedied with symlinks to it (for example: libc.so -> libc.so.6) but some can't because no version of it exists on android (like libreadline). In the case of libdl, even if symlink is made, it still doesn't work oddly.

Credits

Credits for Bash and Patches

License

MIT