# build lineage os 16 4 chiron

# install all the fine stuff ...
sudo apt update && sudo apt full-upgrade -y && sudo apt install -y bc build-essential ccache curl g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop m4 openjdk-8-jdk pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-dev libncurses5 libtinfo5 nano

# build dir
mkdir -p ~/android/lineage && cd android/lineage
 
# setup git
git config --global user.email "mail@mail.com" && git config --global user.name "iamsosexy"

# init and download repo
repo init -u https://github.com/LineageOS/android.git -b lineage-16.0

# sync repos
repo sync -c -j8 --force-sync --no-clone-bundle --no-tags

# setup build env
source build/envsetup.sh
breakfast chiron

# insert the muppet blobs to ~/anddroid/lineage/.repo/local_manifest/roomservice.xml
sed -i '/^<\/manifest>/i <project name="TheMuppets/proprietary_vendor_xiaomi" path="vendor/xiaomi" remote="github" />' ~/android/lineage/.repo/local_manifests/roomservice.xml

# resync repo to get the muppet blobs
repo sync -c -j8 --force-sync --no-clone-bundle --no-tags

# speed up building
export USE_CCACHE=1
ccache -M 25G

# lets go ...
source build/envsetup.sh
breakfast chiron
brunch chiron