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

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
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/bash
Alexander Potapenko 2013/10/29 13:36:11 A Bash script still needs the copyright text. For
alextaran1 2013/10/30 11:16:29 Done.
2 #
3 # Downloads, builds (with instrumentation) and installs shared libraries
Alexander Potapenko 2013/10/29 13:36:11 Period at the end of the comment.
alextaran1 2013/10/30 11:16:29 Done.
4
5 export CFLAGS="-fsanitize=address -g -fPIC -w"
Alexander Potapenko 2013/10/29 13:36:11 We must potentially support other -fsanitize= flag
alextaran1 2013/10/30 11:16:29 Added "sanitizer" flag to script
6 export CXXFLAGS="-fsanitize=address -g -fPIC -w"
7 export LDFLAGS="-Wl,-z,origin -Wl,-R,XORIGIN/."
8
9 # Should be without spaces to pass it to dpkg-buildpackage!
10 MAKEJOBS="-j14"
11
12 # Colored print
Alexander Potapenko 2013/10/29 13:36:11 Doesn't ninja swallow your colored print?
alextaran1 2013/10/30 11:16:29 It works good :)
13
14 RED_COLOR='\e[0;31m'
15 GREEN_COLOR='\e[0;32m'
16 NO_COLOR='\e[0m'
17
18 function echo_red {
19 echo -e "${RED_COLOR}$1${NO_COLOR}"
20 }
21
22 function echo_green {
23 echo -e "${GREEN_COLOR}$1${NO_COLOR}"
24 }
25
26 # Default values
27
28 install_dir=$(pwd)/asan
Alexander Potapenko 2013/10/29 13:36:11 Again, we must support other tools in the future -
alextaran1 2013/10/30 11:16:29 Added a "sanitizer" flag to script
29 intermediate_dir=$(pwd)
30
31 # Parsing args
32
33 while getopts ":i:l:m:hp:" opt; do
34 case $opt in
35 p)
36 echo_green "Only installing dependencies (requires root access)"
37 echo_green "Installing dependencies for: $OPTARG"
Alexander Potapenko 2013/10/29 13:36:11 Please check with http://google-styleguide.googlec
alextaran1 2013/10/30 11:16:29 Done.
38 sudo apt-get -y --no-remove build-dep $OPTARG
39 exit
40 ;;
41 h)
42 echo "Possible flags:
43 -p - install dependencies for packages,
44 -h - this help,
45 -l - which library to build,
46 -i - sets relative install_dir."
Alexander Potapenko 2013/10/29 13:36:11 I suggest to pass only the parameters the script c
alextaran1 2013/10/30 11:16:29 Done.
47 echo "Environment variabless, which affect this script: CC and CXX"
48 exit
49 ;;
50 i)
51 install_dir="$(pwd)/$OPTARG"
52 ;;
53 l)
54 library="$OPTARG"
55 ;;
56 m)
57 intermediate_dir="$OPTARG"
58 ;;
59 *)
60 echo "Invalid option: -$OPTARG" >&2
61 exit 1
62 ;;
63 esac
64 done
65
66 if [[ -z "$library" ]]; then
67 echo_red "No library specified to build" >&2
68 exit 1
69 fi
70
71 mkdir -p $install_dir
72
73 needed_dependencies=$(apt-get -s build-dep $library | grep Inst \
74 | cut -d " " -f 2)
Alexander Potapenko 2013/10/29 13:36:11 I think there should be one more space before the
alextaran1 2013/10/30 11:16:29 It has actually 2 spaces according to http://googl
75
76 if [[ -n "$needed_dependencies" ]]; then
77 echo_red "Library $library needs dependencies: $needed_dependencies" >&2
78 echo_red "Please, install dependencies using:
79 third_party/instrumented_libraries/download_build_install -p $library" >&2
80 exit 1
81 fi
82
83 (
84 # Downloading $library
85 mkdir -p $intermediate_dir/$library
Alexander Potapenko 2013/10/29 13:36:11 Make sure to quote the variable names.
alextaran1 2013/10/30 11:16:29 Done.
86 cd $intermediate_dir/$library
87 apt-get source $library
88
89 cd $(ls -F |grep \/$)
Alexander Potapenko 2013/10/29 13:36:11 Quite a cryptic line. Pleas add a comment.
alextaran1 2013/10/30 11:16:29 Done.
90
91 # Build $library
92 ./configure --prefix=$install_dir
93 make $MAKEJOBS
94
95 # Install $library
96 make install
Alexander Potapenko 2013/10/29 13:36:11 You can install in parallel, too: make $MAKEJOBS i
alextaran1 2013/10/30 11:16:29 Done.
97 ) > /dev/null
98
99 # Mark that library is installed
100 touch $install_dir/$library.txt
Alexander Potapenko 2013/10/29 13:36:11 Is this file actually used anywhere now?
alextaran1 2013/10/30 11:16:29 It's used by GYP for valid incremental build. I wi
101
102 # Clean up
103 rm -rf $intermediate_dir/$library
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698