[Samsung Galaxy S (4G Model)] Fluidification:
GITHUB servers are up!

So I finally thought that I should make a guide to build from source as I feel like the one on the wiki is a bit outdated and isn't very clear.

I will cover both instructions for how to build for Ubuntu 13.04 (64 bit only), and OS X 10.8.x(PLEASE KEEP AT LEAST 35GB Free)

LINUX SPECIFIC INSTRUCTIONS

Please open a terminal window NOW. If you can't do this, don't build android. Please be vigilant in following in-terminal directions, such as pressing enter if it's asking you to do so or confirm something, and using sudo before a command will invoke a password prompt also if entering a new command, please wait until the command exits out to the bash prompt (asking for a new command)

First, let's get rid of the wrong java assuming it's already installed, Android will "REFUSE" to build properly with the wrong java.

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

Now let's install the correct java,

sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java6-installer && java -version

It should end with this

java version "1.6.0_37"

Java(TM) SE Runtime Environment (build 1.6.0_37-b06)

Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)

or something like it.

Now let's set up for making bacon!

Enter this in order to get dependencies for building android, please note that this is about 100-150 megs and will take a few minutes/10ish minutes depending on your computer and internet connection.

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python

then,

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Repo is required for sucking sources from the cloud, so let's get it

mkdir ~/bin && curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo && chmod a+x ~/bin/repo

Now let's add this repo thing to our path

sudo nano ~/.bashrc

at the bottom of the file,add this

export PATH=~/bin:$PATH

now press Ctrl-O followed by Ctrl-X

restart bash by entering

source ~/.bashrc

now find a directory to build android in. Personally, I use /home/username/android

so for now let's place it in there

mkdir ~/android && cd ~/android && mkdir cm && cd cm

SYNC TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!x10^infinity!

repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 && mkdir -p .repo/local_manifests && curl https://raw.github.com/teamuserdebug/page/manifests/manifests/cm10.1-aries.xml > .repo/local_manifests/local_manifest.xml && repo sync

make sure you acknowledge name, color, email etc, or you'll be sitting around and wasting time. this can take anywhere from 1 hr to 1 week depending on your internet connection, personally takes me 3-5 hrs.

go grab a starbucks and come back, you'll need it.

after it's done, make sure you are still in your cm directory.

IT'S BUILDING TIME

OPTIONAL: If you have some free space sitting around eg, 70-100 gigs for building android,

it's time to setup CCACHE, this speeds up future builds by "A LOT"

first edit .bashrc

sudo nano ~/.bashrc

add these lines at the bottom

export CCACHE_DIR=/home/-username-/.ccache

(Note, replace "-username-" with your computer username, without the dashes.

export USE_CCACHE=1

press Ctrl-O followed by Ctrl-X

enter

[CODE]source ~/.bashrc

[/CODE]

now enable ccache by entering

prebuilts/misc/linux-x86/ccache/ccache -M50

or

./prebuilts/misc/linux-x86/ccache/ccache -M50

if the first one doesn't work

BUILD TIME:

enter these

cd ~/android/cm

vendor/cm/get-prebuilts

. build/envsetup.sh

lunch cm_galaxys4gmtd-userdebug

mka clobber

mka bacon

It will be in ~/android/cm/out/products/target/galaxys4gmtd/cm-unofficial-something-something-signed.zip or something like that.

Make sure you don't pick the wrong zip file, because there are 2 or 3 in there.

OS X 10.8.x SPECIFIC INSTRUCTIONS

Please open a terminal window NOW. If you can't do this, don't build android. Please be vigilant in following in-terminal directions, such as pressing enter if it's asking you to do so or confirm something, and using sudo before a command will invoke a password prompt also if entering a new command, please wait until the command exits out to the bash prompt (asking for a new command)

First, let's install java if it's not already installed

java

Now, we MUST install X-Code otherwise we won't even be able to lunch.

1. Open the App Store

2. Find X-Code,(it's free) and install it [this is a 1+ GB download, and install]

3.Open X-Code and go to preferences. There you find a 'Downloads' tab. Open it and install “Command line tools” It will take a few minutes to download and install

Now let's set up for making bacon!

Download and install MacPorts, not Homebrew, since MacPorts is faster.

You can get the mountain lion pkg installer here

After it is installed, close and open terminal.

edit your bash profile

sudo nano ~/.bash_profile

add

export BUILD_MAC_SDK_EXPERIMENTAL=1

somewhere at the bottom

Press Ctrl-X, then y, then "enter/return" Note: Yes, the control key is used, not the command key, so don't be confused

Install dependencies to make bacon

POSIXLY_CORRECT=1 sudo port install git-core coreutils findutils gsed gnupg pngcrush repo

then

sudo ln -s /opt/local/bin/gfind /opt/local/bin/find && ln -s /opt/local/bin/gsed /opt/local/bin/sed

run

pngcrush

in terminal to make sure that things are properly in your path

THEY SHOULD BE since MacPorts edits your .bash_profile for you.

Now, we need a case-sensitive folder so we will need to make a sparseimage which you will have to mount every time you want to do something with your android builds.(like a DMG), but for now, this command will attach it for you. It will be on your desktop

hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android

Make the cm folder

cd /Volumes/Android && mkdir cm && cd cm

SYNC TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!x10^infinity!

repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1 && mkdir -p .repo/local_manifests && curl https://raw.github.com/teamuserdebug/page/manifests/manifests/cm10.1-aries.xml > .repo/local_manifests/local_manifest.xml && repo sync

make sure you acknowledge name, color, email etc, or you'll be sitting around and wasting time. this can take anywhere from 1 hr to 1 week depending on your internet connection, personally takes me 3-5 hrs.

go grab a starbucks and come back, you'll need it.

after it's done, make sure you are still in your cm directory.

Before we build, we have to fix an elf.h error

cp /Volumes/android/cm/external/elfutils/libelf/elf.h /usr/local/include

IT'S BUILDING TIME

OPTIONAL: If you have some free space sitting around eg, 70-100 gigs for building android,

it's time to setup CCACHE, this speeds up future builds by "A LOT"

install a ccache which is usable by mac

sudo port install ccache

edit your bash profile to use ccache.

sudo nano ~/.bash_profile

find the line that says

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

and edit it to say

export PATH=/opt/local/libexec/ccache:/opt/local/bin:/opt/local/sbin:$PATH

press Ctrl-X, then y, then "enter/return"

then exit and reopen terminal

now configure ccache's memory

ccache -M50

BUILD TIME:

enter these

cd ~/android/cm

vendor/cm/get-prebuilts

. build/envsetup.sh

lunch cm_galaxys4gmtd-userdebug

mka clobber

mka bacon

It will be in /Volumes/android/cm/out/products/target/galaxys4gmtd/cm-unofficial-something-something-signed.zip or something like that.

Make sure you don't pick the wrong zip file, because there are 2 or 3 in there