Set Up a Build Environment in Just a Few Seconds
To build your very own source-built custom ROM, you need Linux or OS X running natively or through a virtual machine . But even most fully fledged distros can’t build Android without installing some dependencies. The only exception might be BBQLinux by XDA Senior Recognized Developer codeworkx.
A few weeks ago, we talked about scripts to build a ROM or kernel easily. Since then, this project has expanded. If you run Ubuntu, Arch, or a spin-off like Xubuntu, Lubuntu, or Manjaro, you are probably looking for an easy way to set up this build environment without googling which packages should be installed. Luckily, XDA Forum Moderator laufersteppenwolf wrote a simple BASH script that does all the work for you.
This script automatically detects your Linux distro and uses the appropriate package manager (APT or AUR) to get the necessary files and install them. It also takes care about Java and installs Open JDK or the JDK from Oracle. With a few quick and easy edits described in the thread OP, you can add your favorite packages or simply make your time during compiling less boring.
You can find the setup scripts, as well as other useful tools for ROM builders in the original thread.