[Moto G General] Quasar:
Here's a little something for the guys (and flashaholics) who don't like to wait for devs to release new CM12 builds.

AFAIK ROMS CAN'T BE COMPILED ON 32 BIT SYSTEMS. ONLY 64 BIT.

YOU CAN USE ANY DISTRO YOU WANT. I USE UBUNTU 14.10 DUAL BOOTED, BUT THAT'S JUST A PERSONAL PREFERENCE.

We start with setting up the build environment:

First, start with installing this:

sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

Once that is done, we go about installing JDK-7 since that's the one that works for lollipop :p

sudo apt-get install openjdk-7-jdk

Then we install the Android SDK for some useful stuff:

sudo apt-get install android androidsdk-uiautomatorviewer android-copyright android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview

Once all that is dealt with, we can move on to the repo tool. That's what will get your CM repos syncing:

mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

and then, reboot to apply the changes.

Now for the interesting part

Not really, actually.

Time to yank the CM source code.

Create a working directory where you're going to sync all the sources and do the dirty stuff.

For this guide, we'll call the working directory "cm12"

Create the directory by running

mkdir cm12

enter your working directory by typing

cd cm12

Inititialize the repo by throwing in:

repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0

Wait for all the activity in the terminal to cease. And then type in:

repo sync

while the stuff is downloading, grab a ginger ale, or a cup of coffee and admire your handiwork. If you're the impatient type, find a generous dose of your favourite sedative, and knock yourself out for a few hours. When you're up again, you'll be faced with one of two things. Either your repos have synced successfully (yay!), or you get some nasty fetch errors. If it's the latter, then, Voila! You've just faced your first ever compiling frustration. Take some time out and break a few things, drive the neighbours crazy and then return to the PC and knock in:

repo sync -j1

This should (hopefully) work perfectly as long as you have an internet connection worth paying for. If not, then compiling probably isn't for you anyway.

Once all that stuff's over, create a folder called

local_manifests

in the .repo folder, and then make a new file in that folder called

roomservice.xml

open roomservice.xml using gedit, and add the following:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_motorola_falcon" path="device/motorola/falcon" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_device_motorola_msm8226-common" path="device/motorola/msm8226-common" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="github" revision="cm-12.0"/>
<project name="TheMuppets/proprietary_vendor_motorola" path="vendor/motorola" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" />
</manifest>

Then cd back to your working directory

cd ~/cm12

YOU'RE READY TO ROLL!

Finally, to build, type in:

. build/envsetup.sh && brunch falcon

If you have a really powerful PC, then use:

. build/envsetup.sh && brunch cm_falcon-userdebug -j8

And if you have a really really powerful PC, then use:

. build/envsetup.sh && brunch cm_falcon-userdebug -j16

Wait for the build to compile. Usually takes about 2-3 hours on an okay PC. You'll find your completed build in cm12/out/target/product/falcon.

The next time you want to build, run:

make clean
repo sync
. build/envsetup.sh
brunch falcon
.. and so on.

Happy Building!