1 #!/bin/sh 2 3 # Copyright 2013, ARM Limited 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions are met: 8 # 9 # * Redistributions of source code must retain the above copyright notice, 10 # this list of conditions and the following disclaimer. 11 # * Redistributions in binary form must reproduce the above copyright notice, 12 # this list of conditions and the following disclaimer in the documentation 13 # and/or other materials provided with the distribution. 14 # * Neither the name of ARM Limited nor the names of its contributors may be 15 # used to endorse or promote products derived from this software without 16 # specific prior written permission. 17 # 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND 19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 if [ "$#" -lt 1 ]; then 30 echo "Usage: tools/cross_build_gcc.sh <GCC prefix> [scons arguments ...]" 31 exit 1 32 fi 33 34 export CXX=$1g++ 35 export AR=$1ar 36 export RANLIB=$1ranlib 37 export CC=$1gcc 38 export LD=$1ld 39 40 OK=1 41 if [ ! -x "$CXX" ]; then 42 echo "Error: $CXX does not exist or is not executable." 43 OK=0 44 fi 45 if [ ! -x "$AR" ]; then 46 echo "Error: $AR does not exist or is not executable." 47 OK=0 48 fi 49 if [ ! -x "$RANLIB" ]; then 50 echo "Error: $RANLIB does not exist or is not executable." 51 OK=0 52 fi 53 if [ ! -x "$CC" ]; then 54 echo "Error: $CC does not exist or is not executable." 55 OK=0 56 fi 57 if [ ! -x "$LD" ]; then 58 echo "Error: $LD does not exist or is not executable." 59 OK=0 60 fi 61 if [ $OK -ne 1 ]; then 62 exit 1 63 fi 64 65 66 shift 67 scons $@ 68