Setting Up A Compile Environment

From MoKee Open Source Wiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
English • ‎日本語 • ‎中文(中国大陆)‎

You must have a 64-bit environment.

A Linux computer should have 8 GB RAM or more, otherwise build errors may occur.

Ubuntu 16.04

These instructions should work for other version of Ubuntu and most other Debian-based systems.

Install build packages

Open a terminal (ctrl + alt + t). First install the necessary packages; copy paste the code below and hit enter.

$ sudo apt-get update && sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven bc pngquant imagemagick yasm libssl-dev

Check your java version (it must be 1.8)

 javac -version

If it is 1.7, you MUST change it to 1.8

 sudo apt-get install openjdk-8-jdk

Get the MoKee Open Source code

~/mokee will be our build directory.

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

Add bin to PATH

 echo "export PATH=~/bin:$PATH" >> ~/.bashrc

Configure git:

 git config --global user.email "your@email.address"
 git config --global user.name "Your Name"

Move to build directory and sync the source code:

 cd ~/mokee
 repo init -u https://github.com/MoKee/android -b mkn-mr1
 repo sync -j4 -f --no-clone-bundle

(If the repo command is still not available, exit the terminal and start a new one so that your new PATH is registered.)

Let's configure ccache too. It will reduce the build time to 40% after first build

 echo "export USE_CCACHE=1" >> ~/.bashrc
 ~/mokee/prebuilts/misc/linux-x86/ccache/ccache -M 25G

25G means it will use upto 25 gb of disk space for ccaching. Atleast 10 gb is recommended. But if you want to compile for more devices, use more space for ccache.