OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 # Script for building our own custom Chrome | |
8 | |
9 # Load common constants. This should be the first executable line. | |
10 # The path to common.sh should be relative to your script's location. | |
11 . "$(dirname "$0")/common.sh" | |
12 | |
13 # Script must be run outside the chroot | |
14 assert_outside_chroot | |
15 | |
16 # This script defaults Chrome source is in ~/chrome | |
17 # You may override the Chrome source dir via the --chrome_dir option or by | |
18 # setting CHROMEOS_CHROME_DIR (for example, in ./.chromeos_dev) | |
19 DEFAULT_CHROME_DIR="${CHROMEOS_CHROME_DIR:-/home/$USER/chrome}" | |
20 | |
21 # The number of jobs to pass to tools that can run in parallel (such as make | |
22 # and dpkg-buildpackage | |
23 NUM_JOBS=`grep -c "^processor" /proc/cpuinfo` | |
24 | |
25 # Flags | |
26 DEFINE_string chrome_dir "$DEFAULT_CHROME_DIR" \ | |
27 "Directory to Chrome/Chromium source" | |
28 DEFINE_string mode "Release" \ | |
29 "The mode to build Chrome/Chromium in (Debug or Release)" | |
30 DEFINE_string num_jobs "$NUM_JOBS" \ | |
31 "The number of jobs to run in parallel" | |
32 DEFINE_boolean runhooks true \ | |
33 "Execute gclient runhooks before build (if norunhooks then chrome and official
are ignored)" | |
34 DEFINE_boolean chrome false \ | |
35 "Builds a chrome branded version (requires src-internal)" | |
36 DEFINE_boolean official false \ | |
37 "Builds an official version (additional optimizations)" | |
38 | |
39 # Parse command line | |
40 FLAGS "$@" || exit 1 | |
41 eval set -- "${FLAGS_ARGV}" | |
42 | |
43 # Die on error; print commands | |
44 set -e | |
45 | |
46 # Convert args to paths. Need eval to un-quote the string so that shell | |
47 # chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work. | |
48 FLAGS_chrome_dir=`eval readlink -f $FLAGS_chrome_dir` | |
49 | |
50 # Build Chrome | |
51 echo Building Chrome in mode $FLAGS_mode | |
52 export GYP_GENERATORS="make" | |
53 export GYP_DEFINES="target_arch=ia32 chromeos=1" | |
54 | |
55 if [ $FLAGS_chrome -eq $FLAGS_TRUE ] | |
56 then | |
57 export GYP_DEFINES="${GYP_DEFINES} branding=Chrome ffmpeg_branding=Chrome" | |
58 fi | |
59 | |
60 if [ $FLAGS_official -eq $FLAGS_TRUE ] | |
61 then | |
62 export GYP_DEFINES="${GYP_DEFINES} buildtype=Official" | |
63 fi | |
64 | |
65 CHROME_DIR=$FLAGS_chrome_dir | |
66 cd "$CHROME_DIR/src" | |
67 | |
68 if [ $FLAGS_runhooks -eq $FLAGS_TRUE ] | |
69 then | |
70 gclient runhooks --force | |
71 fi | |
72 | |
73 make BUILDTYPE=$FLAGS_mode -j$FLAGS_num_jobs -r chrome candidate_window | |
74 | |
75 # Zip into chrome-chromeos.zip and put in local_assets | |
76 BUILD_DIR="$CHROME_DIR/src/out" | |
77 CHROME_LINUX_DIR="$BUILD_DIR/chrome-chromeos" | |
78 OUTPUT_DIR="${SRC_ROOT}/build/x86/local_assets" | |
79 OUTPUT_ZIP="$BUILD_DIR/chrome-chromeos.zip" | |
80 if [ -n "$OUTPUT_DIR" ] | |
81 then | |
82 mkdir -p $OUTPUT_DIR | |
83 fi | |
84 # create symlink so that we can create the zip file with prefix chrome-chromeos | |
85 rm -f $CHROME_LINUX_DIR | |
86 ln -s $BUILD_DIR/$FLAGS_mode $CHROME_LINUX_DIR | |
87 | |
88 echo Zipping $CHROME_LINUX_DIR to $OUTPUT_ZIP | |
89 cd $BUILD_DIR | |
90 rm -f $OUTPUT_ZIP | |
91 zip -r1 $OUTPUT_ZIP chrome-chromeos -i \ | |
92 "chrome-chromeos/chrome" \ | |
93 "chrome-chromeos/chrome.*" \ | |
94 "chrome-chromeos/chrome-*" \ | |
95 "chrome-chromeos/candidate_window" \ | |
96 "chrome-chromeos/libffmpegsumo.so" "chrome-chromeos/xdg-settings" \ | |
97 "chrome-chromeos/locales/*" "chrome-chromeos/resources/*" \ | |
98 "chrome-chromeos/*.png" "chrome-chromeos/session" \ | |
99 "chrome-chromeos/emit_login_prompt_ready" -x "*.d" | |
100 cp -f $OUTPUT_ZIP $OUTPUT_DIR | |
101 echo Done. | |
OLD | NEW |