comparison sources/functions.sh @ 1090:affef1edbdba

Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
author Rob Landley <rob@landley.net>
date Fri, 21 May 2010 22:26:25 -0500
parents b52ba5df878d
children fb9423e8bd09
comparison
equal deleted inserted replaced
1089:b7efc55a3b09 1090:affef1edbdba
2 2
3 # Lots of reusable functions. This file is sourced, not run. 3 # Lots of reusable functions. This file is sourced, not run.
4 4
5 source sources/utility_functions.sh 5 source sources/utility_functions.sh
6 6
7 # Output the first cross compiler (static or basic) that's installed. 7 # Output path to cross compiler.
8 8
9 cc_path() 9 cc_path()
10 { 10 {
11 local i 11 local i
12
13 # Output cross it if exists, else simple. If neither exists, output simple.
12 14
13 for i in "$BUILD"/{,simple-}cross-compiler-"$1/bin" 15 for i in "$BUILD"/{,simple-}cross-compiler-"$1/bin"
14 do 16 do
15 [ -e "$i/$1-cc" ] && break 17 [ -e "$i/$1-cc" ] && break
16 done 18 done
44 # cross compiling when the host and target are the same processor. (If host 46 # cross compiling when the host and target are the same processor. (If host
45 # and target match, the binutils/gcc/make builds won't use the cross compiler 47 # and target match, the binutils/gcc/make builds won't use the cross compiler
46 # during root-filesystem.sh, and the host compiler links binaries against the 48 # during root-filesystem.sh, and the host compiler links binaries against the
47 # wrong libc.) 49 # wrong libc.)
48 export_if_blank CROSS_HOST=`uname -m`-walrus-linux 50 export_if_blank CROSS_HOST=`uname -m`-walrus-linux
49 if [ -z "$CROSS_TARGET" ] 51 export_if_blank CROSS_TARGET=${ARCH}-unknown-linux
50 then
51 export CROSS_TARGET=${ARCH}-unknown-linux
52 else
53 [ -z "$FROM_HOST" ] && FROM_HOST="${CROSS_TARGET}"
54 fi
55
56 # Override FROM_ARCH to perform a canadian cross in root-filesystem.sh
57
58 if [ -z "$FROM_ARCH" ]
59 then
60 FROM_ARCH="${ARCH}"
61 else
62 [ -z "$PROGRAM_PREFIX" ] && PROGRAM_PREFIX="${ARCH}-"
63 fi
64 export_if_blank FROM_HOST="${FROM_ARCH}-thingy-linux"
65 52
66 # Setup directories and add the cross compiler to the start of the path. 53 # Setup directories and add the cross compiler to the start of the path.
67 54
68 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}" 55 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}"
69 56
70 export PATH="$(cc_path "$ARCH")$PATH" 57 export PATH="$(cc_path "$ARCH")$PATH"
71 [ "$FROM_ARCH" != "$ARCH" ] && PATH="$(cc_path "$FROM_ARCH")$PATH" 58 [ ! -z "$HOST_ARCH" ] && [ "$HOST_ARCH" != "$ARCH" ] &&
59 PATH="$(cc_path "$HOST_ARCH")$PATH"
72 60
73 DO_CROSS="CROSS_COMPILE=${ARCH}-" 61 DO_CROSS="CROSS_COMPILE=${ARCH}-"
74 62
75 return 0 63 return 0
76 } 64 }