| 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | # build-host.sh
|
|---|
| 4 | # (was build-native-2.4.4.sh)
|
|---|
| 5 | #
|
|---|
| 6 | # Master script for building native tools on the build host
|
|---|
| 7 | # required for the creation of a cross-toolchain
|
|---|
| 8 | #
|
|---|
| 9 | # Authors: Ryan Oliver <ryan.oliver@pha.com.au
|
|---|
| 10 | # Finn Thain
|
|---|
| 11 | #
|
|---|
| 12 | # $LastChangedBy$
|
|---|
| 13 | # $LastChangedDate$
|
|---|
| 14 | # $LastChangedRevision$
|
|---|
| 15 | #
|
|---|
| 16 |
|
|---|
| 17 | # Set SELF to be name of script called, minus any path...
|
|---|
| 18 | SELF=`basename ${0}`
|
|---|
| 19 | echo "Running ${SELF}"
|
|---|
| 20 | VERSION="2.4.4"
|
|---|
| 21 | DATE=`date +'%Y%m%d'`
|
|---|
| 22 | export DATE
|
|---|
| 23 |
|
|---|
| 24 | # Read in build configuration information
|
|---|
| 25 | # plfs-config should reside in the same directory as this script.
|
|---|
| 26 | # We need to use dirname to determine where to find it as SCRIPTS
|
|---|
| 27 | # env var is not set yet (set in plfs-config itself)
|
|---|
| 28 | . `dirname ${0}`/plfs-config
|
|---|
| 29 |
|
|---|
| 30 | # Sanity check, are ${LFS}, ${HST_TOOLS} and ${TGT_TOOLS} set?
|
|---|
| 31 | if [ "X${LFS}" = "X" -o "X${HST_TOOLS}" = "X" -o "X${TGT_TOOLS}" = "X" ]; then
|
|---|
| 32 | echo "Error: Not all required environment vars have been set." 1>&2
|
|---|
| 33 | echo " Check plfs-config" 1>&2
|
|---|
| 34 | exit 1
|
|---|
| 35 | fi
|
|---|
| 36 |
|
|---|
| 37 | # Get package version information
|
|---|
| 38 | . ${SCRIPTS}/plfs-packages
|
|---|
| 39 |
|
|---|
| 40 | # Source Functions and definitions
|
|---|
| 41 | . ${SCRIPTS}/build-init.sh
|
|---|
| 42 |
|
|---|
| 43 | # Setup PATH
|
|---|
| 44 | export PATH=${HST_TOOLS}/bin:${HST_TOOLS}/sbin:${PATH}
|
|---|
| 45 |
|
|---|
| 46 | set +x
|
|---|
| 47 | unset LD_LIBRARY_PATH
|
|---|
| 48 | unset LD_PRELOAD
|
|---|
| 49 |
|
|---|
| 50 | export LDFLAGS="-s"
|
|---|
| 51 |
|
|---|
| 52 | # If ${SRC} does not exist, create it
|
|---|
| 53 | test -d ${SRC} || mkdir -p ${SRC}
|
|---|
| 54 |
|
|---|
| 55 | # If ${LFS}${TOOLS} directory doesn't exist, create it
|
|---|
| 56 | test -d ${LFS}${TGT_TOOLS} || mkdir -p ${LFS}${TGT_TOOLS}
|
|---|
| 57 |
|
|---|
| 58 | # If ${TGT_TOOLS} symlink doesn't exist, create it
|
|---|
| 59 | test -L ${TGT_TOOLS} || ln -sf ${LFS}${TGT_TOOLS} ${TGT_TOOLS}
|
|---|
| 60 | echo ' o Checking for needed tarballs'
|
|---|
| 61 |
|
|---|
| 62 | mkdir -p ${CONFLOGS}
|
|---|
| 63 | mkdir -p ${BUILDLOGS}
|
|---|
| 64 | mkdir -p ${INSTLOGS}
|
|---|
| 65 | mkdir -p ${TESTLOGS}
|
|---|
| 66 | cd ${SRC}
|
|---|
| 67 |
|
|---|
| 68 | scripts_dir="host-scripts"
|
|---|
| 69 |
|
|---|
| 70 | # Ideally we'd have flex before make, but flex doesn't like being
|
|---|
| 71 | # built with sun's make...
|
|---|
| 72 |
|
|---|
| 73 | script_list="host-m4.sh
|
|---|
| 74 | host-bison.sh
|
|---|
| 75 | host-make.sh
|
|---|
| 76 | host-flex.sh
|
|---|
| 77 | host-gawk.sh
|
|---|
| 78 | host-grep.sh
|
|---|
| 79 | host-sed.sh
|
|---|
| 80 | host-coreutils-binaries.sh
|
|---|
| 81 | host-autoconf.sh
|
|---|
| 82 | host-automake.sh
|
|---|
| 83 | host-libtool.sh
|
|---|
| 84 | host-patch.sh
|
|---|
| 85 | host-binutils.sh
|
|---|
| 86 | host-gcc.sh
|
|---|
| 87 | host-gettext.sh
|
|---|
| 88 | host-ncurses.sh
|
|---|
| 89 | host-texinfo.sh"
|
|---|
| 90 |
|
|---|
| 91 | SCRIPTLIST=`echo "${script_list}" | \
|
|---|
| 92 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
|---|
| 93 |
|
|---|
| 94 | # Check if we are resuming from a particular script
|
|---|
| 95 | test ! -z "${1}" &&
|
|---|
| 96 | {
|
|---|
| 97 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | echo ' o Checking for needed sources and tarballs'
|
|---|
| 101 | check_tarballs ${SCRIPTLIST}
|
|---|
| 102 |
|
|---|
| 103 | for script in ${SCRIPTLIST}; do
|
|---|
| 104 | echo "Running ${SCRIPTS}/${script}"
|
|---|
| 105 | # HACK: export SELF to be the script we are running
|
|---|
| 106 | # (keeps logfile output correct)
|
|---|
| 107 | export SELF=${script}
|
|---|
| 108 | ${SCRIPTS}/${script}
|
|---|
| 109 |
|
|---|
| 110 | test 0 = ${?} ||
|
|---|
| 111 | {
|
|---|
| 112 | echo
|
|---|
| 113 | echo "Failed script was ${script}"
|
|---|
| 114 | echo "Please fix the error above from"
|
|---|
| 115 | echo " ${SCRIPTS}/${script}"
|
|---|
| 116 | echo "and rerun the build with the command"
|
|---|
| 117 | echo
|
|---|
| 118 | echo " ${0} $script"
|
|---|
| 119 | echo
|
|---|
| 120 | echo "to resume the build."
|
|---|
| 121 | exit 1
|
|---|
| 122 | }
|
|---|
| 123 | done
|
|---|