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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/build/chromecast_build_env.sh
diff --git a/chromecast/build/chromecast_build_env.sh b/chromecast/build/chromecast_build_env.sh
new file mode 100644
index 0000000000000000000000000000000000000000..47618e543e5c900f4b41d7045ee5200684d912d5
--- /dev/null
+++ b/chromecast/build/chromecast_build_env.sh
@@ -0,0 +1,179 @@
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+function update_gyp() {
+ download_from_google_storage --no_resume --platform=linux* --no_auth \
+ --bucket chromium-gn -s ${CHROME_SRCROOT}/tools/gn/bin/linux/gn.sha1
+ ${CHROME_SRCROOT}/build/gyp_chromium $@
+}
+
+# This function adds a path (first argument) to the PATH if it is not already
+# in the PATH.
+function add_to_path_if_necessary() {
+ # Note that this variable is declared on a different line than its assignment
+ # so that $? from realpath is not clobbered.
+ local path_to_add=$1
+ local desired_path
+ desired_path=$(realpath "${path_to_add}")
+ local success=$?
+ if [ $success != 0 ]; then
+ return;
+ fi
+
+ for i in $(echo ${PATH} | tr ':' '\n'); do
+ if [[ "$i" == "$desired_path" ]] ; then
+ return
+ fi
+ done
+ export PATH="${desired_path}:${PATH}"
+}
+
+function setup_goma_or_ccache() {
+ local cc="$1"
+ local cxx="$2"
+
+ if [ -d "${GOMA_DIR}" ]; then
+ add_to_path_if_necessary "${GOMA_DIR}"
+ else
+ # Goma is not compatible with ccache.
+ if [[ "${USE_CCACHE}" = "1" ]]; then
+ # Only add ccache if it hasn't been added.
+ if [[ "${cc}" != ccache* ]]; then
+ export CC="ccache ${cc}"
+ fi
+ if [[ "${cxx}" != ccache* ]]; then
+ export CXX="ccache ${cxx}"
+ fi
+ export CC_host="gcc"
+ export CXX_host="g++"
+ fi
+ fi
+}
+
+function setup_build_toolchain() {
+ local base=""
+ if [ $# -eq 1 ]; then
+ base="${1%-}-"
+ elif [ $# -ne 0 ]; then
+ echo "setup_build_toolchain [build_base] "
+ echo "where build_base is the prefix of toolchain or could be empty"
+ echo "If build_base is empty, default toolchain(gcc and g++) will be used."
+ return
+ fi
+
+ export AR_target="${base}ar"
+ export CC_target="${base}gcc"
+ export CXX_target="${base}g++"
+ export LD_target="${base}g++"
+ export OBJCOPY_target="${base}objcopy"
+ export STRIP_target="${base}strip"
+
+ if [ ! -n "$CC" ]; then
+ export CC=gcc
+ fi
+ if [ ! -n "$CXX" ]; then
+ export CXX=g++
+ fi
+ export CC_host="gcc"
+ export CXX_host="g++"
+
+ setup_goma_or_ccache "${CC}" "${CXX}" "${CC_target}" "${CXX_target}"
+}
+
+function setup_chromium_env_common() {
+ if [ $# -lt 3 ]; then
+ echo "setup_env.sh out srcroot build_type "
+ echo "where out is the out directory to place the output of the build"
+ echo "where build_type can be Debug or Release"
+ echo "srcroot is the path of your source root"
+ return
+ fi
+
+ export CHROME_SRCROOT="$2"
+ local out="$1"
+ local type="$3"
+ if [[ "$3" == "Eng" ]]; then
+ export GYP_DEFINES="${GYP_DEFINES} dcheck_always_on=1"
+ local type="Release"
+ fi
+
+ if [ ! -d "${CHROME_SRCROOT}" ]; then
+ echo "CHROME_SRCROOT is not defined or not pointing to a directory : ${CHROME_SRCROOT}"
+ return
+ fi
+
+ if [[ "${type}" != "Release" &&
+ "${type}" != "Debug" ]]; then
+ echo "Incorrect BUILDTYPE ${type}"
+ return
+ fi
+
+ # force the use of ninja.
+ export GYP_GENERATORS="ninja"
+ export UPDATE_GYP=update_gyp
+ export BUILD_OUT="out_${out}"
+ export GYP_GENERATOR_FLAGS="output_dir=${BUILD_OUT}"
+
+ export BUILDTYPE="${type}"
+
+ # This is normally run by gclient. It will end up running:
+ # "git log -1 --grep=git-svn-id --format=%b"
+ # to extract the svn change id in order to create the LASTCHANGE file.
+ python ${CHROME_SRCROOT}/build/util/lastchange.py -o \
+ ${CHROME_SRCROOT}/build/util/LASTCHANGE
+ python ${CHROME_SRCROOT}/build/util/lastchange.py \
+ -s ${CHROME_SRCROOT}/third_party/WebKit \
+ -o ${CHROME_SRCROOT}/build/util/LASTCHANGE.blink
+}
+
+function mymake() {
+ local type=${BUILDTYPE:-Debug}
+ ninja -C "${BUILD_OUT}/${type}" $@
+}
+
+function maketests() {
+ mymake base_unittests cacheinvalidation_unittests cast_receiver_unittests \
+ content_unittests crypto_unittests cast_service_unittests \
+ gpu_unittests ipc_tests jingle_unittests media_unittests net_unittests \
+ sandbox_linux_unittests sql_unittests sync_unit_tests ui_unittests \
+ url_unittests $@
+}
+
+# This function must be called last. It modifies GYP_DEFINES and CHROMIUM_BUILD
+# so that the target is branded as an official Chrome build.
+function brand_as_chrome() {
+ # - branding=Chrome : forces to use the Chrome assets instead of the Chromium
+ # assets. Important for strings that say 'Google Chrome is frozen' or the like
+ # - linux_dump_symbols=1 : forces the use of the dump symbol functionality,
+ # used for crash dumps.
+ local defines="\
+branding=Chrome \
+linux_dump_symbols=1 \
+"
+ export GYP_DEFINES="${GYP_DEFINES} ${defines}"
+
+ # Force the build to be google-chrome. This actually only controls one thing
+ # as far as I can tell, when packaging the tar ball of the resulting build.
+ # All other parts to decide Chromium/Chrome come from the GYP defines. I
+ # did not find out why there are two variables that control the same thing.
+ export CHROMIUM_BUILD=_google_chrome
+}
+
+# Guard against someone running this script directly.
+# It must be sourced (. gtv_tools/chrome_build_env.sh)
+# instead, as it needs to set environment variables.
+if [[ $(basename -- "$0") = chrome_build_env.sh ]]; then
+ echo ERROR: Must source this file, not execute it.
+ exit 1
+fi
+
+# Load all the target-specific build environments.
+# We use ${BASH_SOURCE[0]} instead of $0, here, because
+# this file is sourced instead of executed.
+# Make sure to only source files with .sh extension, otherwise we end sourcing
+# backing files, or other undesirable files.
+SCRIPT_DIR=$(dirname -- "${BASH_SOURCE[0]}")
+for source_file in "${SCRIPT_DIR}"/build_env_*.sh; do
+ source "$source_file"
+done

Powered by Google App Engine
This is Rietveld 408576698