Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / instrumented_libraries / scripts / build_and_package.sh
blob0de0c914dfebf74802e7148817bbb667e85240af
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.
6 set -eu
8 supported_build_types="msan-no-origins msan-chained-origins"
9 supported_releases="precise trusty"
10 ubuntu_release=$(lsb_release -cs)
12 function show_help {
13 echo "Usage: build_and_package.sh <build_type>"
14 echo "Supported build types: all ${supported_build_types}"
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"
23 "msan-no-origins")
24 local gyp_defines="msan=1 msan_track_origins=0"
27 show_help
28 exit 1
30 esac
32 local archive_name=${build_type}-${ubuntu_release}
33 local out_dir=out-${archive_name}
35 echo "Building instrumented libraries in ${out_dir}..."
37 rm -rf $out_dir
38 mkdir $out_dir
40 GYP_DEFINES="${gyp_defines} \
41 use_instrumented_libraries=1 instrumented_libraries_jobs=8" \
42 GYP_GENERATOR_FLAGS="output_dir=${out_dir}" \
43 gclient runhooks
45 ninja -j4 -C ${out_dir}/Release instrumented_libraries
47 echo "Creating archive ${archive_name}.tgz..."
49 files=$(ls -1 ${out_dir}/Release/instrumented_libraries)
51 tar zcf ${archive_name}.tgz -C ${out_dir}/Release/instrumented_libraries \
52 --exclude="?san/*.txt" ${files}
54 echo To upload, run:
55 echo upload_to_google_storage.py -b \
56 chromium-instrumented-libraries ${archive_name}.tgz
57 echo You should then commit the resulting .sha1 file.
60 if ! [[ "${supported_releases}" =~ ${ubuntu_release} ]]
61 then
62 echo "Unsupported Ubuntu release: ${ubuntu_release}"
63 echo "Supported releases: ${supported_releases}"
64 exit 1
67 if [ -z "${1-}" ]
68 then
69 show_help
70 exit 0
73 if ! [[ "all ${supported_build_types}" =~ $1 ]]
74 then
75 show_help
76 exit 1
78 if [ "$1" == "all" ]
79 then
80 for build_type in ${supported_build_types}
82 build_libraries ${build_type}
83 done
84 else
85 build_libraries $1