Ahmad Sharif | 795ed17 | 2011-06-29 17:24:02 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | # Script to switch the toolchain compiler. In addition to switching the |
| 8 | # compiler by calling gcc-config, it copies over the libgcc_s.so and |
| 9 | # libstdc++.so files to all board roots that use this cross compiler. |
| 10 | find_common_sh() { |
| 11 | local common_paths=(/usr/lib/crosutils $(dirname "$0")) |
| 12 | local path |
| 13 | |
| 14 | SCRIPT_ROOT= |
| 15 | for path in "${common_paths[@]}"; do |
| 16 | local common="${path}/common.sh" |
| 17 | if ([ -r "${common}" ] && . "${common}" && [ -d "${SCRIPTS_DIR}" ]); then |
| 18 | SCRIPT_ROOT=${path} |
| 19 | break |
| 20 | fi |
| 21 | done |
| 22 | } |
| 23 | |
| 24 | find_common_sh |
| 25 | . "${SCRIPT_ROOT}/common.sh" || ! echo "Unable to load common.sh" || exit 1 |
| 26 | . "${SRC_ROOT}/platform/dev/toolchain_utils.sh" || |
| 27 | ! echo "Unable to load toolchain_utils.sh" || exit 1 |
| 28 | |
| 29 | cros_gcc_config "$@" |