diff options
author | Raphael Moll <raphael@google.com> | 2012-01-25 13:33:57 -0800 |
---|---|---|
committer | Raphael <raphael@google.com> | 2012-03-21 21:32:47 -0700 |
commit | d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b (patch) | |
tree | 2c74ef27ea01816b773ee916d8b30807892b6680 /eclipse/scripts/create_all_symlinks.sh | |
parent | 7a795b5291224e2b85885f4d1f4d7ac097e96d3c (diff) | |
download | sdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.tar.gz sdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.tar.bz2 sdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.zip |
Build Monitor RCP as part of SDK (Mac, Linux and Win)
This adds a new SDK/tools/monitor[.bat] wrapper
as well as SDK/tools/lib/monitor-x86[_64]/ directories
that contain the actual RCP application.
The monitor shell wrappers + bat have not been properly tested yet.
The goal of this CL is just to build the RCP. In a following
CL we'll adjust the wrapper and the actual binary location
in the SDK.
Cross-dependency: Requires build.git change Ifb31e2e3.
Change-Id: I7afbd63badfb81fd5d3d899de672e02525a49bc2
Diffstat (limited to 'eclipse/scripts/create_all_symlinks.sh')
-rwxr-xr-x | eclipse/scripts/create_all_symlinks.sh | 101 |
1 files changed, 73 insertions, 28 deletions
diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh index b274ed365..25dce6874 100755 --- a/eclipse/scripts/create_all_symlinks.sh +++ b/eclipse/scripts/create_all_symlinks.sh @@ -1,43 +1,81 @@ #!/bin/bash +# See usage() below for the description. + +function usage() { + cat <<EOF # This script copies the .jar files that each plugin depends on into the plugins libs folder. # By default, on Mac & Linux, this script creates symlinks from the libs folder to the jar file. # Since Windows does not support symlinks, the jar files are copied. -# Use option "-f" to copy files rather than creating symlinks on the Mac/Linux platforms. +# +# Options: +# -f : to copy files rather than creating symlinks on the Mac/Linux platforms. +# -d : print make dependencies instead of running make; doesn't copy files. +# -c : copy files expected after make dependencies (reported by -d) have been built. +# +# The purpose of -d/-c is to include the workflow in a make file: +# - the make rule should depend on \$(shell create_all_symlinks -d) +# - the rule body should perform \$(shell create_all_symlinks -c [-f]) +EOF +} -echo "## Running $0" # CD to the top android directory PROG_DIR=`dirname "$0"` cd "${PROG_DIR}/../../../" HOST=`uname` -USE_COPY="" # force copy dependent jar files rather than creating symlinks +USE_COPY="" # force copy dependent jar files rather than creating symlinks +ONLY_SHOW_DEPS="" # only report make dependencies but don't build them nor copy. +ONLY_COPY_DEPS="" # only copy dependencies built by make; uses -f as needed. function die() { - echo "Error: $*" + echo "Error: $*" >/dev/stderr exit 1 } +function warn() { + # Only print something if not in show-deps mode + if [[ -z $ONLY_SHOW_DEPS ]]; then + echo "$*" + fi +} + ## parse arguments while [ $# -gt 0 ]; do - if [ "$1" == "-f" ]; then - USE_COPY="1" - fi + case "$1" in + "-f" ) + USE_COPY="1" + ;; + "-d" ) + ONLY_SHOW_DEPS="1" + ;; + "-c" ) + ONLY_COPY_DEPS="1" + ;; + * ) + usage + exit 2 + esac shift done -if [ "$HOST" == "Linux" ]; then +warn "## Running $0" + +if [[ "${HOST:0:6}" == "CYGWIN" || "$USE_MINGW" == "1" ]]; then + # This is either Cygwin or Linux/Mingw cross-compiling to Windows. + PLATFORM="windows-x86" + if [[ "${HOST:0:6}" == "CYGWIN" ]]; then + # We can't use symlinks under Cygwin + USE_COPY="1" + fi +elif [[ "$HOST" == "Linux" ]]; then PLATFORM="linux-x86" -elif [ "$HOST" == "Darwin" ]; then +elif [[ "$HOST" == "Darwin" ]]; then PLATFORM="darwin-x86" -elif [ "${HOST:0:6}" == "CYGWIN" ]; then - USE_COPY="1" # We can't use symlinks under Cygwin - PLATFORM="windows-x86" else - echo "Unsupported platform ($HOST). Aborting." - exit 1 + die "Unsupported platform ($HOST). Aborting." fi -if [ "$USE_COPY" == "1" ]; then +if [[ "$USE_COPY" == "1" ]]; then function cpfile { # $1=source $2=dest cp -fv $1 $2/ } @@ -167,25 +205,32 @@ if [[ $PLATFORM != "windows-x86" ]]; then CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS $GLD_PREBUILTS" fi -# Make sure we have lunch sdk-<something> -if [[ ! "$TARGET_PRODUCT" ]]; then - echo "## TARGET_PRODUCT is not set, running build/envsetup.sh" - . build/envsetup.sh - echo "## lunch sdk-eng" - lunch sdk-eng +# In the mode to only echo dependencies, output them and we're done +if [[ -n $ONLY_SHOW_DEPS ]]; then + echo $LIBS + exit 0 fi -# Run make on all libs +if [[ -z $ONLY_COPY_DEPS ]]; then + # Make sure we have lunch sdk-<something> + if [[ ! "$TARGET_PRODUCT" ]]; then + warn "## TARGET_PRODUCT is not set, running build/envsetup.sh" + . build/envsetup.sh + warn "## lunch sdk-eng" + lunch sdk-eng + fi -J="4" -[[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') -[[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) + # Run make on all libs -echo "## Building libs: make -j$J $LIBS" -make -j${J} $LIBS + J="4" + [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') + [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) -# Copy resulting files + warn "## Building libs: make -j$J $LIBS" + make -j${J} $LIBS +fi +# Copy resulting files DEST="" for SRC in $CP_FILES; do if [[ "${SRC:0:2}" == "@:" ]]; then |