Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Common constants for build scripts | 5 # Common constants for build scripts |
| 6 # This must evaluate properly for both /bin/bash and /bin/sh | 6 # This must evaluate properly for both /bin/bash and /bin/sh |
| 7 | 7 |
| 8 # All scripts should die on error unless commands are specifically excepted | 8 # All scripts should die on error unless commands are specifically excepted |
| 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. | 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. |
| 10 # TODO: Re-enable this once shflags is less prone to dying. | 10 # TODO: Re-enable this once shflags is less prone to dying. |
| 11 #set -e | 11 #set -e |
| 12 | 12 |
| 13 # The number of jobs to pass to tools that can run in parallel (such as make | 13 # The number of jobs to pass to tools that can run in parallel (such as make |
| 14 # and dpkg-buildpackage | 14 # and dpkg-buildpackage |
| 15 NUM_JOBS=`grep -c "^processor" /proc/cpuinfo` | 15 NUM_JOBS=`grep -c "^processor" /proc/cpuinfo` |
| 16 | 16 |
| 17 # Store location of the calling script. | 17 # Store location of the calling script. |
| 18 TOP_SCRIPT_DIR="${TOP_SCRIPT_DIR:-$(dirname $0)}" | 18 TOP_SCRIPT_DIR="${TOP_SCRIPT_DIR:-$(dirname $0)}" |
| 19 | 19 |
| 20 # Detect whether we're inside a chroot or not | |
| 21 if [ -e /etc/debian_chroot ] | |
| 22 then | |
| 23 INSIDE_CHROOT=1 | |
| 24 else | |
| 25 INSIDE_CHROOT=0 | |
| 26 fi | |
| 27 | |
| 20 # Find root of source tree | 28 # Find root of source tree |
| 21 if [ "x$GCLIENT_ROOT" != "x" ] | 29 if [ "x$GCLIENT_ROOT" != "x" ] |
| 22 then | 30 then |
| 23 # GCLIENT_ROOT already set, so we're done | 31 # GCLIENT_ROOT already set, so we're done |
| 24 true | 32 true |
| 33 elif [ $INSIDE_CHROOT -eq 1 ] | |
| 34 then | |
| 35 # If we are inside the chroot and we haven't been told otherwise, we assume | |
| 36 # that the GCLIENT_ROOT is ~/trunk. | |
| 37 GCLIENT_ROOT="/home/${SUDO_USER:-$USER}/trunk" | |
|
davidjames
2011/01/26 21:26:14
Hmm, so this doesn't work for me.
./enter_chroot.
| |
| 25 elif [ "x$COMMON_SH" != "x" ] | 38 elif [ "x$COMMON_SH" != "x" ] |
| 26 then | 39 then |
| 27 # COMMON_SH set, so assume that's us | 40 # COMMON_SH set, so assume that's us |
| 28 GCLIENT_ROOT="$(dirname "$COMMON_SH")/../.." | 41 GCLIENT_ROOT="$(dirname "$COMMON_SH")/../.." |
| 29 elif [ "x$BASH_SOURCE" != "x" ] | 42 elif [ "x$BASH_SOURCE" != "x" ] |
| 30 then | 43 then |
| 31 # Using bash, so we can find ourselves | 44 # Using bash, so we can find ourselves |
| 32 GCLIENT_ROOT="$(dirname "$BASH_SOURCE")/../.." | 45 GCLIENT_ROOT="$(dirname "$BASH_SOURCE")/../.." |
| 33 else | 46 else |
| 34 # Using dash or sh, we don't know where we are. $0 refers to the calling | 47 # Using dash or sh, we don't know where we are. $0 refers to the calling |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 fi | 122 fi |
| 110 # Strip CR | 123 # Strip CR |
| 111 ALL_BOARDS=$(echo $ALL_BOARDS) | 124 ALL_BOARDS=$(echo $ALL_BOARDS) |
| 112 # Set a default BOARD | 125 # Set a default BOARD |
| 113 #DEFAULT_BOARD=x86-generic # or... | 126 #DEFAULT_BOARD=x86-generic # or... |
| 114 DEFAULT_BOARD=$(echo $ALL_BOARDS | awk '{print $NF}') | 127 DEFAULT_BOARD=$(echo $ALL_BOARDS | awk '{print $NF}') |
| 115 | 128 |
| 116 # Enable --fast by default. | 129 # Enable --fast by default. |
| 117 DEFAULT_FAST="${FLAGS_TRUE}" | 130 DEFAULT_FAST="${FLAGS_TRUE}" |
| 118 | 131 |
| 119 # Detect whether we're inside a chroot or not | |
| 120 if [ -e /etc/debian_chroot ] | |
| 121 then | |
| 122 INSIDE_CHROOT=1 | |
| 123 else | |
| 124 INSIDE_CHROOT=0 | |
| 125 fi | |
| 126 | |
| 127 # Directory locations inside the dev chroot | 132 # Directory locations inside the dev chroot |
| 128 CHROOT_TRUNK_DIR="/home/$USER/trunk" | 133 CHROOT_TRUNK_DIR="/home/$USER/trunk" |
| 129 | 134 |
| 130 # Install make for portage ebuilds. Used by build_image and gmergefs. | 135 # Install make for portage ebuilds. Used by build_image and gmergefs. |
| 131 # TODO: Is /usr/local/autotest-chrome still used by anyone? | 136 # TODO: Is /usr/local/autotest-chrome still used by anyone? |
| 132 DEFAULT_INSTALL_MASK=" | 137 DEFAULT_INSTALL_MASK=" |
| 133 *.a | 138 *.a |
| 134 *.la | 139 *.la |
| 135 /etc/init.d | 140 /etc/init.d |
| 136 /etc/runlevels | 141 /etc/runlevels |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 | 580 |
| 576 BOARD=$(echo "$flags_board" | cut -d '_' -f 1) | 581 BOARD=$(echo "$flags_board" | cut -d '_' -f 1) |
| 577 VARIANT=${flags_variant:-$(echo "$flags_board" | cut -s -d '_' -f 2)} | 582 VARIANT=${flags_variant:-$(echo "$flags_board" | cut -s -d '_' -f 2)} |
| 578 | 583 |
| 579 if [ -n "$VARIANT" ]; then | 584 if [ -n "$VARIANT" ]; then |
| 580 BOARD_VARIANT="${BOARD}_${VARIANT}" | 585 BOARD_VARIANT="${BOARD}_${VARIANT}" |
| 581 else | 586 else |
| 582 BOARD_VARIANT="${BOARD}" | 587 BOARD_VARIANT="${BOARD}" |
| 583 fi | 588 fi |
| 584 } | 589 } |
| OLD | NEW |