OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 set -eu | |
7 | |
8 supported_build_types="msan-no-origins msan-chained-origins" | |
9 supported_releases="precise trusty" | |
10 ubuntu_release=$(lsb_release -cs) | |
11 | |
12 function show_help { | |
13 echo "Usage: build_and_package.sh <build_type>" | |
14 echo "Supported build types: all ${supported_build_types}" | |
15 } | |
16 | |
17 function build_libraries { | |
18 local build_type=$1 | |
19 case ${build_type} in | |
20 "msan-chained-origins") | |
21 local gyp_defines="msan=1 msan_track_origins=2" | |
22 ;; | |
23 "msan-no-origins") | |
24 local gyp_defines="msan=1 msan_track_origins=0" | |
25 ;; | |
26 *) | |
27 show_help | |
28 exit 1 | |
29 ;; | |
30 esac | |
31 | |
32 local archive_name=${build_type}-${ubuntu_release} | |
33 local out_dir=out_${archive_name} | |
34 | |
35 echo "Building instrumented libraries in ${out_dir}..." | |
36 | |
37 rm -rf $out_dir | |
38 mkdir $out_dir | |
39 | |
40 GYP_DEFINES="${gyp_defines} use_instrumented_libraries=1 instrumented_librarie s_jobs=8" \ | |
41 GYP_GENERATOR_FLAGS="output_dir=${out_dir}" \ | |
42 gclient runhooks | |
43 | |
44 ninja -C ${out_dir}/Release instrumented_libraries | |
45 | |
46 echo "Creating archive ${archive_name}.tgz..." | |
47 | |
48 files=$(ls -1 ${out_dir}/Release/instrumented_libraries) | |
49 | |
50 tar zcf ${archive_name}.tgz -C ${out_dir}/Release/instrumented_libraries --exc lude="?san/*.txt" ${files} | |
51 | |
52 echo To upload, run: | |
53 echo upload_to_google_storage.py -b chromium-instrumented-libraries ${archive_ name}.tgz | |
Alexander Potapenko
2015/03/25 13:10:34
Mind the line length.
earthdok
2015/03/25 13:24:09
Done.
| |
54 echo You should then commit the resulting .sha1 file. | |
55 } | |
56 | |
57 if ! [[ "${supported_releases}" =~ ${ubuntu_release} ]] | |
58 then | |
59 echo "Unsupported Ubuntu release: ${ubuntu_release}" | |
Alexander Potapenko
2015/03/25 13:10:34
echo "Supported releases: ..."
earthdok
2015/03/25 13:24:09
Done.
| |
60 exit 1 | |
61 fi | |
62 | |
63 if [ -z "${1-}" ] | |
64 then | |
65 show_help | |
66 exit 0 | |
67 fi | |
68 | |
69 if ! [[ "all ${supported_build_types}" =~ $1 ]] | |
70 then | |
71 show_help | |
72 exit 1 | |
73 fi | |
74 if [ "$1" == "all" ] | |
75 then | |
76 for build_type in ${supported_build_types} | |
77 do | |
78 build_libraries ${build_type} | |
79 done | |
80 else | |
81 build_libraries $1 | |
82 fi | |
83 | |
OLD | NEW |