comparison sources/functions.sh @ 915:a541c5a96ff3

Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
author Rob Landley <rob@landley.net>
date Thu, 03 Dec 2009 01:18:39 -0600
parents 2ed667428dbd
children 8b69eeb17ebf
comparison
equal deleted inserted replaced
914:8a698351f241 915:a541c5a96ff3
1 #!/bin/echo "This file is sourced, not run" 1 #!/bin/echo "This file is sourced, not run"
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
5 # Output the first cross compiler (static or basic) that's installed.
6
7 cc_path()
8 {
9 local i
10
11 for i in "$BUILD"/cross-{static,compiler}-"$1/bin"
12 do
13 [ -e "$i/$1-cc" ] && break
14 done
15 echo -n "$i:"
16 }
4 17
5 function read_arch_dir() 18 function read_arch_dir()
6 { 19 {
7 # Get target platform from first command line argument. 20 # Get target platform from first command line argument.
8 21
50 63
51 # Setup directories and add the cross compiler to the start of the path. 64 # Setup directories and add the cross compiler to the start of the path.
52 65
53 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}" 66 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}"
54 67
55 export PATH="${BUILD}/cross-compiler-$ARCH/bin:$PATH" 68 export PATH="$(cc_path "$ARCH")$PATH"
56 [ "$FROM_ARCH" != "$ARCH" ] && 69 [ "$FROM_ARCH" != "$ARCH" ] && PATH="$(cc_path "$FROM_ARCH")$PATH"
57 PATH="${BUILD}/cross-compiler-${FROM_ARCH}/bin:$PATH"
58 70
59 # Check this here because it could be set in "settings" 71 # Check this here because it could be set in "settings"
60 72
61 [ ! -z "$BUILD_STATIC" ] && STATIC_FLAGS="--static" 73 [ ! -z "$BUILD_STATIC" ] && STATIC_FLAGS="--static"
62 74
558 uClibc (http://uclibc.org) $(identify_release uClibc) 570 uClibc (http://uclibc.org) $(identify_release uClibc)
559 BusyBox (http://busybox.net) $(identify_release busybox) 571 BusyBox (http://busybox.net) $(identify_release busybox)
560 Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux) 572 Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux)
561 573
562 Toolchain packages: 574 Toolchain packages:
563 Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils 575 Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils)
564 )
565 GCC (http://gcc.gnu.org) $(identify_release gcc-core) 576 GCC (http://gcc.gnu.org) $(identify_release gcc-core)
566 gmake (http://www.gnu.org/software/make) $(identify_release make) 577 gmake (http://www.gnu.org/software/make) $(identify_release make)
567 bash (ftp://ftp.gnu.org/gnu/bash) $(identify_release bash) 578 bash (ftp://ftp.gnu.org/gnu/bash) $(identify_release bash)
568 579
569 Optional packages: 580 Optional packages:
582 rm -rf "$BUILD/$2" && 593 rm -rf "$BUILD/$2" &&
583 ln -s "$1" "$BUILD/$2" || dienow 594 ln -s "$1" "$BUILD/$2" || dienow
584 } 595 }
585 596
586 # Check if this target has a base architecture that's already been built. 597 # Check if this target has a base architecture that's already been built.
587 # If so, just tar it up and exit now. 598 # If so, link to it and exit now.
588 599
589 function check_for_base_arch() 600 function check_for_base_arch()
590 { 601 {
591 blank_tempdir "$STAGE_DIR" 602 blank_tempdir "$STAGE_DIR"
592 blank_tempdir "$WORK" 603 blank_tempdir "$WORK"