content_shell building analisis

We built content_shell.apk with following commands:

export GYP_GENERATORS=ninja
. build/android/envsetup.sh
android_gyp
ninja -C out/Debug -j10 content_shell_apk
Now we start to analyze what are these command doing:

. build/android/envsetup.sh 
this line did mainly these things:

. "$(dirname $BASH_SOURCE)"/envsetup_functions.sh defined toolchain, gcc version and path of SDK and NDK tools.

defined shell functions android_gyp as an example.


android_gyp
# Performs a gyp_chromium run to convert gyp->Makefile for android code.
android_gyp() {
  # This is just a simple wrapper of gyp_chromium, please don't add anything
  # in this function.
  echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
  (
    "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
  )
}

ninja -C out/Debug -j10 content_shell_apk

we need to find out what is ninja:

$ which ninja
/home/zeus/Public/depot_tools/ninja
then we open it:

#!/bin/bash

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

OS="$(uname -s)"
THIS_DIR="$(dirname "${0}")"

function print_help() {
cat <<-EOF
No prebuilt ninja binary was found for this system.
Try building your own binary by doing:
  cd ~
  git clone https://github.com/martine/ninja.git -b v1.0.0
  ./ninja/bootstrap.py
Then add ~/ninja/ to your PATH.
EOF
}

case "$OS" in
  Linux)
    MACHINE=$(getconf LONG_BIT)
    case "$MACHINE" in
      32|64)  exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";;
      *)      echo Unknown architecture \($MACHINE\) -- unable to run ninja.
              print_help
              exit 1;;
    esac
    ;;
  Darwin)    exec "${THIS_DIR}/ninja-mac" "$@";;
  CYGWIN*)   exec cmd.exe /c $(cygpath -t windows $0).exe "$@";;
  MINGW32*)  cmd.exe //c $0.exe "$@";;
  *)         echo "Unsupported OS ${OS}"
             print_help
             exit 1;;
esac

as we can see ninjia-linux${MACHINE} works just like make, ant it is actually an executable binary:

$ ls /home/zeus/Public/depot_tools/ninja*
/home/zeus/Public/depot_tools/ninja      /home/zeus/Public/depot_tools/ninja-linux32  /home/zeus/Public/depot_tools/ninja-mac
/home/zeus/Public/depot_tools/ninja.exe  /home/zeus/Public/depot_tools/ninja-linux64

more about ninja:

http://code.google.com/p/chromium/wiki/NinjaBuild


the source code location of content_shell.apk:

content/shell/android/shell_apk


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值