`
yidongkaifa
  • 浏览: 4065103 次
文章分类
社区版块
存档分类
最新评论

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


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics