1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # build-cross-2.4.4.sh
|
---|
4 | #
|
---|
5 | # Master script for cross building LFS chapter 5.
|
---|
6 | #
|
---|
7 | # Authors: Ryan Oliver <ryan.oliver@pha.com.au
|
---|
8 | # Finn Thain
|
---|
9 | #
|
---|
10 | # $LastChangedBy$
|
---|
11 | # $LastChangedDate$
|
---|
12 | # $LastChangedRevision$
|
---|
13 |
|
---|
14 | # Set SELF to be name of script called, minus any path...
|
---|
15 |
|
---|
16 | # turn off bash command hash
|
---|
17 | set +h
|
---|
18 |
|
---|
19 | SELF=$(basename ${0})
|
---|
20 | echo "Running ${SELF}"
|
---|
21 | VERSION="2.4.4"
|
---|
22 | DATE=$(date +'%Y%m%d')
|
---|
23 | export DATE
|
---|
24 |
|
---|
25 | # Read in build configuration information
|
---|
26 | # plfs-config should reside in the same directory as this script.
|
---|
27 | # We need to use dirname to determine where to find it as SCRIPTS
|
---|
28 | # env var is not set yet (set in plfs-config itself)
|
---|
29 | . `dirname ${0}`/plfs-config
|
---|
30 |
|
---|
31 | # Sanity check, are ${LFS}, ${HST_TOOLS} and ${TGT_TOOLS} set?
|
---|
32 | if [ "X${LFS}" = "X" -o "X${HST_TOOLS}" = "X" -o "X${TGT_TOOLS}" = "X" ]; then
|
---|
33 | echo "Error: Not all required environment vars have been set." 1>&2
|
---|
34 | echo " Check plfs-config" 1>&2
|
---|
35 | exit 1
|
---|
36 | fi
|
---|
37 |
|
---|
38 | # Get package version information
|
---|
39 | . ${SCRIPTS}/plfs-packages
|
---|
40 |
|
---|
41 | # Source Functions and definitions
|
---|
42 | . ${SCRIPTS}/build-init.sh
|
---|
43 |
|
---|
44 |
|
---|
45 | set +x
|
---|
46 | unset LD_LIBRARY_PATH
|
---|
47 | unset LD_PRELOAD
|
---|
48 |
|
---|
49 | export LDFLAGS="-s"
|
---|
50 |
|
---|
51 | # Setup PATH
|
---|
52 | #export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
---|
53 | export PATH=${HST_TOOLS}/bin:${HST_TOOLS}/sbin:${PATH}
|
---|
54 |
|
---|
55 | # If using distcc, expect that user has set up their own symlinks
|
---|
56 | #export DISTCC_HOSTS="localhost sirius"
|
---|
57 | #DISTCCDIR=/usr/distcc/bin
|
---|
58 | #export PATH=${DISTCCDIR}:${PATH}
|
---|
59 |
|
---|
60 | # If ${SRC} does not exist, create it
|
---|
61 | test -d ${SRC} || mkdir -p ${SRC}
|
---|
62 |
|
---|
63 | # If ${LFS} directory doesn't exist, create it
|
---|
64 | test -d ${LFS} || mkdir -p ${LFS}
|
---|
65 |
|
---|
66 | if [ ! "${USE_SYSROOT}" = "Y" ]; then
|
---|
67 | # If ${LFS}${TGT_TOOLS} directory doesn't exist, create it
|
---|
68 | test -d ${LFS}${TGT_TOOLS} || mkdir -p ${LFS}${TGT_TOOLS}
|
---|
69 |
|
---|
70 | # create it ${TGT_TOOLS} symlink
|
---|
71 | if [ ! -d `dirname ${TGT_TOOLS}` ]; then mkdir -p `dirname ${TGT_TOOLS}` ; fi
|
---|
72 | ln -sf ${LFS}${TGT_TOOLS} `dirname ${TGT_TOOLS}`
|
---|
73 | fi
|
---|
74 |
|
---|
75 | mkdir -p ${CONFLOGS}
|
---|
76 | mkdir -p ${BUILDLOGS}
|
---|
77 | mkdir -p ${INSTLOGS}
|
---|
78 | mkdir -p ${TESTLOGS}
|
---|
79 | cd ${SRC}
|
---|
80 |
|
---|
81 | #scripts_dir="cross-scripts-${VERSION}"
|
---|
82 | scripts_dir="cross-scripts"
|
---|
83 |
|
---|
84 | test "Y" = "${USE_SANITISED_HEADERS}" &&
|
---|
85 | {
|
---|
86 | script_list="cross-kern-hdrs.sh
|
---|
87 | cross-san-kern-hdrs.sh"
|
---|
88 | } || {
|
---|
89 | script_list="cross-kern-hdrs.sh"
|
---|
90 | }
|
---|
91 |
|
---|
92 | script_list="${script_list}
|
---|
93 | cross-binutils.sh
|
---|
94 | cross-glibc-hdrs.sh
|
---|
95 | cross-gcc-static.sh"
|
---|
96 |
|
---|
97 | if [ ! "Y" = "${NO_GCC_EH}" ]; then
|
---|
98 | if [ "Y" = "${MULTIARCH}" ]; then
|
---|
99 | script_list="${script_list}
|
---|
100 | cross-glibc-crtobjs-32.sh
|
---|
101 | cross-glibc-crtobjs-64.sh
|
---|
102 | cross-gcc-shared.sh"
|
---|
103 | else
|
---|
104 | script_list="${script_list}
|
---|
105 | cross-glibc-crtobjs.sh
|
---|
106 | cross-gcc-shared.sh"
|
---|
107 | fi
|
---|
108 | fi
|
---|
109 |
|
---|
110 |
|
---|
111 | if [ "Y" = "${MULTIARCH}" ]; then
|
---|
112 | if [ "N" = "${DEFAULT_64}" ]; then
|
---|
113 | script_list="${script_list}
|
---|
114 | cross-glibc-full-64.sh
|
---|
115 | cross-glibc-full-32.sh
|
---|
116 | cross-gcc-final.sh"
|
---|
117 | else
|
---|
118 | script_list="${script_list}
|
---|
119 | cross-glibc-full-32.sh
|
---|
120 | cross-glibc-full-64.sh
|
---|
121 | cross-gcc-final.sh"
|
---|
122 | fi
|
---|
123 | else
|
---|
124 | script_list="${script_list}
|
---|
125 | cross-glibc-full.sh
|
---|
126 | cross-gcc-final.sh"
|
---|
127 | fi
|
---|
128 |
|
---|
129 | SCRIPTLIST=`echo "${script_list}" | \
|
---|
130 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
---|
131 |
|
---|
132 | # Check if we are resuming from a particular script
|
---|
133 | test ! -z "${1}" &&
|
---|
134 | {
|
---|
135 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
---|
136 | }
|
---|
137 |
|
---|
138 | echo ' o Checking for needed sources and tarballs'
|
---|
139 | check_tarballs ${SCRIPTLIST}
|
---|
140 |
|
---|
141 | for script in ${SCRIPTLIST}; do
|
---|
142 | echo "Running ${SCRIPTS}/${script}"
|
---|
143 | # HACK: export SELF to be the script we are running
|
---|
144 | # (keeps logfile output correct)
|
---|
145 | export SELF=${script}
|
---|
146 | ${SCRIPTS}/${script}
|
---|
147 |
|
---|
148 | test 0 = ${?} ||
|
---|
149 | {
|
---|
150 | echo
|
---|
151 | echo "Failed script was ${script}"
|
---|
152 | echo "Please fix the error above from"
|
---|
153 | echo " ${SCRIPTS}/${script}"
|
---|
154 | echo "and rerun the build with the command"
|
---|
155 | echo
|
---|
156 | echo " ${0} $script"
|
---|
157 | echo
|
---|
158 | echo "to resume the build."
|
---|
159 | exit 1
|
---|
160 | }
|
---|
161 | done
|
---|