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-n32.sh
|
---|
75 | temp-tcl-64.sh
|
---|
76 | temp-expect-32.sh
|
---|
77 | temp-expect-n32.sh
|
---|
78 | temp-expect-64.sh
|
---|
79 | temp-dejagnu.sh
|
---|
80 | temp-texinfo.sh
|
---|
81 | temp-perl-32.sh
|
---|
82 | temp-perl-n32.sh
|
---|
83 | temp-perl-64.sh
|
---|
84 | copy-kern-hdrs.sh
|
---|
85 | native-glibc-32.sh
|
---|
86 | native-glibc-n32.sh
|
---|
87 | native-glibc-64.sh"
|
---|
88 | } || {
|
---|
89 | script_list="temp-tcl.sh
|
---|
90 | temp-expect.sh
|
---|
91 | temp-dejagnu.sh
|
---|
92 | temp-texinfo.sh
|
---|
93 | temp-perl.sh
|
---|
94 | copy-kern-hdrs.sh
|
---|
95 | native-glibc.sh"
|
---|
96 | }
|
---|
97 |
|
---|
98 | script_list="${script_list}
|
---|
99 | temp-binutils.sh
|
---|
100 | specs-mod.sh
|
---|
101 | native-binutils.sh
|
---|
102 | native-gcc.sh"
|
---|
103 |
|
---|
104 | test Y = "${MULTIARCH}" &&
|
---|
105 | {
|
---|
106 | script_list="${script_list}
|
---|
107 | native-zlib-32.sh
|
---|
108 | native-zlib-n32.sh
|
---|
109 | native-zlib-64.sh"
|
---|
110 | } || {
|
---|
111 | script_list="${script_list}
|
---|
112 | native-zlib.sh"
|
---|
113 | }
|
---|
114 |
|
---|
115 | script_list="${script_list}
|
---|
116 | native-findutils.sh
|
---|
117 | native-gawk.sh"
|
---|
118 |
|
---|
119 | test Y = "${MULTIARCH}" &&
|
---|
120 | {
|
---|
121 | script_list="${script_list}
|
---|
122 | native-ncurses-32.sh
|
---|
123 | native-ncurses-n32.sh
|
---|
124 | native-ncurses-64.sh"
|
---|
125 | } || {
|
---|
126 | script_list="${script_list}
|
---|
127 | native-ncurses.sh"
|
---|
128 | }
|
---|
129 |
|
---|
130 | test Y = "${USE_READLINE}" &&
|
---|
131 | {
|
---|
132 | test Y = "${MULTIARCH}" &&
|
---|
133 | {
|
---|
134 | script_list="${script_list}
|
---|
135 | native-readline-32.sh
|
---|
136 | native-readline-n32.sh
|
---|
137 | native-readline-64.sh"
|
---|
138 | } || {
|
---|
139 | script_list="${script_list}
|
---|
140 | native-readline.sh"
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | script_list="${script_list}
|
---|
145 | native-vim.sh
|
---|
146 | native-m4.sh
|
---|
147 | native-bison.sh
|
---|
148 | native-less.sh
|
---|
149 | native-groff.sh
|
---|
150 | native-coreutils.sh
|
---|
151 | native-sed.sh"
|
---|
152 |
|
---|
153 | test Y = "${MULTIARCH}" &&
|
---|
154 | {
|
---|
155 | script_list="${script_list}
|
---|
156 | native-flex-32.sh
|
---|
157 | native-flex-n32.sh
|
---|
158 | native-flex-64.sh
|
---|
159 | native-gettext-32.sh
|
---|
160 | native-gettext-n32.sh
|
---|
161 | native-gettext-64.sh
|
---|
162 | native-nettools.sh
|
---|
163 | native-inetutils.sh
|
---|
164 | native-iproute2.sh
|
---|
165 | native-perl-32.sh
|
---|
166 | native-perl-n32.sh
|
---|
167 | native-perl-64.sh
|
---|
168 | native-texinfo.sh
|
---|
169 | native-autoconf.sh
|
---|
170 | native-automake.sh
|
---|
171 | native-bash.sh
|
---|
172 | native-file-32.sh
|
---|
173 | native-file-n32.sh
|
---|
174 | native-file-64.sh"
|
---|
175 | } || {
|
---|
176 | script_list="${script_list}
|
---|
177 | native-flex.sh
|
---|
178 | native-gettext.sh
|
---|
179 | native-nettools.sh
|
---|
180 | native-inetutils.sh
|
---|
181 | native-iproute2.sh
|
---|
182 | native-perl.sh
|
---|
183 | native-texinfo.sh
|
---|
184 | native-autoconf.sh
|
---|
185 | native-automake.sh
|
---|
186 | native-bash.sh
|
---|
187 | native-file.sh"
|
---|
188 | }
|
---|
189 |
|
---|
190 | # ARGH libtool.. gonna have to do some
|
---|
191 | # thinking about how to handle this for bi-arch...
|
---|
192 | test Y = "${MULTIARCH}" &&
|
---|
193 | {
|
---|
194 | script_list="${script_list}
|
---|
195 | native-libtool-32.sh
|
---|
196 | native-libtool-n32.sh
|
---|
197 | native-libtool-64.sh"
|
---|
198 | } || {
|
---|
199 | script_list="${script_list}
|
---|
200 | native-libtool.sh"
|
---|
201 | }
|
---|
202 |
|
---|
203 | test Y = "${MULTIARCH}" &&
|
---|
204 | {
|
---|
205 | script_list="${script_list}
|
---|
206 | native-bzip2-32.sh
|
---|
207 | native-bzip2-n32.sh
|
---|
208 | native-bzip2-64.sh"
|
---|
209 | } || {
|
---|
210 | script_list="${script_list}
|
---|
211 | native-bzip2.sh"
|
---|
212 | }
|
---|
213 |
|
---|
214 | script_list="${script_list}
|
---|
215 | native-diffutils.sh
|
---|
216 | native-ed.sh
|
---|
217 | native-kbd.sh
|
---|
218 | native-e2fsprogs.sh
|
---|
219 | native-grep.sh
|
---|
220 | native-gzip.sh
|
---|
221 | native-man.sh
|
---|
222 | native-make.sh
|
---|
223 | native-module-init-tools.sh
|
---|
224 | native-patch.sh
|
---|
225 | native-procinfo.sh"
|
---|
226 |
|
---|
227 | test Y = "${MULTIARCH}" &&
|
---|
228 | {
|
---|
229 | script_list="${script_list}
|
---|
230 | native-procps-32.sh
|
---|
231 | native-procps-n32.sh
|
---|
232 | native-procps-64.sh
|
---|
233 | native-shadow-32.sh
|
---|
234 | native-shadow-n32.sh
|
---|
235 | native-shadow-64.sh"
|
---|
236 | } || {
|
---|
237 | script_list="${script_list}
|
---|
238 | native-procps.sh
|
---|
239 | native-shadow.sh"
|
---|
240 | }
|
---|
241 |
|
---|
242 | script_list="${script_list}
|
---|
243 | native-sysklogd.sh
|
---|
244 | native-sysvinit.sh
|
---|
245 | native-tar.sh
|
---|
246 | native-util-linux.sh
|
---|
247 | native-dev.sh"
|
---|
248 |
|
---|
249 |
|
---|
250 |
|
---|
251 | SCRIPTLIST=`echo "${script_list}" | \
|
---|
252 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
---|
253 |
|
---|
254 | # Check if we are resuming from a particular script
|
---|
255 | test ! -z "${1}" &&
|
---|
256 | {
|
---|
257 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
---|
258 | }
|
---|
259 |
|
---|
260 | echo ' o Checking for needed sources and tarballs'
|
---|
261 | check_tarballs ${SCRIPTLIST}
|
---|
262 |
|
---|
263 | for script in ${SCRIPTLIST}; do
|
---|
264 | echo "Running ${SCRIPTS}/${script}"
|
---|
265 | # HACK: export SELF to be the script we are running
|
---|
266 | # (keeps logfile output correct)
|
---|
267 | export SELF=${script}
|
---|
268 | ${SCRIPTS}/${script}
|
---|
269 |
|
---|
270 | test 0 = ${?} ||
|
---|
271 | {
|
---|
272 | echo
|
---|
273 | echo "Failed script was ${script}"
|
---|
274 | echo "Please fix the error above from"
|
---|
275 | echo " ${SCRIPTS}/${script}"
|
---|
276 | echo "and rerun the build with the command"
|
---|
277 | echo
|
---|
278 | echo " ${0} $script"
|
---|
279 | echo
|
---|
280 | echo "to resume the build."
|
---|
281 | exit 1
|
---|
282 | }
|
---|
283 | done
|
---|