source: CLFS/master.sh@ ff5c301

ablfs-more legacy trunk
Last change on this file since ff5c301 was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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