source: CLFS/master.sh@ df97e68

2.4 ablfs-more legacy trunk
Last change on this file since df97e68 was 5f154f1, checked in by Pierre Labastie <pierre@…>, 9 years ago

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