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

Side by Side Diff: third_party/instrumented_libraries/download_build_install

Issue 50423003: Adds a flag "use_instrumented_libraries" and corresponding target with 2 simple libs (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « build/common.gypi ('k') | third_party/instrumented_libraries/fix_rpaths » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/bash
Alexander Potapenko 2013/10/31 12:18:17 I prefer shell scripts to have .sh extensions, alt
alextaran1 2013/11/01 11:17:01 Removing extensions from shell scripts is accordin
2 # Copyright (c) 2013 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 # Downloads, builds (with instrumentation) and installs shared libraries.
7
8 # Colored print.
9
10 RED_COLOR='\e[0;31m'
11 GREEN_COLOR='\e[0;32m'
12 NO_COLOR='\e[0m'
13
14 function echo_red {
15 echo -e "${RED_COLOR}$1${NO_COLOR}"
16 }
17
18 function echo_green {
19 echo -e "${GREEN_COLOR}$1${NO_COLOR}"
20 }
21
22 # Default values.
23
24 product_dir=$(pwd)
25 intermediate_dir=$(pwd)
26
27 # Should be without spaces to pass it to dpkg-buildpackage.
28 makejobs="-j14"
29
30 # Parsing args.
31
32 while getopts ":i:l:m:hp:s:j:" opt; do
33 case ${opt} in
34 p)
35 echo_green "Only installing dependencies (requires root access)"
36 echo_green "Installing dependencies for: ${OPTARG}"
37 sudo apt-get -y --no-remove build-dep ${OPTARG}
38 exit
39 ;;
40 h)
41 echo "Possible flags:
42 -p - install dependencies for packages,
43 -h - this help,
44 -l - which library to build,
45 -i - sets relative product_dir,
46 -s - sanitizer (only asan is supported now)."
47 echo "Environment variabless, which affect this script: CC and CXX"
48 exit
49 ;;
50 i)
51 product_dir="$(pwd)/${OPTARG}"
52 ;;
53 l)
54 library="${OPTARG}"
55 ;;
56 m)
57 intermediate_dir="${OPTARG}"
58 ;;
59 j)
60 makejobs="-j${OPTARG}"
61 ;;
62 s)
63 sanitizer_type="${OPTARG}"
64 if [[ "${OPTARG}" == "asan" ]]; then
65 sanitizer_flag_string="address"
66 else
67 echo_red "Invalid sanitizer: ${OPTARG}" >&2
68 exit 1
69 fi
70 ;;
71 *)
72 echo_red "Invalid option: -${OPTARG}" >&2
73 exit 1
74 ;;
75 esac
76 done
77
78 if [[ -z "${library}" ]]; then
79 echo_red "No library specified to build" >&2
80 exit 1
81 fi
82
83 if [[ -z "${sanitizer_type}" ]]; then
84 echo_red "No sanitizer specified" >&2
85 exit
86 fi
87
88 export CFLAGS="-fsanitize=${sanitizer_flag_string} -g -fPIC -w"
89 export CXXFLAGS="-fsanitize=${sanitizer_flag_string} -g -fPIC -w"
90 export LDFLAGS="-Wl,-z,origin -Wl,-R,XORIGIN/."
91
92 mkdir -p ${product_dir}/instrumented_libraries/${sanitizer_type}
93
94 needed_dependencies=$(apt-get -s build-dep ${library} | grep Inst \
95 | cut -d " " -f 2)
96
97 if [[ -n "${needed_dependencies}" ]]; then
98 echo_red "Library ${library} needs dependencies: ${needed_dependencies}" >&2
99 echo_red "Please, install dependencies using:
100 third_party/instrumented_libraries/download_build_install -p ${library}" >&2
101 exit 1
102 fi
103
104 (
105 # Downloading library
106 mkdir -p ${intermediate_dir}/${library}
107 cd ${intermediate_dir}/${library}
108 apt-get source ${library} 2>&1
109
110 # cd into the only directory in the current folder
111 # where our package has been unpacked.
112 cd $(ls -F |grep \/$)
113
114 # Build library
115 ./configure --prefix="${product_dir}/instrumented_libraries/${sanitizer_type}"
116 make ${makejobs}
117
118 # Install library
119 make ${makejobs} install 2>&1
120 ) > /dev/null
121
122 # Mark that library is installed.
123 # This file is used by GYP as 'output' to mark that it's already build
124 # while making incremental build.
125 touch ${product_dir}/instrumented_libraries/${sanitizer_type}/${library}.txt
126
127 # Clean up.
128 rm -rf ${intermediate_dir}/${library}
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | third_party/instrumented_libraries/fix_rpaths » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698