source: CLFS/master.sh@ 82808d1

2.4 ablfs-more legacy new_features trunk
Last change on this file since 82808d1 was 82808d1, checked in by Pierre Labastie <pierre@…>, 10 years ago

Fixes addition of "pass1" util-linux in new version of CLFS.
Thanks to William Harrington for the patch.

  • Property mode set to 100644
File size: 43.2 KB
Line 
1#!/bin/bash
2# $Id$
3
4
5orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
6
7
8#--------------------------------------#
9host_prep_Makefiles() { #
10#--------------------------------------#
11 local CLFS_HOST
12
13 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
14
15 # defined here, only for ease of reading
16 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
17(
18cat << EOF
19023-creatingtoolsdir:
20 @\$(call echo_message, Building)
21 @install -dv \$(MOUNT_PT)/tools && \\
22 rm -f /tools && \\
23 ln -s \$(MOUNT_PT)/tools /
24 @\$(call housekeeping)
25
26024-creatingcrossdir: 023-creatingtoolsdir
27 @\$(call echo_message, Building)
28 @install -dv \$(MOUNT_PT)/cross-tools && \\
29 rm -f /cross-tools && \\
30 ln -s \$(MOUNT_PT)/cross-tools /
31 @\$(call housekeeping)
32
33025-addinguser: 024-creatingcrossdir
34 @\$(call echo_message, Building)
35 @if [ ! -d \$(LUSER_HOME) ]; then \\
36 groupadd \$(LGROUP); \\
37 useradd -s /bin/bash -g \$(LGROUP) -d \$(LUSER_HOME) \$(LUSER); \\
38 mkdir -pv \$(LUSER_HOME); \\
39 chown -v \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
40 else \\
41 touch luser-exist; \\
42 fi
43 @chown -v \$(LUSER) \$(MOUNT_PT)/tools && \\
44 chown -v \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
45 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
46 chmod a+wt \$(SRCSDIR)
47 @\$(call housekeeping)
48
49026-settingenvironment: 025-addinguser
50 @\$(call echo_message, Building)
51 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
52 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
53 fi
54 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
55 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
56 fi;
57 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
58 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
59 echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
60 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
61 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
62 echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
63 echo "" >> \$(LUSER_HOME)/.bashrc && \\
64 echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
65 echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
66 echo "" >> \$(LUSER_HOME)/.bashrc && \\
67EOF
68) >> $MKFILE.tmp
69if ! [ -e final-preps/*variables ]; then
70 (
71 cat << EOF
72 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
73 echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
74 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
75EOF
76 ) >> $MKFILE.tmp
77fi
78(
79cat << EOF
80 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
81 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
82 chmod a+wt \$(MOUNT_PT) && \\
83 if [ -d \$(MOUNT_PT)/var ]; then \\
84 chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
85 fi && \\
86 touch envars && \\
87 chown \$(LUSER):\$(LGROUP) envars
88 @\$(call housekeeping)
89EOF
90) >> $MKFILE.tmp
91 host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
92
93}
94
95#--------------------------------------#
96final_preps_Makefiles() {
97#--------------------------------------#
98 echo "${tab_}${GREEN}Processing... ${L_arrow}variables ( LUSER ) ${R_arrow}"
99 for file in final-preps/* ; do
100 this_script=`basename $file`
101 case $this_script in
102 *variables )
103 ;;
104 *) continue; ;;
105 esac
106 # Set the dependency for the first target.
107 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
108
109 # First append each name of the script files to a list (this will become
110 # the names of the targets in the Makefile
111 final_preps="$final_preps $this_script"
112
113 # No need to grab the package name
114
115 LUSER_wrt_target "${this_script}" "$PREV"
116 LUSER_wrt_RunAsUser "${file}"
117 wrt_touch
118 PREV=$this_script
119 done # for file in ....
120}
121
122#--------------------------------------#
123cross_tools_Makefiles() { #
124#--------------------------------------#
125 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
126
127 for file in cross-tools/* ; do
128 # Keep the script file name
129 this_script=`basename $file`
130 #
131 # Skip this script...
132 case $this_script in
133 *cflags* | *variables* ) # work done in host_prep_Makefiles
134 continue; ;;
135 *) ;;
136 esac
137 #
138 # Set the dependency for the first target.
139 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
140
141 # First append each name of the script files to a list (this will become
142 # the names of the targets in the Makefile
143 cross_tools="$cross_tools $this_script"
144
145 # Grab the name of the target (minus the -headers or -cross in the case of gcc
146 # and binutils in chapter 5)
147 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
148 -e 's@-static@@' \
149 -e 's@-final@@' \
150 -e 's@-64@@' \
151 -e 's@-n32@@' \
152 -e 's@-pass1@@'`
153 pkg_tarball=$(get_package_tarball_name $name)
154
155 #--------------------------------------------------------------------#
156 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
157 #--------------------------------------------------------------------#
158 #
159 # Drop in the name of the target on a new line, and the previous target
160 # as a dependency. Also call the echo_message function.
161 LUSER_wrt_target "${this_script}" "$PREV"
162 #
163 # If $pkg_tarball isn't empty, we've got a package...
164 #
165 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
166 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
167 #
168 LUSER_wrt_RunAsUser "${file}"
169 #
170 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
171 #
172 # Include a touch of the target name so make can check if it's already been made.
173 wrt_touch
174 #
175 #--------------------------------------------------------------------#
176 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
177 #--------------------------------------------------------------------#
178 #
179 # Keep the script file name for Makefile dependencies.
180 PREV=$this_script
181
182 done # for file in ....
183}
184
185#--------------------------------------#
186temptools_Makefiles() { #
187#--------------------------------------#
188 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
189
190 for file in temp-system/* ; do
191 # Keep the script file name
192 this_script=`basename $file`
193 #
194 # Deal with any odd scripts..
195 case $this_script in
196 *choose) # The choose script will fail if you cannot enter the new environment
197 # If the 'boot' build method was chosen don't run the script
198 [[ $METHOD = "boot" ]] && continue; ;;
199 *) ;;
200 esac
201
202 #
203 # First append each name of the script files to a list (this will become
204 # the names of the targets in the Makefile
205 temptools="$temptools $this_script"
206
207 #
208 # Grab the name of the target, strip id number, XXX-script
209 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
210 #
211 pkg_tarball=$(get_package_tarball_name $name)
212
213 #--------------------------------------------------------------------#
214 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
215 #--------------------------------------------------------------------#
216 #
217 # Drop in the name of the target on a new line, and the previous target
218 # as a dependency. Also call the echo_message function.
219 LUSER_wrt_target "${this_script}" "$PREV"
220 #
221 # If $pkg_tarball isn't empty, we've got a package...
222 # Insert instructions for unpacking the package and to set the PKGDIR variable.
223 #
224 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
225 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
226 #
227 LUSER_wrt_RunAsUser "${file}"
228 #
229 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
230 #
231 # Include a touch of the target name so make can check if it's already been made.
232 wrt_touch
233 #
234 #--------------------------------------------------------------------#
235 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
236 #--------------------------------------------------------------------#
237 #
238 # Keep the script file name for Makefile dependencies.
239 PREV=$this_script
240 done # for file in ....
241}
242
243
244#--------------------------------------#
245chroot_Makefiles() { #
246#--------------------------------------#
247 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
248
249 for file in chroot/* ; do
250 # Keep the script file name
251 this_script=`basename $file`
252 #
253 # Skipping scripts is done now and not included in the build tree.
254 case $this_script in
255 *chroot*) continue ;;
256 esac
257
258 #
259 # First append each name of the script files to a list (this will become
260 # the names of the targets in the Makefile
261 case "${this_script}" in
262 *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
263 *) chroottools="$chroottools $this_script" ;;
264 esac
265
266 # Grab the name of the target, strip id number, XXX-script
267 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
268
269 pkg_tarball=$(get_package_tarball_name $name)
270
271 # This is very ugly:: util-linux is in /chroot but must be run under LUSER
272 # Same for e2fsprogs (in CLFS 1.1.0)
273 # .. Customized makefile entry
274 case "${this_script}" in
275 *util-linux)
276 LUSER_wrt_target "${this_script}" "$PREV"
277 LUSER_wrt_unpack "$pkg_tarball"
278 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
279 LUSER_wrt_RunAsUser "${file}"
280 LUSER_RemoveBuildDirs "${name}"
281 wrt_touch
282 temptools="$temptools $this_script"
283 continue ;;
284 *util-linux-ng)
285 LUSER_wrt_target "${this_script}" "$PREV"
286 LUSER_wrt_unpack "$pkg_tarball"
287 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
288 LUSER_wrt_RunAsUser "${file}"
289 LUSER_RemoveBuildDirs "${name}"
290 wrt_touch
291 temptools="$temptools $this_script"
292 continue ;;
293 *util-linux-libs)
294 LUSER_wrt_target "${this_script}" "$PREV"
295 LUSER_wrt_unpack "$pkg_tarball"
296 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
297 LUSER_wrt_RunAsUser "${file}"
298 LUSER_RemoveBuildDirs "${name}"
299 wrt_touch
300 temptools="$temptools $this_script"
301 continue ;;
302 *e2fsprogs)
303 LUSER_wrt_target "${this_script}" "$PREV"
304 LUSER_wrt_unpack "$pkg_tarball"
305 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
306 LUSER_wrt_RunAsUser "${file}"
307 LUSER_RemoveBuildDirs "${name}"
308 wrt_touch
309 temptools="$temptools $this_script"
310 continue ;;
311 *e2fsprogs-libs)
312 LUSER_wrt_target "${this_script}" "$PREV"
313 LUSER_wrt_unpack "$pkg_tarball"
314 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
315 LUSER_wrt_RunAsUser "${file}"
316 LUSER_RemoveBuildDirs "${name}"
317 wrt_touch
318 temptools="$temptools $this_script"
319 continue ;;
320 esac
321
322
323 #--------------------------------------------------------------------#
324 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
325 #--------------------------------------------------------------------#
326 #
327 # Drop in the name of the target on a new line, and the previous target
328 # as a dependency. Also call the echo_message function.
329 CHROOT_wrt_target "${this_script}" "$PREV"
330 #
331 # If $pkg_tarball isn't empty, we've got a package...
332 # Insert instructions for unpacking the package and changing directories
333 #
334 if [ "$pkg_tarball" != "" ] ; then
335 CHROOT_Unpack "$pkg_tarball"
336 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
337 fi
338 #
339 # Select a script execution method
340 case $this_script in
341 *kernfs) wrt_RunAsRoot "${file}" ;;
342 *) CHROOT_wrt_RunAsRoot "${file}" ;;
343 esac
344 #
345 # Housekeeping...remove the build directory(ies), except if the package build fails.
346 [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
347 #
348 # Include a touch of the target name so make can check if it's already been made.
349 wrt_touch
350 #
351 #--------------------------------------------------------------------#
352 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
353 #--------------------------------------------------------------------#
354 #
355 # Keep the script file name for Makefile dependencies.
356 PREV=$this_script
357
358 done # for file in...
359}
360
361
362#--------------------------------------#
363boot_Makefiles() { #
364#--------------------------------------#
365
366 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools BOOT ( LUSER ) ${R_arrow}"
367 #
368 # Create a target bootable partition containing a compile environment. Later
369 # on we boot into this environment and contine the build.
370 #
371 for file in boot/* ; do
372 # Keep the script file name
373 this_script=`basename $file`
374
375 # A little housekeeping on the scripts
376 case $this_script in
377 *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
378 *how-to-view*) continue ;;
379 *whatnext*) continue ;;
380 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
381 *kernel) # if there is no kernel config file do not build the kernel
382 [[ -z $CONFIG ]] && continue
383 # Copy the config file to /sources with a standardized name
384 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
385 ;;
386 esac
387 #
388 # First append each name of the script files to a list (this will become
389 # the names of the targets in the Makefile). Those names differ depending
390 # on the version of the book. What makes the difference between those
391 # versions is the presence of "how-to-view" in the boot chapter.
392 if [ -f boot/*how-to-view ]; then
393 case "${this_script}" in
394 *changingowner)
395 orphan_scripts="${orphan_scripts} ${this_script}"
396 ;;
397 *creatingdirs)
398 orphan_scripts="${orphan_scripts} ${this_script}"
399 ;;
400 *createfiles)
401 orphan_scripts="${orphan_scripts} ${this_script}"
402 ;;
403 *devices)
404 orphan_scripts="${orphan_scripts} ${this_script}"
405 ;;
406 *flags)
407 orphan_scripts="${orphan_scripts} ${this_script}"
408 ;;
409 *fstab)
410 orphan_scripts="${orphan_scripts} ${this_script}"
411 ;;
412 *pwdgroup)
413 orphan_scripts="${orphan_scripts} ${this_script}"
414 ;;
415 *settingenvironment)
416 orphan_scripts="${orphan_scripts} ${this_script}"
417 ;;
418 *)
419 boottools="$boottools $this_script"
420 ;;
421 esac
422 else
423 case "${this_script}" in
424 *changingowner)
425 orphan_scripts="${orphan_scripts} ${this_script}"
426 ;;
427 *devices)
428 orphan_scripts="${orphan_scripts} ${this_script}"
429 ;;
430 *)
431 boottools="$boottools $this_script"
432 ;;
433 esac
434 fi
435 #
436 # Grab the name of the target, strip id number and misc words.
437 case $this_script in
438 *kernel) name=linux ;;
439 *bootscripts) name="bootscripts-cross-lfs" ;;
440 *boot-scripts) name="boot-scripts-cross-lfs" ;;
441 *udev-rules) name="udev-cross-lfs" ;;
442 *grub-build) name=grub ;;
443 *-aboot-build) name=aboot ;;
444 *yaboot-build) name=yaboot ;;
445 *colo-build) name=colo ;;
446 *silo-build) name=silo ;;
447 *arcload-build) name=arcload ;;
448 *lilo-build) name=lilo ;;
449 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
450 esac
451 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
452 pkg_tarball=$(get_package_tarball_name $name)
453
454 #--------------------------------------------------------------------#
455 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
456 #--------------------------------------------------------------------#
457 #
458 # Drop in the name of the target on a new line, and the previous target
459 # as a dependency. Also call the echo_message function.
460 LUSER_wrt_target "${this_script}" "$PREV"
461 #
462 # If $pkg_tarball isn't empty, we've got a package...
463 # Insert instructions for unpacking the package and changing directories
464 #
465 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
466 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
467 #
468 # Select a script execution method
469 if [ -f boot/*how-to-view ]; then
470 case $this_script in
471 # The following 8 scripts are defined in the /boot directory but need
472 # to be run as a root user. Set them up here but run them in another
473 # phase
474 *changingowner) wrt_RunAsRoot "${file}" ;;
475 *creatingdirs) wrt_RunAsRoot "${file}" ;;
476 *createfiles) wrt_RunAsRoot "${file}" ;;
477 *devices) wrt_RunAsRoot "${file}" ;;
478 *flags) wrt_RunAsRoot "${file}" ;;
479 *fstab)
480 if [[ -n "$FSTAB" ]]; then
481 LUSER_wrt_CopyFstab
482 else
483 wrt_RunAsRoot "${file}"
484 fi
485 ;;
486 *pwdgroup) wrt_RunAsRoot "${file}" ;;
487 *settingenvironment) wrt_RunAsRoot "${file}" ;;
488 *) LUSER_wrt_RunAsUser "${file}" ;;
489 esac
490 else
491 case $this_script in
492 # The following 2 scripts are defined in the /boot directory but need
493 # to be run as a root user. Set them up here but run them in another
494 # phase
495 *changingowner) wrt_RunAsRoot "${file}" ;;
496 *devices) wrt_RunAsRoot "${file}" ;;
497 *fstab)
498 if [[ -n "$FSTAB" ]]; then
499 LUSER_wrt_CopyFstab
500 else
501 LUSER_wrt_RunAsUser "${file}"
502 fi
503 ;;
504 *) LUSER_wrt_RunAsUser "${file}" ;;
505 esac
506 fi
507 #
508 # Housekeeping...remove any build directory(ies) except if the package build fails.
509 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
510 #
511 # Include a touch of the target name so make can check if it's already been made.
512 wrt_touch
513 #
514 #--------------------------------------------------------------------#
515 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
516 #--------------------------------------------------------------------#
517 #
518 # Keep the script file name for Makefile dependencies.
519 PREV=$this_script
520
521 done
522}
523
524
525#--------------------------------------#
526testsuite_tools_Makefiles() { #
527#--------------------------------------#
528
529 if [[ "${METHOD}" = "chroot" ]]; then
530 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
531 else
532 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
533 PREV=""
534 fi
535
536 for file in testsuite-tools/* ; do
537 # Keep the script file name
538 this_script=`basename $file`
539
540 # First append each name of the script files to a list (this will become
541 # the names of the targets in the Makefile
542 testsuitetools="$testsuitetools $this_script"
543
544 # Grab the name of the target, strip id number, XXX-script
545 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
546 -e 's@-64bit@@' \
547 -e 's@-64@@' \
548 -e 's@64@@' \
549 -e 's@n32@@'`
550
551 pkg_tarball=$(get_package_tarball_name $name)
552
553 #--------------------------------------------------------------------#
554 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
555 #--------------------------------------------------------------------#
556 #
557 # Drop in the name of the target on a new line, and the previous target
558 # as a dependency. Also call the echo_message function.
559 CHROOT_wrt_target "${this_script}" "$PREV"
560 #
561 CHROOT_Unpack "$pkg_tarball"
562 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
563 #
564 CHROOT_wrt_RunAsRoot "${file}"
565 #
566 CHROOT_wrt_RemoveBuildDirs "${name}"
567 #
568 # Include a touch of the target name so make can check if it's already been made.
569 wrt_touch
570 #
571 #--------------------------------------------------------------------#
572 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
573 #--------------------------------------------------------------------#
574 #
575 # Keep the script file name for Makefile dependencies.
576 PREV=$this_script
577
578 done
579}
580
581
582#--------------------------------------#
583final_system_Makefiles() { #
584#--------------------------------------#
585 # Set envars and scripts for iteration targets
586 if [[ -z "$1" ]] ; then
587 local N=""
588 # In boot method the makesys phase was initiated in testsuite_tools_makefile
589 [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
590 else
591 local N=-build_$1
592 local basicsystem=""
593 mkdir final-system$N
594 cp final-system/* final-system$N
595 for script in final-system$N/* ; do
596 # Overwrite existing symlinks, files, and dirs
597 sed -e 's/ln -sv/&f/g' \
598 -e 's/mv -v/&f/g' \
599 -e 's/mkdir -v/&p/g' -i ${script}
600 # Rename the scripts
601 mv ${script} ${script}$N
602 done
603 # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
604 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
605 # Delete *old Readline libraries just after make install
606 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
607 fi
608
609 if [[ "${METHOD}" = "chroot" ]]; then
610 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
611 else
612 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
613 fi
614
615 for file in final-system$N/* ; do
616 # Keep the script file name
617 this_script=`basename $file`
618
619 # Test if the stripping phase must be skipped.
620 # Skip also temp-perl for iterative runs
621 case $this_script in
622 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
623 *temp-perl*) [[ -n "$N" ]] && continue ;;
624 esac
625
626 # Grab the name of the target, strip id number, XXX-script.
627 # name1 is partially stripped and should be used for logging files.
628 # name is completely stripped and is used for grabbing
629 # the package name.
630 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
631 -e 's,'$N',,'`
632 name=`echo $name1 | sed -e 's@temp-@@' \
633 -e 's@-64bit@@' \
634 -e 's@-64@@' \
635 -e 's@64@@' \
636 -e 's@n32@@'`
637
638 # Find the version of the command files, if it corresponds with the building of
639 # a specific package. We need this here to can skip scripts not needed for
640 # iterations rebuilds
641 pkg_tarball=$(get_package_tarball_name $name)
642
643 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
644 case "${this_script}" in
645 *stripping*) ;;
646 *) continue ;;
647 esac
648 fi
649
650 # Append each name of the script files to a list (this will become
651 # the names of the targets in the Makefile
652 basicsystem="$basicsystem ${this_script}"
653
654 #--------------------------------------------------------------------#
655 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
656 #--------------------------------------------------------------------#
657 #
658 # Drop in the name of the target on a new line, and the previous target
659 # as a dependency. Also call the echo_message function.
660 CHROOT_wrt_target "${this_script}" "$PREV"
661
662 # If $pkg_tarball isn't empty, we've got a package...
663 if [ "$pkg_tarball" != "" ] ; then
664 # Touch timestamp file if installed files logs will be created.
665 # But only for the firt build when running iterative builds.
666 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
667 CHROOT_wrt_TouchTimestamp
668 fi
669 CHROOT_Unpack "$pkg_tarball"
670 # If the testsuites must be run, initialize the log file
671 case $name in
672 binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
673 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
674 ;;
675 * )
676 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
677 ;;
678 esac
679 # If using optimizations, write the instructions
680 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
681 fi
682 #
683 CHROOT_wrt_RunAsRoot "${file}"
684 #
685 # Write installed files log and remove the build directory(ies)
686 # except if the package build fails.
687 if [ "$pkg_tarball" != "" ] ; then
688 CHROOT_wrt_RemoveBuildDirs "$name"
689 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
690 CHROOT_wrt_LogNewFiles "$name1"
691 fi
692 fi
693 #
694 # Include a touch of the target name so make can check
695 # if it's already been made.
696 wrt_touch
697 #
698 #--------------------------------------------------------------------#
699 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
700 #--------------------------------------------------------------------#
701 #
702 # Keep the script file name for Makefile dependencies.
703 PREV=${this_script}
704 # Set system_build envar for iteration targets
705 system_build=$basicsystem
706 done # for file in final-system/* ...
707}
708
709#--------------------------------------#
710bootscripts_Makefiles() { #
711#--------------------------------------#
712
713# New versions of the book do not have bootscripts anymore
714# (use systemd configuration files)
715# Define a variable to be used for the right script directory to parse
716 if [ -d bootscripts ]; then
717 config="bootscripts"
718 else
719 config="system-config"
720 fi
721
722 if [[ "${METHOD}" = "chroot" ]]; then
723 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) $config ( CHROOT ) ${R_arrow}"
724 else
725 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) $config ( ROOT ) ${R_arrow}"
726 fi
727
728 for file in $config/* ; do
729 # Keep the script file name
730 this_script=`basename $file`
731
732 case $this_script in
733 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
734 *console*) continue ;; # Use the files that came with the bootscripts
735# fstab is now here (for 3.x.y)
736 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
737 *) ;;
738 esac
739
740 # First append each name of the script files to a list (this will become
741 # the names of the targets in the Makefile
742 bootscripttools="$bootscripttools $this_script"
743
744 # Grab the name of the target, strip id number, XXX-script.
745 # name1 is partially stripped and should be used for logging files.
746 # name is completely stripped and is used for grabbing
747 # the package name.
748 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
749 name=`echo $name1 | sed -e 's@-64bit@@' \
750 -e 's@-64@@' \
751 -e 's@64@@' \
752 -e 's@n32@@'`
753 case $name in
754 *bootscripts*) name=bootscripts-cross-lfs ;;
755 *udev-rules) name=udev-cross-lfs ;;
756 esac
757
758 pkg_tarball=$(get_package_tarball_name $name)
759
760 #--------------------------------------------------------------------#
761 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
762 #--------------------------------------------------------------------#
763 #
764 # Drop in the name of the target on a new line, and the previous target
765 # as a dependency. Also call the echo_message function.
766 CHROOT_wrt_target "${this_script}" "$PREV"
767 #
768 # If $pkg_tarball isn't empty, we've got a package...
769 #
770 if [ "$pkg_tarball" != "" ] ; then
771 if [ "${INSTALL_LOG}" = "y" ] ; then
772 CHROOT_wrt_TouchTimestamp
773 fi
774 CHROOT_Unpack "$pkg_tarball"
775 fi
776 #
777 case $this_script in
778 *fstab*) if [[ -n "$FSTAB" ]]; then
779 CHROOT_wrt_CopyFstab
780 else
781 CHROOT_wrt_RunAsRoot "${file}"
782 fi
783 ;;
784 *) CHROOT_wrt_RunAsRoot "${file}"
785 ;;
786 esac
787 #
788 # Write installed files log and remove the build directory(ies)
789 # except if the package build fails.
790 if [ "$pkg_tarball" != "" ] ; then
791 CHROOT_wrt_RemoveBuildDirs "$name"
792 if [ "${INSTALL_LOG}" = "y" ] ; then
793 CHROOT_wrt_LogNewFiles "$name1"
794 fi
795 fi
796 #
797 # Include a touch of the target name so make can check if it's already been made.
798 wrt_touch
799 #
800 #--------------------------------------------------------------------#
801 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
802 #--------------------------------------------------------------------#
803 #
804 # Keep the script file name for Makefile dependencies.
805 PREV=$this_script
806
807 done # for file in bootscripts/* ...
808}
809
810#--------------------------------------#
811network_Makefiles() { #
812#--------------------------------------#
813
814 if [[ "${METHOD}" = "chroot" ]]; then
815 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
816 else
817 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
818 fi
819
820 for file in network/* ; do
821 # Keep the script file name
822 this_script=`basename $file`
823
824 case $this_script in
825 *choose) continue ;; # This is not a script but a commentary.
826 *dhcp) continue ;; # Assume static networking.
827 *dhcpcd) continue ;; # Assume static networking.
828 *) ;;
829 esac
830
831 # First append each name of the script files to a list (this will become
832 # the names of the targets in the Makefile
833 networktools="$networktools $this_script"
834
835 # Grab the name of the target, strip id number, XXX-script
836 # name1 is partially stripped and should be used for logging files.
837 # name is completely stripped and is used for grabbing
838 # the package name.
839 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
840 name=`echo $name1 | sed -e 's@-64bit@@' \
841 -e 's@-64@@' \
842 -e 's@64@@' \
843 -e 's@n32@@'`
844 case $name in
845 network-scripts) name=clfs-network-scripts ;;
846 esac
847
848 pkg_tarball=$(get_package_tarball_name $name)
849
850 #--------------------------------------------------------------------#
851 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
852 #--------------------------------------------------------------------#
853 #
854 # Drop in the name of the target on a new line, and the previous target
855 # as a dependency. Also call the echo_message function.
856 CHROOT_wrt_target "${this_script}" "$PREV"
857 #
858 # If $pkg_tarball isn't empty, we've got a package...
859 #
860 if [ "$pkg_tarball" != "" ] ; then
861 if [ "${INSTALL_LOG}" = "y" ] ; then
862 CHROOT_wrt_TouchTimestamp
863 fi
864 CHROOT_Unpack "$pkg_tarball"
865 fi
866 #
867 CHROOT_wrt_RunAsRoot "${file}"
868 #
869 # Write installed files log and remove the build directory(ies)
870 # except if the package build fails.
871 if [ "$pkg_tarball" != "" ] ; then
872 CHROOT_wrt_RemoveBuildDirs "$name"
873 if [ "${INSTALL_LOG}" = "y" ] ; then
874 CHROOT_wrt_LogNewFiles "$name1"
875 fi
876 fi
877 #
878 # Include a touch of the target name so make can check if it's already been made.
879 wrt_touch
880 #
881 #--------------------------------------------------------------------#
882 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
883 #--------------------------------------------------------------------#
884 #
885 # Keep the script file name for Makefile dependencies.
886 PREV=$this_script
887
888 done # for file in network/* ...
889}
890
891#--------------------------------------#
892bootable_Makefiles() { #
893#--------------------------------------#
894
895 if [[ "${METHOD}" = "chroot" ]]; then
896 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
897 else
898 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
899 fi
900
901
902 for file in bootable/* ; do
903 # Keep the script file name
904 this_script=`basename $file`
905
906 # A little housekeeping on the scripts
907 case $this_script in
908 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
909 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
910 *kernel) # if there is no kernel config file do not build the kernel
911 [[ -z $CONFIG ]] && continue
912 # Copy the config file to /sources with a standardized name
913 cp $CONFIG $BUILDDIR/sources/kernel-config
914 ;;
915 esac
916 #
917 # First append each name of the script files to a list (this will become
918 # the names of the targets in the Makefile
919 bootabletools="$bootabletools $this_script"
920 #
921 # Grab the name of the target, strip id number and misc words.
922 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
923 case $this_script in
924 *kernel*) name=linux
925 ;;
926 esac
927
928 pkg_tarball=$(get_package_tarball_name $name)
929
930 #--------------------------------------------------------------------#
931 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
932 #--------------------------------------------------------------------#
933 #
934 # Drop in the name of the target on a new line, and the previous target
935 # as a dependency. Also call the echo_message function.
936 CHROOT_wrt_target "${this_script}" "$PREV"
937 #
938 # If $pkg_tarball isn't empty, we've got a package...
939 # Insert instructions for unpacking the package and changing directories
940 #
941 if [ "$pkg_tarball" != "" ] ; then
942 if [ "${INSTALL_LOG}" = "y" ] ; then
943 CHROOT_wrt_TouchTimestamp
944 fi
945 CHROOT_Unpack "$pkg_tarball"
946 fi
947 #
948 # Select a script execution method
949 case $this_script in
950 *fstab*) if [[ -n "$FSTAB" ]]; then
951 CHROOT_wrt_CopyFstab
952 else
953 CHROOT_wrt_RunAsRoot "${file}"
954 fi
955 ;;
956 *) CHROOT_wrt_RunAsRoot "${file}"
957 ;;
958 esac
959 #
960 # Write installed files log and remove the build directory(ies)
961 # except if the package build fails.
962 if [ "$pkg_tarball" != "" ] ; then
963 CHROOT_wrt_RemoveBuildDirs "$name"
964 if [ "${INSTALL_LOG}" = "y" ] ; then
965 CHROOT_wrt_LogNewFiles "$name"
966 fi
967 fi
968 #
969 # Include a touch of the target name so make can check if it's already been made.
970 wrt_touch
971 #
972 #--------------------------------------------------------------------#
973 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
974 #--------------------------------------------------------------------#
975 #
976 # Keep the script file name for Makefile dependencies.
977 PREV=$this_script
978
979 done
980
981}
982
983
984#--------------------------------------#
985build_Makefile() { # Construct a Makefile from the book scripts
986#--------------------------------------#
987
988 echo "...Creating Makefile... ${BOLD}START${OFF}"
989
990 cd $JHALFSDIR/${PROGNAME}-commands
991 # Start with clean files
992 >$MKFILE
993 >$MKFILE.tmp
994
995 method_cmds=${METHOD}_Makefiles
996
997 host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
998 final_preps_Makefiles # mk_F_PREPS (LUSER) $final_preps
999 cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
1000 temptools_Makefiles # mk_TEMP (LUSER) $temptools
1001 $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
1002 if [[ ! $TEST = "0" ]]; then
1003 testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
1004 fi
1005 final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
1006 # Add the iterations targets, if needed
1007 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
1008 bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
1009 if [ -d network ]; then
1010 network_Makefiles # If present, process network setup.
1011 fi
1012 bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
1013
1014 # Add the CUSTOM_TOOLS targets, if needed
1015 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
1016
1017 # Add a header, some variables and include the function file
1018 # to the top of the real Makefile.
1019 wrt_Makefile_header
1020
1021 # Add chroot commands
1022 if [ "$METHOD" = "chroot" ] ; then
1023 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
1024 chroot=`cat chroot/???-chroot | \
1025 sed -e "s@chroot@$CHROOT_LOC@" \
1026 -e '/#!\/bin\/bash/d' \
1027 -e '/^export/d' \
1028 -e '/^logout/d' \
1029 -e 's@ \\\@ @g' | \
1030 tr -d '\n' | \
1031 sed -e 's/ */ /g' \
1032 -e 's|\\$|&&|g' \
1033 -e 's|exit||g' \
1034 -e 's|$| -c|' \
1035 -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
1036 -e 's|set -e||' \
1037 -e 's|set +h||'`
1038 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1039 fi
1040
1041################## CHROOT ####################
1042
1043if [[ "${METHOD}" = "chroot" ]]; then
1044(
1045cat << EOF
1046
1047all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
1048 @sudo make do-housekeeping
1049 @echo "$VERSION - jhalfs build" > clfs-release && \\
1050 sudo mv clfs-release \$(MOUNT_PT)/etc && \\
1051 sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
1052 @\$(call echo_finished,$VERSION)
1053
1054ck_UID:
1055 @if [ \`id -u\` = "0" ]; then \\
1056 echo "+--------------------------------------------------+"; \\
1057 echo "|You cannot run this makefile from the root account|"; \\
1058 echo "+--------------------------------------------------+"; \\
1059 exit 1; \\
1060 fi
1061
1062#---------------AS ROOT
1063mk_SETUP:
1064 @\$(call echo_SU_request)
1065 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1066 @touch \$@
1067
1068#---------------AS LUSER
1069mk_F_PREPS: mk_SETUP
1070 @\$(call echo_PHASE,Final Preparations Cross and Temporary Tools)
1071 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1072 @sudo make restore-luser-env
1073 @touch \$@
1074
1075mk_SUDO: mk_F_PREPS
1076 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1077 @touch \$@
1078
1079#---------------CHROOT JAIL
1080mk_SYSTOOLS: mk_SUDO
1081 @\$(call echo_CHROOT_request)
1082 @\$(call echo_PHASE, CHROOT JAIL )
1083 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
1084 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
1085 @touch \$@
1086
1087mk_BLFS_TOOL: create-sbu_du-report
1088 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1089 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1090 (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
1091 fi;
1092 @touch \$@
1093
1094mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1095 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1096 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1097 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
1098 (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
1099 fi;
1100 @touch \$@
1101
1102SETUP: $host_prep
1103AS_LUSER: $final_preps $cross_tools $temptools
1104SUDO: $orphan_scripts
1105PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
1106PREP_CHROOT_JAIL: ${chroottools}
1107CHROOT_JAIL: SHELL=/tools/bin/bash
1108CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
1109CUSTOM_TOOLS: $custom_list
1110
1111
1112create-sbu_du-report: mk_SYSTOOLS
1113 @\$(call echo_message, Building)
1114 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
1115 ./create-sbu_du-report.sh logs $VERSION; \\
1116 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
1117 fi;
1118 @touch \$@
1119
1120do-housekeeping:
1121 @-umount \$(MOUNT_PT)/dev/pts
1122 @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
1123 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
1124 umount \$(MOUNT_PT)/\$\$link; \\
1125 unset link; \\
1126 else \\
1127 umount \$(MOUNT_PT)/dev/shm; \\
1128 fi
1129 @-umount \$(MOUNT_PT)/dev
1130 @-umount \$(MOUNT_PT)/sys
1131 @-umount \$(MOUNT_PT)/proc
1132 @-rm /tools /cross-tools
1133 @-if [ ! -f luser-exist ]; then \\
1134 userdel \$(LUSER); \\
1135 rm -rf \$(LUSER_HOME); \\
1136 fi;
1137
1138EOF
1139) >> $MKFILE
1140
1141fi
1142
1143################### BOOT #####################
1144
1145if [[ "${METHOD}" = "boot" ]]; then
1146(
1147cat << EOF
1148
1149all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO
1150 @sudo make restore-luser-env
1151 @sudo make do-housekeeping
1152 @\$(call echo_boot_finished,$VERSION)
1153
1154makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
1155 @echo "$VERSION - jhalfs build" > /etc/clfs-release
1156 @\$(call echo_finished,$VERSION)
1157
1158
1159ck_UID:
1160 @if [ \`id -u\` = "0" ]; then \\
1161 echo "+--------------------------------------------------+"; \\
1162 echo "|You cannot run this makefile from the root account|"; \\
1163 echo "|However, if this is the boot environment |"; \\
1164 echo "| the command you are looking for is |"; \\
1165 echo "| make makesys |"; \\
1166 echo "| to complete the build |"; \\
1167 echo "+--------------------------------------------------+"; \\
1168 exit 1; \\
1169 fi
1170
1171#---------------AS ROOT
1172
1173mk_SETUP:
1174 @\$(call echo_SU_request)
1175 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1176 @touch \$@
1177
1178#---------------AS LUSER
1179
1180mk_F_PREPS: mk_SETUP
1181 @\$(call echo_PHASE,Final Preparations and Cross Tools)
1182 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1183 @touch \$@
1184
1185mk_SUDO: mk_F_PREPS
1186 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1187 @touch \$@
1188
1189#---------------AS ROOT
1190
1191mk_FINAL:
1192 @\$(call echo_PHASE,Final System)
1193 @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
1194 @touch \$@
1195
1196mk_BLFS_TOOL: mk_FINAL
1197 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1198 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1199 ( make -C $BLFS_ROOT/work ); \\
1200 fi;
1201 @touch \$@
1202
1203mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1204 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1205 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1206 mkdir -p ${TRACKING_DIR}; \\
1207 ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
1208 fi;
1209 @touch \$@
1210
1211SETUP: $host_prep
1212AS_LUSER: $final_preps $cross_tools $temptools ${boottools}
1213SUDO: $orphan_scripts
1214AS_ROOT: SHELL=/tools/bin/bash
1215AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
1216CUSTOM_TOOLS: $custom_list
1217
1218do-housekeeping:
1219 @-rm /tools /cross-tools
1220 @-if [ ! -f luser-exist ]; then \\
1221 userdel \$(LUSER); \\
1222 rm -rf \$(LUSER_HOME); \\
1223 fi;
1224
1225EOF
1226) >> $MKFILE
1227fi
1228
1229(
1230 cat << EOF
1231
1232restore-luser-env:
1233 @\$(call echo_message, Building)
1234 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
1235 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
1236 fi;
1237 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
1238 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
1239 fi;
1240 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
1241 touch \$@ && \\
1242 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1243 echo --------------------------------------------------------------------------------\$(WHITE)
1244
1245########################################################
1246
1247
1248EOF
1249) >> $MKFILE
1250
1251 # Bring over the items from the Makefile.tmp
1252 cat $MKFILE.tmp >> $MKFILE
1253 rm $MKFILE.tmp
1254
1255 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1256}
Note: See TracBrowser for help on using the repository browser.