1 | #!/bin/sh
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | ###################################
|
---|
5 | ### FUNCTIONS ###
|
---|
6 | ###################################
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | #----------------------------#
|
---|
11 | host_prep_Makefiles() { # Initialization of the system
|
---|
12 | #----------------------------#
|
---|
13 | local LFS_HOST
|
---|
14 |
|
---|
15 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
16 |
|
---|
17 | # defined here, only for ease of reading
|
---|
18 | LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
|
---|
19 | (
|
---|
20 | cat << EOF
|
---|
21 | 023-creatingtoolsdir:
|
---|
22 | @\$(call echo_message, Building)
|
---|
23 | @mkdir -v \$(MOUNT_PT)/tools && \\
|
---|
24 | rm -fv /tools && \\
|
---|
25 | ln -sv \$(MOUNT_PT)/tools /
|
---|
26 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
27 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
28 | fi;
|
---|
29 | @chmod a+wt \$(MOUNT_PT)/sources && \\
|
---|
30 | touch \$@
|
---|
31 |
|
---|
32 | 024-creatingcrossdir: 023-creatingtoolsdir
|
---|
33 | @mkdir -v \$(MOUNT_PT)/cross-tools && \\
|
---|
34 | rm -fv /cross-tools && \\
|
---|
35 | ln -sv \$(MOUNT_PT)/cross-tools /
|
---|
36 | @touch \$@
|
---|
37 |
|
---|
38 | 025-addinguser: 024-creatingcrossdir
|
---|
39 | @\$(call echo_message, Building)
|
---|
40 | @if [ ! -d /home/lfs ]; then \\
|
---|
41 | groupadd lfs; \\
|
---|
42 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
---|
43 | else \\
|
---|
44 | touch user-lfs-exist; \\
|
---|
45 | fi;
|
---|
46 | @chown lfs \$(MOUNT_PT) && \\
|
---|
47 | chown lfs \$(MOUNT_PT)/tools && \\
|
---|
48 | chown lfs \$(MOUNT_PT)/cross-tools && \\
|
---|
49 | chown lfs \$(MOUNT_PT)/sources && \\
|
---|
50 | touch \$@
|
---|
51 |
|
---|
52 | 026-settingenvironment: 025-addinguser
|
---|
53 | @\$(call echo_message, Building)
|
---|
54 | @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
55 | mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
---|
56 | fi;
|
---|
57 | @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
58 | mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
---|
59 | fi;
|
---|
60 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
61 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
62 | echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
---|
63 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
64 | echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
65 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
66 | echo "" >> /home/lfs/.bashrc && \\
|
---|
67 | echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
|
---|
68 | echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
|
---|
69 | echo "" >> /home/lfs/.bashrc && \\
|
---|
70 | echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
|
---|
71 | echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
|
---|
72 | echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
|
---|
73 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
|
---|
74 | @chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
75 | touch envars && \\
|
---|
76 | touch \$@
|
---|
77 | EOF
|
---|
78 | ) >> $MKFILE.tmp
|
---|
79 |
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 | #-----------------------------#
|
---|
85 | cross_tools_Makefiles() { #
|
---|
86 | #-----------------------------#
|
---|
87 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
88 |
|
---|
89 | for file in cross-tools/* ; do
|
---|
90 | # Keep the script file name
|
---|
91 | this_script=`basename $file`
|
---|
92 | #
|
---|
93 | # Skip this script...
|
---|
94 | case $this_script in
|
---|
95 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
96 | continue; ;;
|
---|
97 | *) ;;
|
---|
98 | esac
|
---|
99 | #
|
---|
100 | # Set the dependency for the first target.
|
---|
101 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
102 |
|
---|
103 | # First append each name of the script files to a list (this will become
|
---|
104 | # the names of the targets in the Makefile
|
---|
105 | cross_tools="$cross_tools $this_script"
|
---|
106 |
|
---|
107 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
108 | # and binutils in chapter 5)
|
---|
109 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
110 | -e 's@-static@@' \
|
---|
111 | -e 's@-final@@' \
|
---|
112 | -e 's@-headers@@' \
|
---|
113 | -e 's@-64@@' \
|
---|
114 | -e 's@-n32@@'`
|
---|
115 | # Adjust 'name' and patch a few scripts on the fly..
|
---|
116 | case $name in
|
---|
117 | linux-libc) name=linux-libc-headers ;;
|
---|
118 | esac
|
---|
119 | #
|
---|
120 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
121 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
122 |
|
---|
123 |
|
---|
124 | #--------------------------------------------------------------------#
|
---|
125 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
126 | #--------------------------------------------------------------------#
|
---|
127 | #
|
---|
128 | # Drop in the name of the target on a new line, and the previous target
|
---|
129 | # as a dependency. Also call the echo_message function.
|
---|
130 | wrt_target "${this_script}" "$PREV"
|
---|
131 | #
|
---|
132 | # If $vrs isn't empty, we've got a package...
|
---|
133 | #
|
---|
134 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
135 | #
|
---|
136 | wrt_run_as_su "${this_script}" "${file}"
|
---|
137 | #
|
---|
138 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
139 | #
|
---|
140 | # Include a touch of the target name so make can check if it's already been made.
|
---|
141 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
142 | #
|
---|
143 | #--------------------------------------------------------------------#
|
---|
144 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
145 | #--------------------------------------------------------------------#
|
---|
146 | #
|
---|
147 | # Keep the script file name for Makefile dependencies.
|
---|
148 | PREV=$this_script
|
---|
149 |
|
---|
150 | done # for file in ....
|
---|
151 | }
|
---|
152 |
|
---|
153 |
|
---|
154 | #-----------------------------#
|
---|
155 | temptools_Makefiles() { #
|
---|
156 | #-----------------------------#
|
---|
157 | echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
|
---|
158 |
|
---|
159 | for file in temp-system/* ; do
|
---|
160 | # Keep the script file name
|
---|
161 | this_script=`basename $file`
|
---|
162 | #
|
---|
163 | # First append each name of the script files to a list (this will become
|
---|
164 | # the names of the targets in the Makefile
|
---|
165 | temptools="$temptools $this_script"
|
---|
166 |
|
---|
167 | #
|
---|
168 | # Grab the name of the target, strip id number, XXX-script
|
---|
169 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
170 | #
|
---|
171 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
172 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
173 |
|
---|
174 |
|
---|
175 | #--------------------------------------------------------------------#
|
---|
176 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
177 | #--------------------------------------------------------------------#
|
---|
178 | #
|
---|
179 | # Drop in the name of the target on a new line, and the previous target
|
---|
180 | # as a dependency. Also call the echo_message function.
|
---|
181 | wrt_target "${this_script}" "$PREV"
|
---|
182 | #
|
---|
183 | # If $vrs isn't empty, we've got a package...
|
---|
184 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
185 | #
|
---|
186 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
187 | #
|
---|
188 | wrt_run_as_su "${this_script}" "${file}"
|
---|
189 | #
|
---|
190 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
191 | #
|
---|
192 | # Include a touch of the target name so make can check if it's already been made.
|
---|
193 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
194 | #
|
---|
195 | #--------------------------------------------------------------------#
|
---|
196 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
197 | #--------------------------------------------------------------------#
|
---|
198 | #
|
---|
199 | # Keep the script file name for Makefile dependencies.
|
---|
200 | PREV=$this_script
|
---|
201 | done # for file in ....
|
---|
202 | }
|
---|
203 |
|
---|
204 |
|
---|
205 | #-----------------------------#
|
---|
206 | boot_Makefiles() { #
|
---|
207 | #-----------------------------#
|
---|
208 | echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
|
---|
209 |
|
---|
210 | for file in boot/* ; do
|
---|
211 | # Keep the script file name
|
---|
212 | this_script=`basename $file`
|
---|
213 |
|
---|
214 | # A little housekeeping on the scripts
|
---|
215 | case $this_script in
|
---|
216 | *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
|
---|
217 | *whatnext*) continue ;;
|
---|
218 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
219 | [[ -z $CONFIG ]] && continue
|
---|
220 | # Copy the config file to /sources with a standardized name
|
---|
221 | cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
|
---|
222 | ;;
|
---|
223 | esac
|
---|
224 | #
|
---|
225 | # First append each name of the script files to a list (this will become
|
---|
226 | # the names of the targets in the Makefile
|
---|
227 | boottools="$boottools $this_script"
|
---|
228 | #
|
---|
229 | # Grab the name of the target, strip id number and misc words.
|
---|
230 | case $this_script in
|
---|
231 | *kernel) name=linux ;;
|
---|
232 | *bootscripts) name="bootscripts-cross-lfs" ;;
|
---|
233 | *udev-rules) name="udev-cross-lfs" ;;
|
---|
234 | *grub-build) name=grub ;;
|
---|
235 | *-aboot-build) name=aboot ;;
|
---|
236 | *yaboot-build) name=yaboot ;;
|
---|
237 | *colo-build) name=colo ;;
|
---|
238 | *silo-build) name=silo ;;
|
---|
239 | *arcload-build) name=arcload ;;
|
---|
240 | *lilo-build) name=lilo ;;
|
---|
241 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
242 | esac
|
---|
243 |
|
---|
244 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
245 |
|
---|
246 | #--------------------------------------------------------------------#
|
---|
247 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
248 | #--------------------------------------------------------------------#
|
---|
249 | #
|
---|
250 | # Drop in the name of the target on a new line, and the previous target
|
---|
251 | # as a dependency. Also call the echo_message function.
|
---|
252 | wrt_target "${this_script}" "$PREV"
|
---|
253 | #
|
---|
254 | # If $vrs isn't empty, we've got a package...
|
---|
255 | # Insert instructions for unpacking the package and changing directories
|
---|
256 | #
|
---|
257 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
258 | #
|
---|
259 | # Select a script execution method
|
---|
260 | case $this_script in
|
---|
261 | *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
262 | *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
263 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
264 | wrt_copy_fstab "${this_script}"
|
---|
265 | else
|
---|
266 | wrt_run_as_su "${this_script}" "${file}"
|
---|
267 | fi
|
---|
268 | ;;
|
---|
269 | *) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
270 | esac
|
---|
271 | #
|
---|
272 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
273 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
274 | #
|
---|
275 | # Include a touch of the target name so make can check if it's already been made.
|
---|
276 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
277 | #
|
---|
278 | #--------------------------------------------------------------------#
|
---|
279 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
280 | #--------------------------------------------------------------------#
|
---|
281 | #
|
---|
282 | # Keep the script file name for Makefile dependencies.
|
---|
283 | PREV=$this_script
|
---|
284 |
|
---|
285 | done
|
---|
286 | }
|
---|
287 |
|
---|
288 |
|
---|
289 | #-----------------------------#
|
---|
290 | chroot_Makefiles() { #
|
---|
291 | #-----------------------------#
|
---|
292 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
293 |
|
---|
294 | for file in chroot/* ; do
|
---|
295 | # Keep the script file name
|
---|
296 | this_script=`basename $file`
|
---|
297 | #
|
---|
298 | # Skipping scripts is done now and not included in the build tree.
|
---|
299 | case $this_script in
|
---|
300 | *chroot*) continue ;;
|
---|
301 | esac
|
---|
302 |
|
---|
303 | #
|
---|
304 | # First append each name of the script files to a list (this will become
|
---|
305 | # the names of the targets in the Makefile
|
---|
306 | chroottools="$chroottools $this_script"
|
---|
307 |
|
---|
308 | # Grab the name of the target, strip id number, XXX-script
|
---|
309 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
310 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
311 |
|
---|
312 | #--------------------------------------------------------------------#
|
---|
313 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
314 | #--------------------------------------------------------------------#
|
---|
315 | #
|
---|
316 | # Drop in the name of the target on a new line, and the previous target
|
---|
317 | # as a dependency. Also call the echo_message function.
|
---|
318 | wrt_target "${this_script}" "$PREV"
|
---|
319 | #
|
---|
320 | # If $vrs isn't empty, we've got a package...
|
---|
321 | # Insert instructions for unpacking the package and changing directories
|
---|
322 | #
|
---|
323 | if [ "$vrs" != "" ] ; then
|
---|
324 | case $this_script in
|
---|
325 | *util-linux) wrt_unpack "$name-$vrs.tar.*" ;;
|
---|
326 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
327 | esac
|
---|
328 | fi
|
---|
329 | #
|
---|
330 | # Select a script execution method
|
---|
331 | case $this_script in
|
---|
332 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
333 | *util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
334 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
335 | esac
|
---|
336 | #
|
---|
337 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
338 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
339 | #
|
---|
340 | # Include a touch of the target name so make can check if it's already been made.
|
---|
341 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
342 | #
|
---|
343 | #--------------------------------------------------------------------#
|
---|
344 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
345 | #--------------------------------------------------------------------#
|
---|
346 | #
|
---|
347 | # Keep the script file name for Makefile dependencies.
|
---|
348 | PREV=$this_script
|
---|
349 |
|
---|
350 | done # for file in...
|
---|
351 | }
|
---|
352 |
|
---|
353 |
|
---|
354 | #-----------------------------#
|
---|
355 | testsuite_tools_Makefiles() { #
|
---|
356 | #-----------------------------#
|
---|
357 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
358 |
|
---|
359 | for file in testsuite-tools/* ; do
|
---|
360 | # Keep the script file name
|
---|
361 | this_script=`basename $file`
|
---|
362 |
|
---|
363 | # First append each name of the script files to a list (this will become
|
---|
364 | # the names of the targets in the Makefile
|
---|
365 | testsuitetools="$testsuitetools $this_script"
|
---|
366 |
|
---|
367 | # Grab the name of the target, strip id number, XXX-script
|
---|
368 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
369 | -e 's@-64bit@@' \
|
---|
370 | -e 's@-64@@' \
|
---|
371 | -e 's@64@@' \
|
---|
372 | -e 's@n32@@'`
|
---|
373 |
|
---|
374 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
375 |
|
---|
376 | #--------------------------------------------------------------------#
|
---|
377 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
378 | #--------------------------------------------------------------------#
|
---|
379 | #
|
---|
380 | # Drop in the name of the target on a new line, and the previous target
|
---|
381 | # as a dependency. Also call the echo_message function.
|
---|
382 | wrt_target "${this_script}" "$PREV"
|
---|
383 | #
|
---|
384 | case $name in
|
---|
385 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
386 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
387 | esac
|
---|
388 | #
|
---|
389 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
390 | #
|
---|
391 | wrt_remove_build_dirs "${name}"
|
---|
392 | #
|
---|
393 | # Include a touch of the target name so make can check if it's already been made.
|
---|
394 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
395 | #
|
---|
396 | #--------------------------------------------------------------------#
|
---|
397 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
398 | #--------------------------------------------------------------------#
|
---|
399 | #
|
---|
400 | # Keep the script file name for Makefile dependencies.
|
---|
401 | PREV=$this_script
|
---|
402 |
|
---|
403 | done
|
---|
404 | }
|
---|
405 |
|
---|
406 |
|
---|
407 | #--------------------------------#
|
---|
408 | bm_testsuite_tools_Makefiles() { #
|
---|
409 | #--------------------------------#
|
---|
410 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
411 |
|
---|
412 | for file in testsuite-tools/* ; do
|
---|
413 | # Keep the script file name
|
---|
414 | this_script=`basename $file`
|
---|
415 |
|
---|
416 | # First append each name of the script files to a list (this will become
|
---|
417 | # the names of the targets in the Makefile
|
---|
418 | PREV=
|
---|
419 | testsuitetools="$testsuitetools $this_script"
|
---|
420 |
|
---|
421 | # Grab the name of the target, strip id number, XXX-script
|
---|
422 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
423 | -e 's@-64bit@@' \
|
---|
424 | -e 's@-64@@' \
|
---|
425 | -e 's@64@@' \
|
---|
426 | -e 's@n32@@'`
|
---|
427 |
|
---|
428 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
429 |
|
---|
430 | #--------------------------------------------------------------------#
|
---|
431 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
432 | #--------------------------------------------------------------------#
|
---|
433 | #
|
---|
434 | # Drop in the name of the target on a new line, and the previous target
|
---|
435 | # as a dependency. Also call the echo_message function.
|
---|
436 | wrt_target "${this_script}" "$PREV"
|
---|
437 | #
|
---|
438 | case $name in
|
---|
439 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
440 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
441 | esac
|
---|
442 | #
|
---|
443 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
444 | #
|
---|
445 | wrt_remove_build_dirs2 "${name}"
|
---|
446 | #
|
---|
447 | # Include a touch of the target name so make can check if it's already been made.
|
---|
448 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
449 | #
|
---|
450 | #--------------------------------------------------------------------#
|
---|
451 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
452 | #--------------------------------------------------------------------#
|
---|
453 | #
|
---|
454 | # Keep the script file name for Makefile dependencies.
|
---|
455 | PREV=$this_script
|
---|
456 |
|
---|
457 | done
|
---|
458 | }
|
---|
459 |
|
---|
460 |
|
---|
461 | #-----------------------------#
|
---|
462 | final_system_Makefiles() { #
|
---|
463 | #-----------------------------#
|
---|
464 | # Set envars and scripts for iteration targets
|
---|
465 | LOGS="" # Start with an empty global LOGS envar
|
---|
466 | if [[ -z "$1" ]] ; then
|
---|
467 | local N=""
|
---|
468 | else
|
---|
469 | local N=-build_$1
|
---|
470 | local basicsystem=""
|
---|
471 | mkdir final-system$N
|
---|
472 | cp final-system/* final-system$N
|
---|
473 | for script in final-system$N/* ; do
|
---|
474 | # Overwrite existing symlinks, files, and dirs
|
---|
475 | sed -e 's/ln -sv/&f/g' \
|
---|
476 | -e 's/mv -v/&f/g' \
|
---|
477 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
478 | done
|
---|
479 | # Remove Bzip2 binaries before make install
|
---|
480 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
|
---|
481 | # Fix how Module-Init-Tools do the install target
|
---|
482 | sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
|
---|
483 | # Delete *old Readline libraries just after make install
|
---|
484 | sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
|
---|
485 | fi
|
---|
486 |
|
---|
487 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N${R_arrow}"
|
---|
488 |
|
---|
489 | for file in final-system$N/* ; do
|
---|
490 | # Keep the script file name
|
---|
491 | this_script=`basename $file`
|
---|
492 |
|
---|
493 | # Test if the stripping phase must be skipped.
|
---|
494 | # Skip alsp temp-perl for iterative runs
|
---|
495 | case $this_script in
|
---|
496 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
497 | *temp-perl*) [[ -n "$N" ]] && continue ;;
|
---|
498 | esac
|
---|
499 |
|
---|
500 | # Grab the name of the target, strip id number, XXX-script
|
---|
501 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
502 | -e 's@temp-@@' \
|
---|
503 | -e 's@-64bit@@' \
|
---|
504 | -e 's@-64@@' \
|
---|
505 | -e 's@64@@' \
|
---|
506 | -e 's@n32@@'`
|
---|
507 |
|
---|
508 | # Find the version of the command files, if it corresponds with the building of
|
---|
509 | # a specific package. We need this here to can skip scripts not needed for
|
---|
510 | # iterations rebuilds
|
---|
511 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
512 |
|
---|
513 | if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
|
---|
514 | case "${this_script}" in
|
---|
515 | *stripping*) ;;
|
---|
516 | *) continue ;;
|
---|
517 | esac
|
---|
518 | fi
|
---|
519 |
|
---|
520 | # Append each name of the script files to a list (this will become
|
---|
521 | # the names of the targets in the Makefile
|
---|
522 | basicsystem="$basicsystem ${this_script}${N}"
|
---|
523 |
|
---|
524 | # Append each name of the script files to a list (this will become
|
---|
525 | # the names of the logs to be moved for each iteration)
|
---|
526 | LOGS="$LOGS ${this_script}"
|
---|
527 |
|
---|
528 | #--------------------------------------------------------------------#
|
---|
529 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
530 | #--------------------------------------------------------------------#
|
---|
531 | #
|
---|
532 | # Drop in the name of the target on a new line, and the previous target
|
---|
533 | # as a dependency. Also call the echo_message function.
|
---|
534 | wrt_target "${this_script}${N}" "$PREV"
|
---|
535 |
|
---|
536 | # If $vrs isn't empty, we've got a package...
|
---|
537 | if [ "$vrs" != "" ] ; then
|
---|
538 | FILE="$name-$vrs.tar.*"
|
---|
539 | wrt_unpack2 "$FILE"
|
---|
540 | fi
|
---|
541 | #
|
---|
542 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
543 | #
|
---|
544 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
545 | #
|
---|
546 | # Include a touch of the target name so make can check if it's already been made.
|
---|
547 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
548 | #
|
---|
549 | #--------------------------------------------------------------------#
|
---|
550 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
551 | #--------------------------------------------------------------------#
|
---|
552 | #
|
---|
553 | # Keep the script file name for Makefile dependencies.
|
---|
554 | PREV=${this_script}${N}
|
---|
555 | # Set system_build envar for iteration targets
|
---|
556 | system_build=$basicsystem
|
---|
557 | done # for file in final-system/* ...
|
---|
558 | }
|
---|
559 |
|
---|
560 |
|
---|
561 | #-----------------------------#
|
---|
562 | bm_final_system_Makefiles() { #
|
---|
563 | #-----------------------------#
|
---|
564 | # Set envars and scripts for iteration targets
|
---|
565 | LOGS="" # Start with an empty global LOGS envar
|
---|
566 | if [[ -z "$1" ]] ; then
|
---|
567 | local N=""
|
---|
568 | # The makesys phase was initiated in bm_testsuite_tools_makefile
|
---|
569 | [[ "$TEST" = 0 ]] && PREV=""
|
---|
570 | else
|
---|
571 | local N=-build_$1
|
---|
572 | local basicsystem=""
|
---|
573 | mkdir final-system$N
|
---|
574 | cp final-system/* final-system$N
|
---|
575 | for script in final-system$N/* ; do
|
---|
576 | # Overwrite existing symlinks, files, and dirs
|
---|
577 | sed -e 's/ln -sv/&f/g' \
|
---|
578 | -e 's/mv -v/&f/g' \
|
---|
579 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
580 | done
|
---|
581 | # Remove Bzip2 binaries before make install
|
---|
582 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
|
---|
583 | # Fix how Module-Init-Tools do the install target
|
---|
584 | sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
|
---|
585 | # Delete *old Readline libraries just after make install
|
---|
586 | sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
|
---|
587 | fi
|
---|
588 |
|
---|
589 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
|
---|
590 |
|
---|
591 | for file in final-system$N/* ; do
|
---|
592 | # Keep the script file name
|
---|
593 | this_script=`basename $file`
|
---|
594 |
|
---|
595 | # Test if the stripping phase must be skipped
|
---|
596 | # Skip alsp temp-perl for iterative runs
|
---|
597 | case $this_script in
|
---|
598 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
599 | *temp-perl*) [[ -n "$N" ]] && continue ;;
|
---|
600 | esac
|
---|
601 |
|
---|
602 | # Grab the name of the target, strip id number, XXX-script
|
---|
603 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
604 | -e 's@temp-@@' \
|
---|
605 | -e 's@-64bit@@' \
|
---|
606 | -e 's@-64@@' \
|
---|
607 | -e 's@64@@' \
|
---|
608 | -e 's@n32@@'`
|
---|
609 |
|
---|
610 | # Find the version of the command files, if it corresponds with the building of
|
---|
611 | # a specific package. We need this here to can skip scripts not needed for
|
---|
612 | # iterations rebuilds
|
---|
613 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
614 |
|
---|
615 | if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
|
---|
616 | case "${this_script}" in
|
---|
617 | *stripping*) ;;
|
---|
618 | *) continue ;;
|
---|
619 | esac
|
---|
620 | fi
|
---|
621 |
|
---|
622 | # Append each name of the script files to a list (this will become
|
---|
623 | # the names of the targets in the Makefile
|
---|
624 | basicsystem="$basicsystem ${this_script}${N}"
|
---|
625 |
|
---|
626 | # Append each name of the script files to a list (this will become
|
---|
627 | # the names of the logs to be moved for each iteration)
|
---|
628 | LOGS="$LOGS ${this_script}"
|
---|
629 |
|
---|
630 | #--------------------------------------------------------------------#
|
---|
631 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
632 | #--------------------------------------------------------------------#
|
---|
633 | #
|
---|
634 | # Drop in the name of the target on a new line, and the previous target
|
---|
635 | # as a dependency. Also call the echo_message function.
|
---|
636 | wrt_target "${this_script}${N}" "$PREV"
|
---|
637 |
|
---|
638 | # If $vrs isn't empty, we've got a package...
|
---|
639 | if [ "$vrs" != "" ] ; then
|
---|
640 | FILE="$name-$vrs.tar.*"
|
---|
641 | wrt_unpack3 "$FILE"
|
---|
642 | fi
|
---|
643 | #
|
---|
644 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
645 | #
|
---|
646 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
647 | #
|
---|
648 | # Include a touch of the target name so make can check if it's already been made.
|
---|
649 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
650 | #
|
---|
651 | #--------------------------------------------------------------------#
|
---|
652 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
653 | #--------------------------------------------------------------------#
|
---|
654 | #
|
---|
655 | # Keep the script file name for Makefile dependencies.
|
---|
656 | PREV=${this_script}${N}
|
---|
657 | # Set system_build envar for iteration targets
|
---|
658 | system_build=$basicsystem
|
---|
659 | done # for file in final-system/* ...
|
---|
660 | }
|
---|
661 |
|
---|
662 |
|
---|
663 | #-----------------------------#
|
---|
664 | bootscripts_Makefiles() { #
|
---|
665 | #-----------------------------#
|
---|
666 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
|
---|
667 |
|
---|
668 | for file in bootscripts/* ; do
|
---|
669 | # Keep the script file name
|
---|
670 | this_script=`basename $file`
|
---|
671 |
|
---|
672 | case $this_script in
|
---|
673 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
674 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
675 | *) ;;
|
---|
676 | esac
|
---|
677 |
|
---|
678 | # First append each name of the script files to a list (this will become
|
---|
679 | # the names of the targets in the Makefile
|
---|
680 | bootscripttools="$bootscripttools $this_script"
|
---|
681 |
|
---|
682 | # Grab the name of the target, strip id number, XXX-script
|
---|
683 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
684 | -e 's@-64bit@@' \
|
---|
685 | -e 's@-64@@' \
|
---|
686 | -e 's@64@@' \
|
---|
687 | -e 's@n32@@'`
|
---|
688 | case $name in
|
---|
689 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
690 | *udev-rules) name=udev-cross-lfs ;;
|
---|
691 | esac
|
---|
692 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
693 |
|
---|
694 | #--------------------------------------------------------------------#
|
---|
695 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
696 | #--------------------------------------------------------------------#
|
---|
697 | #
|
---|
698 | # Drop in the name of the target on a new line, and the previous target
|
---|
699 | # as a dependency. Also call the echo_message function.
|
---|
700 | wrt_target "${this_script}" "$PREV"
|
---|
701 | #
|
---|
702 | # If $vrs isn't empty, we've got a package...
|
---|
703 | #
|
---|
704 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
705 | #
|
---|
706 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
707 | #
|
---|
708 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
709 | #
|
---|
710 | # Include a touch of the target name so make can check if it's already been made.
|
---|
711 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
712 | #
|
---|
713 | #--------------------------------------------------------------------#
|
---|
714 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
715 | #--------------------------------------------------------------------#
|
---|
716 | #
|
---|
717 | # Keep the script file name for Makefile dependencies.
|
---|
718 | PREV=$this_script
|
---|
719 |
|
---|
720 | done # for file in bootscripts/* ...
|
---|
721 |
|
---|
722 | }
|
---|
723 |
|
---|
724 | #-----------------------------#
|
---|
725 | bm_bootscripts_Makefiles() { #
|
---|
726 | #-----------------------------#
|
---|
727 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
|
---|
728 |
|
---|
729 | for file in bootscripts/* ; do
|
---|
730 | # Keep the script file name
|
---|
731 | this_script=`basename $file`
|
---|
732 |
|
---|
733 | case $this_script in
|
---|
734 | *udev*) continue ;; # This is not a script but a commentary
|
---|
735 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
736 | *) ;;
|
---|
737 | esac
|
---|
738 |
|
---|
739 | # First append each name of the script files to a list (this will become
|
---|
740 | # the names of the targets in the Makefile
|
---|
741 | bootscripttools="$bootscripttools $this_script"
|
---|
742 |
|
---|
743 | # Grab the name of the target, strip id number, XXX-script
|
---|
744 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
745 | -e 's@-64bit@@' \
|
---|
746 | -e 's@-64@@' \
|
---|
747 | -e 's@64@@' \
|
---|
748 | -e 's@n32@@'`
|
---|
749 | case $name in
|
---|
750 | *bootscripts*) name=bootscripts-cross-lfs
|
---|
751 | ;;
|
---|
752 | esac
|
---|
753 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
754 |
|
---|
755 | #--------------------------------------------------------------------#
|
---|
756 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
757 | #--------------------------------------------------------------------#
|
---|
758 | #
|
---|
759 | # Drop in the name of the target on a new line, and the previous target
|
---|
760 | # as a dependency. Also call the echo_message function.
|
---|
761 | wrt_target "${this_script}" "$PREV"
|
---|
762 | #
|
---|
763 | # If $vrs isn't empty, we've got a package...
|
---|
764 | #
|
---|
765 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
766 | #
|
---|
767 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
768 | #
|
---|
769 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
770 | #
|
---|
771 | # Include a touch of the target name so make can check if it's already been made.
|
---|
772 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
773 | #
|
---|
774 | #--------------------------------------------------------------------#
|
---|
775 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
776 | #--------------------------------------------------------------------#
|
---|
777 | #
|
---|
778 | # Keep the script file name for Makefile dependencies.
|
---|
779 | PREV=$this_script
|
---|
780 |
|
---|
781 | done # for file in bootscripts/* ...
|
---|
782 |
|
---|
783 | }
|
---|
784 |
|
---|
785 |
|
---|
786 |
|
---|
787 | #-----------------------------#
|
---|
788 | bootable_Makefiles() { #
|
---|
789 | #-----------------------------#
|
---|
790 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
|
---|
791 |
|
---|
792 | for file in {bootable,the-end}/* ; do
|
---|
793 | # Keep the script file name
|
---|
794 | this_script=`basename $file`
|
---|
795 |
|
---|
796 | # A little housekeeping on the scripts
|
---|
797 | case $this_script in
|
---|
798 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
799 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
800 | [[ -z $CONFIG ]] && continue
|
---|
801 | # Copy the config file to /sources with a standardized name
|
---|
802 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
803 | ;;
|
---|
804 | esac
|
---|
805 | #
|
---|
806 | # First append each name of the script files to a list (this will become
|
---|
807 | # the names of the targets in the Makefile
|
---|
808 | bootabletools="$bootabletools $this_script"
|
---|
809 | #
|
---|
810 | # Grab the name of the target, strip id number and misc words.
|
---|
811 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
812 | case $this_script in
|
---|
813 | *kernel*) name=linux
|
---|
814 | ;;
|
---|
815 | esac
|
---|
816 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
817 |
|
---|
818 | #--------------------------------------------------------------------#
|
---|
819 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
820 | #--------------------------------------------------------------------#
|
---|
821 | #
|
---|
822 | # Drop in the name of the target on a new line, and the previous target
|
---|
823 | # as a dependency. Also call the echo_message function.
|
---|
824 | wrt_target "${this_script}" "$PREV"
|
---|
825 | #
|
---|
826 | # If $vrs isn't empty, we've got a package...
|
---|
827 | # Insert instructions for unpacking the package and changing directories
|
---|
828 | #
|
---|
829 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
830 | #
|
---|
831 | # Select a script execution method
|
---|
832 | case $this_script in
|
---|
833 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
834 | wrt_copy_fstab "${this_script}"
|
---|
835 | else
|
---|
836 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
837 | fi
|
---|
838 | ;;
|
---|
839 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
840 | esac
|
---|
841 | #
|
---|
842 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
843 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
844 | #
|
---|
845 | # Include a touch of the target name so make can check if it's already been made.
|
---|
846 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
847 | #
|
---|
848 | #--------------------------------------------------------------------#
|
---|
849 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
850 | #--------------------------------------------------------------------#
|
---|
851 | #
|
---|
852 | # Keep the script file name for Makefile dependencies.
|
---|
853 | PREV=$this_script
|
---|
854 |
|
---|
855 | done
|
---|
856 |
|
---|
857 | # Add SBU-disk_usage report target if required
|
---|
858 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
859 |
|
---|
860 | }
|
---|
861 |
|
---|
862 |
|
---|
863 |
|
---|
864 | #-----------------------------#
|
---|
865 | bm_bootable_Makefiles() { #
|
---|
866 | #-----------------------------#
|
---|
867 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
|
---|
868 |
|
---|
869 | for file in {bootable,the-end}/* ; do
|
---|
870 | # Keep the script file name
|
---|
871 | this_script=`basename $file`
|
---|
872 |
|
---|
873 | # A little housekeeping on the scripts
|
---|
874 | case $this_script in
|
---|
875 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
876 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
877 | [[ -z $CONFIG ]] && continue
|
---|
878 | # Copy the named config file to /sources with a standardized name
|
---|
879 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
880 | ;;
|
---|
881 | esac
|
---|
882 | #
|
---|
883 | # First append each name of the script files to a list (this will become
|
---|
884 | # the names of the targets in the Makefile
|
---|
885 | bootabletools="$bootabletools $this_script"
|
---|
886 | #
|
---|
887 | # Grab the name of the target, strip id number and misc words.
|
---|
888 | case $this_script in
|
---|
889 | *kernel) name=linux
|
---|
890 | ;;
|
---|
891 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
892 | esac
|
---|
893 |
|
---|
894 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
895 |
|
---|
896 | #--------------------------------------------------------------------#
|
---|
897 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
898 | #--------------------------------------------------------------------#
|
---|
899 | #
|
---|
900 | # Drop in the name of the target on a new line, and the previous target
|
---|
901 | # as a dependency. Also call the echo_message function.
|
---|
902 | wrt_target "${this_script}" "$PREV"
|
---|
903 | #
|
---|
904 | # If $vrs isn't empty, we've got a package...
|
---|
905 | # Insert instructions for unpacking the package and changing directories
|
---|
906 | #
|
---|
907 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
908 | #
|
---|
909 | # Select a script execution method
|
---|
910 | case $this_script in
|
---|
911 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
912 | # Minimal boot mode has no access to original file, store in /sources
|
---|
913 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
914 | wrt_copy_fstab2 "${this_script}"
|
---|
915 | else
|
---|
916 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
917 | fi
|
---|
918 | ;;
|
---|
919 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
920 | esac
|
---|
921 | #
|
---|
922 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
923 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
924 | #
|
---|
925 | # Include a touch of the target name so make can check if it's already been made.
|
---|
926 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
927 | #
|
---|
928 | #--------------------------------------------------------------------#
|
---|
929 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
930 | #--------------------------------------------------------------------#
|
---|
931 | #
|
---|
932 | # Keep the script file name for Makefile dependencies.
|
---|
933 | PREV=$this_script
|
---|
934 |
|
---|
935 | done
|
---|
936 |
|
---|
937 | # Add SBU-disk_usage report target if required
|
---|
938 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
939 |
|
---|
940 | }
|
---|
941 |
|
---|
942 |
|
---|
943 | #-----------------------------#
|
---|
944 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
945 | #-----------------------------#
|
---|
946 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
947 |
|
---|
948 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
949 | # Start with a clean Makefile.tmp file
|
---|
950 | >$MKFILE.tmp
|
---|
951 |
|
---|
952 | host_prep_Makefiles
|
---|
953 | cross_tools_Makefiles # $cross_tools
|
---|
954 | temptools_Makefiles # $temptools
|
---|
955 | if [[ $METHOD = "chroot" ]]; then
|
---|
956 | chroot_Makefiles # $chroottools
|
---|
957 | if [[ ! $TEST = "0" ]]; then
|
---|
958 | testsuite_tools_Makefiles # $testsuitetools
|
---|
959 | fi
|
---|
960 | final_system_Makefiles # $basicsystem
|
---|
961 | # Add the iterations targets, if needed
|
---|
962 | [[ "$COMPARE" != "0" ]] && wrt_compare_targets
|
---|
963 | bootscripts_Makefiles # $bootscripttools
|
---|
964 | bootable_Makefiles # $bootabletools
|
---|
965 | else
|
---|
966 | boot_Makefiles # $boottools
|
---|
967 | if [[ ! $TEST = "0" ]]; then
|
---|
968 | bm_testsuite_tools_Makefiles # $testsuitetools
|
---|
969 | fi
|
---|
970 | bm_final_system_Makefiles # $basicsystem
|
---|
971 | # Add the iterations targets, if needed
|
---|
972 | [[ "$COMPARE" != "0" ]] && wrt_compare_targets
|
---|
973 | bm_bootscripts_Makefiles # $bootscipttools
|
---|
974 | bm_bootable_Makefiles # $bootabletoosl
|
---|
975 | fi
|
---|
976 | # the_end_Makefiles
|
---|
977 |
|
---|
978 |
|
---|
979 | # Add a header, some variables and include the function file
|
---|
980 | # to the top of the real Makefile.
|
---|
981 | (
|
---|
982 | cat << EOF
|
---|
983 | $HEADER
|
---|
984 |
|
---|
985 | SRC= /sources
|
---|
986 | MOUNT_PT= $BUILDDIR
|
---|
987 |
|
---|
988 | include makefile-functions
|
---|
989 |
|
---|
990 | EOF
|
---|
991 | ) > $MKFILE
|
---|
992 |
|
---|
993 | # Add chroot commands
|
---|
994 | if [ "$METHOD" = "chroot" ] ; then
|
---|
995 | chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
---|
996 | -e '/^export/d' \
|
---|
997 | -e '/^logout/d' \
|
---|
998 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
999 | -e 's|\\$|&&|g' \
|
---|
1000 | -e 's|exit||g' \
|
---|
1001 | -e 's|$| -c|' \
|
---|
1002 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
1003 | -e 's|set -e||'`
|
---|
1004 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
1005 | fi
|
---|
1006 |
|
---|
1007 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
1008 | # as a dependency.
|
---|
1009 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
1010 | (
|
---|
1011 | cat << EOF
|
---|
1012 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
1013 | @\$(call echo_finished,$VERSION)
|
---|
1014 |
|
---|
1015 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
1016 |
|
---|
1017 | chapter3: chapter2 $cross_tools
|
---|
1018 |
|
---|
1019 | chapter4: chapter3 $temptools
|
---|
1020 |
|
---|
1021 | chapter5: chapter4 $chroottools $testsuitetools
|
---|
1022 |
|
---|
1023 | chapter6: chapter5 $basicsystem
|
---|
1024 |
|
---|
1025 | chapter7: chapter6 $bootscripttools
|
---|
1026 |
|
---|
1027 | chapter8: chapter7 $bootabletools
|
---|
1028 |
|
---|
1029 | clean-all: clean
|
---|
1030 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
1031 |
|
---|
1032 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
1033 |
|
---|
1034 | clean-chapter2:
|
---|
1035 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1036 | userdel lfs; \\
|
---|
1037 | rm -rf /home/lfs; \\
|
---|
1038 | fi;
|
---|
1039 | rm -rf \$(MOUNT_PT)/tools
|
---|
1040 | rm -f /tools
|
---|
1041 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1042 | rm -f /cross-tools
|
---|
1043 | rm -f envars user-lfs-exist
|
---|
1044 | rm -f 02* logs/02*.log
|
---|
1045 |
|
---|
1046 | clean-chapter3:
|
---|
1047 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
1048 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
1049 | cd logs && rm -f $cross_tools && cd ..
|
---|
1050 |
|
---|
1051 | clean-chapter4:
|
---|
1052 | -umount \$(MOUNT_PT)/sys
|
---|
1053 | -umount \$(MOUNT_PT)/proc
|
---|
1054 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1055 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1056 | -umount \$(MOUNT_PT)/dev
|
---|
1057 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1058 | rm -f $temptools
|
---|
1059 | cd logs && rm -f $temptools && cd ..
|
---|
1060 |
|
---|
1061 |
|
---|
1062 | restore-lfs-env:
|
---|
1063 | @\$(call echo_message, Building)
|
---|
1064 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1065 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1066 | fi;
|
---|
1067 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1068 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1069 | fi;
|
---|
1070 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1071 | touch \$@
|
---|
1072 |
|
---|
1073 | EOF
|
---|
1074 | ) >> $MKFILE
|
---|
1075 | fi
|
---|
1076 |
|
---|
1077 |
|
---|
1078 | if [[ "${METHOD}" = "boot" ]]; then
|
---|
1079 | (
|
---|
1080 | cat << EOF
|
---|
1081 |
|
---|
1082 | all: makeboot
|
---|
1083 |
|
---|
1084 | makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
1085 | $cross_tools\
|
---|
1086 | $temptools \
|
---|
1087 | $chroottools \
|
---|
1088 | $boottools
|
---|
1089 | @\$(call echo_boot_finished,$VERSION)
|
---|
1090 |
|
---|
1091 | makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
1092 | @\$(call echo_finished,$VERSION)
|
---|
1093 |
|
---|
1094 |
|
---|
1095 | clean-all: clean
|
---|
1096 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
1097 |
|
---|
1098 | clean: clean-makesys clean-makeboot clean-jhalfs
|
---|
1099 |
|
---|
1100 | clean-jhalfs:
|
---|
1101 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1102 | userdel lfs; \\
|
---|
1103 | rm -rf /home/lfs; \\
|
---|
1104 | fi;
|
---|
1105 | rm -rf \$(MOUNT_PT)/tools
|
---|
1106 | rm -f /tools
|
---|
1107 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1108 | rm -f /cross-tools
|
---|
1109 | rm -f envars user-lfs-exist
|
---|
1110 | rm -f 02* logs/02*.log
|
---|
1111 |
|
---|
1112 | clean-makeboot:
|
---|
1113 | rm -rf /tools/*
|
---|
1114 | rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
---|
1115 | rm -f restore-lfs-env sources-dir
|
---|
1116 | cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
---|
1117 |
|
---|
1118 | clean-makesys:
|
---|
1119 | -umount \$(MOUNT_PT)/sys
|
---|
1120 | -umount \$(MOUNT_PT)/proc
|
---|
1121 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1122 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1123 | -umount \$(MOUNT_PT)/dev
|
---|
1124 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1125 | rm -f $basicsystem
|
---|
1126 | rm -f $bootscripttools
|
---|
1127 | rm -f $bootabletools
|
---|
1128 | cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
---|
1129 |
|
---|
1130 |
|
---|
1131 | restore-lfs-env:
|
---|
1132 | @\$(call echo_message, Building)
|
---|
1133 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1134 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1135 | fi;
|
---|
1136 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1137 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1138 | fi;
|
---|
1139 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1140 | touch \$@
|
---|
1141 |
|
---|
1142 | EOF
|
---|
1143 | ) >> $MKFILE
|
---|
1144 | fi
|
---|
1145 |
|
---|
1146 | # Bring over the items from the Makefile.tmp
|
---|
1147 | cat $MKFILE.tmp >> $MKFILE
|
---|
1148 | rm $MKFILE.tmp
|
---|
1149 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
1150 |
|
---|
1151 | }
|
---|
1152 |
|
---|