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

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
« no previous file with comments | « build/common.gypi ('k') | third_party/instrumented_libraries/fix_rpaths » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,128 @@
+#!/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
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Downloads, builds (with instrumentation) and installs shared libraries.
+
+# Colored print.
+
+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.
+
+product_dir=$(pwd)
+intermediate_dir=$(pwd)
+
+# Should be without spaces to pass it to dpkg-buildpackage.
+makejobs="-j14"
+
+# Parsing args.
+
+while getopts ":i:l:m:hp:s:j:" opt; do
+ case ${opt} in
+ p)
+ echo_green "Only installing dependencies (requires root access)"
+ echo_green "Installing dependencies for: ${OPTARG}"
+ 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 product_dir,
+ -s - sanitizer (only asan is supported now)."
+ echo "Environment variabless, which affect this script: CC and CXX"
+ exit
+ ;;
+ i)
+ product_dir="$(pwd)/${OPTARG}"
+ ;;
+ l)
+ library="${OPTARG}"
+ ;;
+ m)
+ intermediate_dir="${OPTARG}"
+ ;;
+ j)
+ makejobs="-j${OPTARG}"
+ ;;
+ s)
+ sanitizer_type="${OPTARG}"
+ if [[ "${OPTARG}" == "asan" ]]; then
+ sanitizer_flag_string="address"
+ else
+ echo_red "Invalid sanitizer: ${OPTARG}" >&2
+ exit 1
+ fi
+ ;;
+ *)
+ echo_red "Invalid option: -${OPTARG}" >&2
+ exit 1
+ ;;
+ esac
+done
+
+if [[ -z "${library}" ]]; then
+ echo_red "No library specified to build" >&2
+ exit 1
+fi
+
+if [[ -z "${sanitizer_type}" ]]; then
+ echo_red "No sanitizer specified" >&2
+ exit
+fi
+
+export CFLAGS="-fsanitize=${sanitizer_flag_string} -g -fPIC -w"
+export CXXFLAGS="-fsanitize=${sanitizer_flag_string} -g -fPIC -w"
+export LDFLAGS="-Wl,-z,origin -Wl,-R,XORIGIN/."
+
+mkdir -p ${product_dir}/instrumented_libraries/${sanitizer_type}
+
+needed_dependencies=$(apt-get -s build-dep ${library} | grep Inst \
+ | cut -d " " -f 2)
+
+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}
+ cd ${intermediate_dir}/${library}
+ apt-get source ${library} 2>&1
+
+ # cd into the only directory in the current folder
+ # where our package has been unpacked.
+ cd $(ls -F |grep \/$)
+
+ # Build library
+ ./configure --prefix="${product_dir}/instrumented_libraries/${sanitizer_type}"
+ make ${makejobs}
+
+ # Install library
+ make ${makejobs} install 2>&1
+) > /dev/null
+
+# Mark that library is installed.
+# This file is used by GYP as 'output' to mark that it's already build
+# while making incremental build.
+touch ${product_dir}/instrumented_libraries/${sanitizer_type}/${library}.txt
+
+# Clean up.
+rm -rf ${intermediate_dir}/${library}
Property changes on: third_party/instrumented_libraries/download_build_install
___________________________________________________________________
Added: svn:executable
+ *
« 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