Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: chromecast/build/chromecast_build_env.sh

Issue 223143003: Initial checkin of chromecast content embedder (cast_shell) and related build scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an additional function in gl_surface_cast.cc Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 function update_gyp() {
6 download_from_google_storage --no_resume --platform=linux* --no_auth \
7 --bucket chromium-gn -s ${CHROME_SRCROOT}/tools/gn/bin/linux/gn.sha1
8 ${CHROME_SRCROOT}/build/gyp_chromium $@
9 }
10
11 # This function adds a path (first argument) to the PATH if it is not already
12 # in the PATH.
13 function add_to_path_if_necessary() {
14 # Note that this variable is declared on a different line than its assignment
15 # so that $? from realpath is not clobbered.
16 local path_to_add=$1
17 local desired_path
18 desired_path=$(realpath "${path_to_add}")
19 local success=$?
20 if [ $success != 0 ]; then
21 return;
22 fi
23
24 for i in $(echo ${PATH} | tr ':' '\n'); do
25 if [[ "$i" == "$desired_path" ]] ; then
26 return
27 fi
28 done
29 export PATH="${desired_path}:${PATH}"
30 }
31
32 function setup_goma_or_ccache() {
33 local cc="$1"
34 local cxx="$2"
35
36 if [ -d "${GOMA_DIR}" ]; then
37 add_to_path_if_necessary "${GOMA_DIR}"
38 else
39 # Goma is not compatible with ccache.
40 if [[ "${USE_CCACHE}" = "1" ]]; then
41 # Only add ccache if it hasn't been added.
42 if [[ "${cc}" != ccache* ]]; then
43 export CC="ccache ${cc}"
44 fi
45 if [[ "${cxx}" != ccache* ]]; then
46 export CXX="ccache ${cxx}"
47 fi
48 export CC_host="gcc"
49 export CXX_host="g++"
50 fi
51 fi
52 }
53
54 function setup_build_toolchain() {
55 local base=""
56 if [ $# -eq 1 ]; then
57 base="${1%-}-"
58 elif [ $# -ne 0 ]; then
59 echo "setup_build_toolchain [build_base] "
60 echo "where build_base is the prefix of toolchain or could be empty"
61 echo "If build_base is empty, default toolchain(gcc and g++) will be used."
62 return
63 fi
64
65 export AR_target="${base}ar"
66 export CC_target="${base}gcc"
67 export CXX_target="${base}g++"
68 export LD_target="${base}g++"
69 export OBJCOPY_target="${base}objcopy"
70 export STRIP_target="${base}strip"
71
72 if [ ! -n "$CC" ]; then
73 export CC=gcc
74 fi
75 if [ ! -n "$CXX" ]; then
76 export CXX=g++
77 fi
78 export CC_host="gcc"
79 export CXX_host="g++"
80
81 setup_goma_or_ccache "${CC}" "${CXX}" "${CC_target}" "${CXX_target}"
82 }
83
84 function setup_chromium_env_common() {
85 if [ $# -lt 3 ]; then
86 echo "setup_env.sh out srcroot build_type "
87 echo "where out is the out directory to place the output of the build"
88 echo "where build_type can be Debug or Release"
89 echo "srcroot is the path of your source root"
90 return
91 fi
92
93 export CHROME_SRCROOT="$2"
94 local out="$1"
95 local type="$3"
96 if [[ "$3" == "Eng" ]]; then
97 export GYP_DEFINES="${GYP_DEFINES} dcheck_always_on=1"
98 local type="Release"
99 fi
100
101 if [ ! -d "${CHROME_SRCROOT}" ]; then
102 echo "CHROME_SRCROOT is not defined or not pointing to a directory : ${CHROM E_SRCROOT}"
103 return
104 fi
105
106 if [[ "${type}" != "Release" &&
107 "${type}" != "Debug" ]]; then
108 echo "Incorrect BUILDTYPE ${type}"
109 return
110 fi
111
112 # force the use of ninja.
113 export GYP_GENERATORS="ninja"
114 export UPDATE_GYP=update_gyp
115 export BUILD_OUT="out_${out}"
116 export GYP_GENERATOR_FLAGS="output_dir=${BUILD_OUT}"
117
118 export BUILDTYPE="${type}"
119
120 # This is normally run by gclient. It will end up running:
121 # "git log -1 --grep=git-svn-id --format=%b"
122 # to extract the svn change id in order to create the LASTCHANGE file.
123 python ${CHROME_SRCROOT}/build/util/lastchange.py -o \
124 ${CHROME_SRCROOT}/build/util/LASTCHANGE
125 python ${CHROME_SRCROOT}/build/util/lastchange.py \
126 -s ${CHROME_SRCROOT}/third_party/WebKit \
127 -o ${CHROME_SRCROOT}/build/util/LASTCHANGE.blink
128 }
129
130 function mymake() {
131 local type=${BUILDTYPE:-Debug}
132 ninja -C "${BUILD_OUT}/${type}" $@
133 }
134
135 function maketests() {
136 mymake base_unittests cacheinvalidation_unittests cast_receiver_unittests \
137 content_unittests crypto_unittests cast_service_unittests \
138 gpu_unittests ipc_tests jingle_unittests media_unittests net_unittests \
139 sandbox_linux_unittests sql_unittests sync_unit_tests ui_unittests \
140 url_unittests $@
141 }
142
143 # This function must be called last. It modifies GYP_DEFINES and CHROMIUM_BUILD
144 # so that the target is branded as an official Chrome build.
145 function brand_as_chrome() {
146 # - branding=Chrome : forces to use the Chrome assets instead of the Chromium
147 # assets. Important for strings that say 'Google Chrome is frozen' or the like
148 # - linux_dump_symbols=1 : forces the use of the dump symbol functionality,
149 # used for crash dumps.
150 local defines="\
151 branding=Chrome \
152 linux_dump_symbols=1 \
153 "
154 export GYP_DEFINES="${GYP_DEFINES} ${defines}"
155
156 # Force the build to be google-chrome. This actually only controls one thing
157 # as far as I can tell, when packaging the tar ball of the resulting build.
158 # All other parts to decide Chromium/Chrome come from the GYP defines. I
159 # did not find out why there are two variables that control the same thing.
160 export CHROMIUM_BUILD=_google_chrome
161 }
162
163 # Guard against someone running this script directly.
164 # It must be sourced (. gtv_tools/chrome_build_env.sh)
165 # instead, as it needs to set environment variables.
166 if [[ $(basename -- "$0") = chrome_build_env.sh ]]; then
167 echo ERROR: Must source this file, not execute it.
168 exit 1
169 fi
170
171 # Load all the target-specific build environments.
172 # We use ${BASH_SOURCE[0]} instead of $0, here, because
173 # this file is sourced instead of executed.
174 # Make sure to only source files with .sh extension, otherwise we end sourcing
175 # backing files, or other undesirable files.
176 SCRIPT_DIR=$(dirname -- "${BASH_SOURCE[0]}")
177 for source_file in "${SCRIPT_DIR}"/build_env_*.sh; do
178 source "$source_file"
179 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698