source: CLFS/master.sh@ 179ae85

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

Adapt instructions to new layout for "boot" method, while keeping
compatibility with older layouts. Joint work with W. Harrington

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