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} \ |
| 41 use_instrumented_libraries=1 instrumented_libraries_jobs=8" \ |
| 42 GYP_GENERATOR_FLAGS="output_dir=${out_dir}" \ |
| 43 gclient runhooks |
| 44 |
| 45 ninja -j4 -C ${out_dir}/Release instrumented_libraries |
| 46 |
| 47 echo "Creating archive ${archive_name}.tgz..." |
| 48 |
| 49 files=$(ls -1 ${out_dir}/Release/instrumented_libraries) |
| 50 |
| 51 tar zcf ${archive_name}.tgz -C ${out_dir}/Release/instrumented_libraries \ |
| 52 --exclude="?san/*.txt" ${files} |
| 53 |
| 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. |
| 58 } |
| 59 |
| 60 if ! [[ "${supported_releases}" =~ ${ubuntu_release} ]] |
| 61 then |
| 62 echo "Unsupported Ubuntu release: ${ubuntu_release}" |
| 63 echo "Supported releases: ${supported_releases}" |
| 64 exit 1 |
| 65 fi |
| 66 |
| 67 if [ -z "${1-}" ] |
| 68 then |
| 69 show_help |
| 70 exit 0 |
| 71 fi |
| 72 |
| 73 if ! [[ "all ${supported_build_types}" =~ $1 ]] |
| 74 then |
| 75 show_help |
| 76 exit 1 |
| 77 fi |
| 78 if [ "$1" == "all" ] |
| 79 then |
| 80 for build_type in ${supported_build_types} |
| 81 do |
| 82 build_libraries ${build_type} |
| 83 done |
| 84 else |
| 85 build_libraries $1 |
| 86 fi |
| 87 |
OLD | NEW |