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

Unified 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, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/instrumented_libraries/download_build_install
===================================================================
--- third_party/instrumented_libraries/download_build_install (revision 0)
+++ third_party/instrumented_libraries/download_build_install (revision 0)
@@ -0,0 +1,103 @@
+#!/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.
+#
+# 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.
+
+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
+export CXXFLAGS="-fsanitize=address -g -fPIC -w"
+export LDFLAGS="-Wl,-z,origin -Wl,-R,XORIGIN/."
+
+# Should be without spaces to pass it to dpkg-buildpackage!
+MAKEJOBS="-j14"
+
+# 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 :)
+
+RED_COLOR='\e[0;31m'
+GREEN_COLOR='\e[0;32m'
+NO_COLOR='\e[0m'
+
+function echo_red {
+ echo -e "${RED_COLOR}$1${NO_COLOR}"
+}
+
+function echo_green {
+ echo -e "${GREEN_COLOR}$1${NO_COLOR}"
+}
+
+# Default values
+
+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
+intermediate_dir=$(pwd)
+
+# Parsing args
+
+while getopts ":i:l:m:hp:" opt; do
+ case $opt in
+ p)
+ echo_green "Only installing dependencies (requires root access)"
+ 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.
+ sudo apt-get -y --no-remove build-dep $OPTARG
+ exit
+ ;;
+ h)
+ echo "Possible flags:
+ -p - install dependencies for packages,
+ -h - this help,
+ -l - which library to build,
+ -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.
+ echo "Environment variabless, which affect this script: CC and CXX"
+ exit
+ ;;
+ i)
+ install_dir="$(pwd)/$OPTARG"
+ ;;
+ l)
+ library="$OPTARG"
+ ;;
+ m)
+ intermediate_dir="$OPTARG"
+ ;;
+ *)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ esac
+done
+
+if [[ -z "$library" ]]; then
+ echo_red "No library specified to build" >&2
+ exit 1
+fi
+
+mkdir -p $install_dir
+
+needed_dependencies=$(apt-get -s build-dep $library | grep Inst \
+ | 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
+
+if [[ -n "$needed_dependencies" ]]; then
+ echo_red "Library $library needs dependencies: $needed_dependencies" >&2
+ echo_red "Please, install dependencies using:
+ third_party/instrumented_libraries/download_build_install -p $library" >&2
+ exit 1
+fi
+
+(
+ # Downloading $library
+ 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.
+ cd $intermediate_dir/$library
+ apt-get source $library
+
+ 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.
+
+ # Build $library
+ ./configure --prefix=$install_dir
+ make $MAKEJOBS
+
+ # Install $library
+ 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.
+) > /dev/null
+
+# Mark that library is installed
+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
+
+# Clean up
+rm -rf $intermediate_dir/$library
Property changes on: third_party/instrumented_libraries/download_build_install
___________________________________________________________________
Added: svn:executable
+ *

Powered by Google App Engine
This is Rietveld 408576698