1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # build-native.sh
|
---|
4 | #
|
---|
5 | # Script to finish build for target natively
|
---|
6 | #
|
---|
7 | # Authors: Ryan Oliver <ryan.oliver@pha.com.au
|
---|
8 | # Finn Thain
|
---|
9 | #
|
---|
10 | # $LastChangedBy$
|
---|
11 | # $LastChangedDate$
|
---|
12 | # $LastChangedRevision$
|
---|
13 |
|
---|
14 | set +h
|
---|
15 |
|
---|
16 | # Set SELF to be name of script called, minus any path...
|
---|
17 | SELF=$(basename ${0})
|
---|
18 | echo "Running ${SELF}"
|
---|
19 | VERSION="3.0.1"
|
---|
20 | DATE=$(date +'%Y%m%d')
|
---|
21 | export DATE
|
---|
22 |
|
---|
23 | # Read in build configuration information
|
---|
24 | # plfs-config should reside in the same directory as this script.
|
---|
25 | # We need to use dirname to determine where to find it as SCRIPTS
|
---|
26 | # env var is not set yet (set in plfs-config itself)
|
---|
27 | . `dirname ${0}`/plfs-config
|
---|
28 |
|
---|
29 | # Sanity check, are ${LFS}, ${HST_TOOLS} and ${TGT_TOOLS} set?
|
---|
30 | if [ "X${LFS}" = "X" -o "X${HST_TOOLS}" = "X" -o "X${TGT_TOOLS}" = "X" ]; then
|
---|
31 | echo "Error: Not all required environment vars have been set." 1>&2
|
---|
32 | echo " Check plfs-config" 1>&2
|
---|
33 | exit 1
|
---|
34 | fi
|
---|
35 |
|
---|
36 | export LFS=""
|
---|
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 | # Configure uses these if set, and will not look for a cross-compiler
|
---|
50 | unset CC CXX
|
---|
51 |
|
---|
52 | export LDFLAGS="-s"
|
---|
53 |
|
---|
54 | # Setup PATH
|
---|
55 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
---|
56 | export PATH=${PATH}:${TGT_TOOLS}/bin:${TGT_TOOLS}/sbin
|
---|
57 |
|
---|
58 | # If ${SRC} does not exist, create it
|
---|
59 | test -d ${SRC} || mkdir -p ${SRC}
|
---|
60 |
|
---|
61 | mkdir -p ${CONFLOGS}
|
---|
62 | mkdir -p ${BUILDLOGS}
|
---|
63 | mkdir -p ${INSTLOGS}
|
---|
64 | mkdir -p ${TESTLOGS}
|
---|
65 | cd ${SRC}
|
---|
66 |
|
---|
67 | #scripts_dir="cross-scripts-${VERSION}"
|
---|
68 | scripts_dir="native-scripts"
|
---|
69 |
|
---|
70 | # scripts for building target tools
|
---|
71 | test "Y" = "${MULTIARCH}" &&
|
---|
72 | {
|
---|
73 | script_list="temp-tcl-32.sh
|
---|
74 | temp-tcl-64.sh
|
---|
75 | temp-expect-32.sh
|
---|
76 | temp-expect-64.sh
|
---|
77 | temp-dejagnu.sh
|
---|
78 | temp-texinfo.sh
|
---|
79 | temp-perl-32.sh
|
---|
80 | temp-perl-64.sh
|
---|
81 | copy-kern-hdrs.sh
|
---|
82 | native-glibc-32.sh
|
---|
83 | native-glibc-64.sh"
|
---|
84 | } || {
|
---|
85 | script_list="temp-tcl.sh
|
---|
86 | temp-expect.sh
|
---|
87 | temp-dejagnu.sh
|
---|
88 | temp-texinfo.sh
|
---|
89 | temp-perl.sh
|
---|
90 | copy-kern-hdrs.sh
|
---|
91 | native-glibc.sh"
|
---|
92 | }
|
---|
93 |
|
---|
94 | script_list="${script_list}
|
---|
95 | temp-binutils.sh
|
---|
96 | specs-mod.sh
|
---|
97 | native-binutils.sh
|
---|
98 | native-gcc.sh"
|
---|
99 |
|
---|
100 | test Y = "${MULTIARCH}" &&
|
---|
101 | {
|
---|
102 | script_list="${script_list}
|
---|
103 | native-zlib-32.sh
|
---|
104 | native-zlib-64.sh"
|
---|
105 | } || {
|
---|
106 | script_list="${script_list}
|
---|
107 | native-zlib.sh"
|
---|
108 | }
|
---|
109 |
|
---|
110 | script_list="${script_list}
|
---|
111 | native-findutils.sh
|
---|
112 | native-gawk.sh"
|
---|
113 |
|
---|
114 | test Y = "${MULTIARCH}" &&
|
---|
115 | {
|
---|
116 | script_list="${script_list}
|
---|
117 | native-ncurses-32.sh
|
---|
118 | native-ncurses-64.sh"
|
---|
119 | } || {
|
---|
120 | script_list="${script_list}
|
---|
121 | native-ncurses.sh"
|
---|
122 | }
|
---|
123 |
|
---|
124 | test Y = "${USE_READLINE}" &&
|
---|
125 | {
|
---|
126 | test Y = "${MULTIARCH}" &&
|
---|
127 | {
|
---|
128 | script_list="${script_list}
|
---|
129 | native-readline-32.sh
|
---|
130 | native-readline-64.sh"
|
---|
131 | } || {
|
---|
132 | script_list="${script_list}
|
---|
133 | native-readline.sh"
|
---|
134 | }
|
---|
135 | }
|
---|
136 |
|
---|
137 | script_list="${script_list}
|
---|
138 | native-vim.sh
|
---|
139 | native-m4.sh
|
---|
140 | native-bison.sh
|
---|
141 | native-less.sh
|
---|
142 | native-groff.sh
|
---|
143 | native-coreutils.sh
|
---|
144 | native-sed.sh"
|
---|
145 |
|
---|
146 | test Y = "${MULTIARCH}" &&
|
---|
147 | {
|
---|
148 | script_list="${script_list}
|
---|
149 | native-flex-32.sh
|
---|
150 | native-flex-64.sh
|
---|
151 | native-gettext-32.sh
|
---|
152 | native-gettext-64.sh
|
---|
153 | native-nettools.sh
|
---|
154 | native-inetutils.sh
|
---|
155 | native-iproute2.sh
|
---|
156 | native-perl-32.sh
|
---|
157 | native-perl-64.sh
|
---|
158 | native-texinfo.sh
|
---|
159 | native-autoconf.sh
|
---|
160 | native-automake.sh
|
---|
161 | native-bash.sh
|
---|
162 | native-file-32.sh
|
---|
163 | native-file-64.sh"
|
---|
164 | } || {
|
---|
165 | script_list="${script_list}
|
---|
166 | native-flex.sh
|
---|
167 | native-gettext.sh
|
---|
168 | native-nettools.sh
|
---|
169 | native-inetutils.sh
|
---|
170 | native-iproute2.sh
|
---|
171 | native-perl.sh
|
---|
172 | native-texinfo.sh
|
---|
173 | native-autoconf.sh
|
---|
174 | native-automake.sh
|
---|
175 | native-bash.sh
|
---|
176 | native-file.sh"
|
---|
177 | }
|
---|
178 |
|
---|
179 | # ARGH libtool.. gonna have to do some
|
---|
180 | # thinking about how to handle this for bi-arch...
|
---|
181 | test Y = "${MULTIARCH}" &&
|
---|
182 | {
|
---|
183 | script_list="${script_list}
|
---|
184 | native-libtool-32.sh
|
---|
185 | native-libtool-64.sh"
|
---|
186 | } || {
|
---|
187 | script_list="${script_list}
|
---|
188 | native-libtool.sh"
|
---|
189 | }
|
---|
190 |
|
---|
191 | test Y = "${MULTIARCH}" &&
|
---|
192 | {
|
---|
193 | script_list="${script_list}
|
---|
194 | native-bzip2-32.sh
|
---|
195 | native-bzip2-64.sh"
|
---|
196 | } || {
|
---|
197 | script_list="${script_list}
|
---|
198 | native-bzip2.sh"
|
---|
199 | }
|
---|
200 |
|
---|
201 | script_list="${script_list}
|
---|
202 | native-diffutils.sh
|
---|
203 | native-ed.sh
|
---|
204 | native-kbd.sh
|
---|
205 | native-e2fsprogs.sh
|
---|
206 | native-grep.sh
|
---|
207 | native-gzip.sh
|
---|
208 | native-man.sh
|
---|
209 | native-make.sh
|
---|
210 | native-module-init-tools.sh
|
---|
211 | native-patch.sh
|
---|
212 | native-procinfo.sh"
|
---|
213 |
|
---|
214 | test Y = "${MULTIARCH}" &&
|
---|
215 | {
|
---|
216 | script_list="${script_list}
|
---|
217 | native-procps-32.sh
|
---|
218 | native-procps-64.sh
|
---|
219 | native-shadow-32.sh
|
---|
220 | native-shadow-64.sh"
|
---|
221 | } || {
|
---|
222 | script_list="${script_list}
|
---|
223 | native-procps.sh
|
---|
224 | native-shadow.sh"
|
---|
225 | }
|
---|
226 |
|
---|
227 | script_list="${script_list}
|
---|
228 | native-sysklogd.sh
|
---|
229 | native-sysvinit.sh
|
---|
230 | native-tar.sh
|
---|
231 | native-util-linux.sh
|
---|
232 | native-dev.sh"
|
---|
233 |
|
---|
234 | # Final setup of profile/bashrc scripts etc
|
---|
235 | script_list="${script_list}
|
---|
236 | post-lfs-configuration.sh"
|
---|
237 |
|
---|
238 | SCRIPTLIST=`echo "${script_list}" | \
|
---|
239 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
---|
240 |
|
---|
241 | # Check if we are resuming from a particular script
|
---|
242 | test ! -z "${1}" &&
|
---|
243 | {
|
---|
244 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
---|
245 | }
|
---|
246 |
|
---|
247 | echo ' o Checking for needed sources and tarballs'
|
---|
248 | check_tarballs ${SCRIPTLIST}
|
---|
249 |
|
---|
250 | for script in ${SCRIPTLIST}; do
|
---|
251 | echo "Running ${SCRIPTS}/${script}"
|
---|
252 | # HACK: export SELF to be the script we are running
|
---|
253 | # (keeps logfile output correct)
|
---|
254 | export SELF=${script}
|
---|
255 | ${SCRIPTS}/${script}
|
---|
256 |
|
---|
257 | test 0 = ${?} ||
|
---|
258 | {
|
---|
259 | echo
|
---|
260 | echo "Failed script was ${script}"
|
---|
261 | echo "Please fix the error above from"
|
---|
262 | echo " ${SCRIPTS}/${script}"
|
---|
263 | echo "and rerun the build with the command"
|
---|
264 | echo
|
---|
265 | echo " ${0} $script"
|
---|
266 | echo
|
---|
267 | echo "to resume the build."
|
---|
268 | exit 1
|
---|
269 | }
|
---|
270 | done
|
---|