References to How-to, i summarize some major steps of it.

##1, Get the code The codes of chromium occupy about 20G spaces. So make sure you have enough spaces for it.

It is slow to download the code from google while in China, maybe you should use vsp at America to get the code.

The Enviroment here is ubuntu 13.10, an empty vps in linode(linode.com)
  1. “apt-get update”
  2. “apt-get install git”
  3. “apt-get install g++”
  4. “useradd -m -g root XXXX” to create a new account with the privilege of root
  5. “vim /etc/sudoers” and add the “XXXX ALL=(ALL:ALL) ALL” after the line of “root ALL=(ALL:ALL) ALL”

  6. “su XXXX”, and locate to its home directory
  7. “git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git”
  8. “export PATH=”$PATH”:`pwd`/depot_tools”
  9. “mkdir chromium” and locate to it
  10. “fetch –nohooks ios –nosvn=True” in iOS or “fetch –nohooks android –nosvn=True” in Android

##2, Compile for Android

After downloaded the code of android by command “fetch –nohooks android –nosvn=True”, now we need to configure by following steps:

  1. “apt-get install openjdk-7-jdk”
  2. “cd src”
  3. ”./build/install-build-deps-android.sh”
  4. “echo “{ ‘GYP_DEFINES’: ‘OS=android’ }” > chromum.gyp_env”
  5. “gclient sync –jobs 16”
  6. “gclient runhooks”

There must be no error occured if we want to continue, and here is the command to compile:

  1. “cd src”
  2. “ninja -C out/Release base”

We can compile any components we need, such as “base” or “net”, and the static library will be found in “src/out/Release”.

e.g such as "src/out/Release/obj/base/libbase.a"

##3, Compile fo iOS

For compiling chromium for iOS, we need a “OS X” platform. and the following steps:

  1. configure chromium.gyp_env with:

     { 
       'GYP_DEFINES': 'OS=ios',
       'GYP_GENERATOR_FLAGS': 'xcode_project_version=3.2',
       'GYP_GENERATORS': 'xcode',
     }
    
  2. “gclient sync –force –jobs 4”
  3. “gclient runhooks”
  4. “xcodebuild -project src/base/base.xcodeproj -target “base” -configuration Release -sdk -iphoneos build” for base building


Like android’s building, we can build any components we need, and the static library will be found in “src/xcodebuild/Release-iphoneos/libbase.a”



评论需要翻墙 for disqus