-This project contains scripts and patches to cross compile and package packages for
-the [Termux](http://termux.com/) Android application.
-
-
-Overview
-========
-In a non-rooted Android device an app such as Termux may not write to system locations,
-which is why every package is installed inside the private file area of the Termux app:
- PREFIX=/data/data/com.termux/files/usr
-
-For simplicity while developing and building, the build scripts here assume that a /data
-folder is reserved for use on the host builder, which requires setup:
- sudo mkdir /data
- sudo chown $USER /data
-
-The basic flow is then to run "./build-package.sh $PKG", which
- - Sets up a patched stand-alone Android NDK toolchain
- - Reads packages/$PKG/build.sh to find out where to find the source code of the
- package and how to build it.
- - Applies all patches in packages/$PKG/\*.patch
- - Builds the package and installs it to $PREFIX
- - Packages the package in one or more .dpkg files for distribution
-Reading and following build-package.sh is the best way to understand what's going on here.
-
-Additional utilities are contained here:
- - build-all.sh, used for building all packages in the correct order (using buildorder.py)
- - check-pie.sh, used for verifying that all binaries are using PIE, which is required for Android 5+
- - check-versions.sh, used for checking for package updates
- - clean-rebuild-all.sh, used for doing a clean rebuild of all packages (takes a couple of hours)
- - list-packages.sh, used for listing all packages with a one-line summary
-
-
-Resources about cross-compiling packages
-========================================
-* [Linux From Scratch](http://www.linuxfromscratch.org/blfs/view/svn/index.html)
+[![Join the chat at https://gitter.im/termux/termux](https://badges.gitter.im/termux/termux.svg)](https://gitter.im/termux/termux)
+
+This project contains scripts and patches to build packages for the
+[Termux](https://termux.com/) Android application.
+
+License
+=======
+The scripts and patches to build each package is licensed under the same license as
+the actual package (so the patches and scripts to build bash are licensed under
+the same license as bash, while the patches and scripts to build python are licensed
+under the same license as python).
+
+Build environment on Ubuntu 16.04
+=================================
+Packages are built using Ubuntu 16.04. Perform the following steps to configure a Ubuntu 16.04 installation:
+
+- Run `scripts/setup-ubuntu.sh` to install required packages and setup the `/data/` folder.
+
+- Run `scripts/setup-android-sdk.sh` to install the Android SDK and NDK at `$HOME/lib/android-{sdk,ndk}`.
+
+Build environment using Docker
+==============================
+On other Linux distributions than Ubuntu 16.04 (or on other platforms than Linux) the best course
+of action is to setup a Docker container for building packages by executing:
+
+ ./scripts/run-docker.sh
+
+This will setup a container (from an image created by [scripts/Dockerfile](scripts/Dockerfile))
+suitable for building packages.
+
+This source folder is mounted as the /root/termux-packages data volume, so changes are kept
+in sync between the host and the container when trying things out before committing, and built
+deb files will be available on the host in the `debs/` directory just as when building on the host.
+
+Build commands can be given to be executed in the docker container directly:
+
+ ./scripts/run-docker.sh ./build-package.sh libandroid-support
+
+will launch the docker container, execute the `./build-package.sh libandroid-support`
+command inside it and afterwards return you to the host prompt, with the newly built
+deb in `debs/` to try out.
+
+Building a package
+==================
+The basic build operation is to run `./build-package.sh $PKG`, which:
+
+1. Sets up a patched stand-alone Android NDK toolchain if necessary.
+
+2. Reads `packages/$PKG/build.sh` to find out where to find the source code of the package and how to build it.
+
+3. Extracts the source in `$HOME/.termux-build/$PKG/src`.