source: CLFS/master.sh@ 5130b3a

ablfs
Last change on this file since 5130b3a was df41521, checked in by Pierre Labastie <pierre@…>, 11 years ago

Merge trunk 3745:3750

  • Property mode set to 100644
File size: 39.0 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)
[df41521]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)
[df41521]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 \\
[df41521]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 \\
[df41521]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; \\
[df41521]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 && \\
[df41521]72 chmod a+wt \$(MOUNT_PT) && \\
73 if [ -d \$(MOUNT_PT)/var ]; then \\
74 chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
75 fi && \\
[877cc6a]76 touch envars && \\
[df41521]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"
[3fed586]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"
[3fed586]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"
[3fed586]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"
[3fed586]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"
[3fed586]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"
[3fed586]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"
[3fed586]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"
[3fed586]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 ;;
[045b2dc]340 *whatnext*) continue ;;
341 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
342 *kernel) # if there is no kernel config file do not build the kernel
343 [[ -z $CONFIG ]] && continue
344 # Copy the config file to /sources with a standardized name
345 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
346 ;;
[877cc6a]347 esac
348 #
349 # First append each name of the script files to a list (this will become
350 # the names of the targets in the Makefile
[045b2dc]351 case "${this_script}" in
352 *changingowner) orphan_scripts="${orphan_scripts} ${this_script}" ;;
353 *devices) orphan_scripts="${orphan_scripts} ${this_script}" ;;
354 *) boottools="$boottools $this_script" ;;
355 esac
356 #
357 # Grab the name of the target, strip id number and misc words.
358 case $this_script in
359 *kernel) name=linux ;;
360 *bootscripts) name="bootscripts-cross-lfs" ;;
361 *udev-rules) name="udev-cross-lfs" ;;
362 *grub-build) name=grub ;;
363 *-aboot-build) name=aboot ;;
364 *yaboot-build) name=yaboot ;;
365 *colo-build) name=colo ;;
366 *silo-build) name=silo ;;
367 *arcload-build) name=arcload ;;
368 *lilo-build) name=lilo ;;
369 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
370 esac
371 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
[a160d86]372 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]373
374 #--------------------------------------------------------------------#
375 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
376 #--------------------------------------------------------------------#
377 #
378 # Drop in the name of the target on a new line, and the previous target
379 # as a dependency. Also call the echo_message function.
[045b2dc]380 LUSER_wrt_target "${this_script}" "$PREV"
[877cc6a]381 #
[a160d86]382 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]383 # Insert instructions for unpacking the package and changing directories
384 #
[045b2dc]385 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
[3fed586]386 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]387 #
388 # Select a script execution method
389 case $this_script in
[045b2dc]390 # The following 2 scripts are defined in the /boot directory but need
391 # to be run as a root user. Set them up here but run them in another phase
[8f2c086]392 *changingowner*) wrt_RunAsRoot "${file}" ;;
393 *devices*) wrt_RunAsRoot "${file}" ;;
[045b2dc]394 *fstab*) if [[ -n "$FSTAB" ]]; then
395 LUSER_wrt_CopyFstab
396 else
397 LUSER_wrt_RunAsUser "${file}"
398 fi
399 ;;
400 *) LUSER_wrt_RunAsUser "${file}" ;;
[877cc6a]401 esac
402 #
[045b2dc]403 # Housekeeping...remove any build directory(ies) except if the package build fails.
404 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
[877cc6a]405 #
406 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]407 wrt_touch
[877cc6a]408 #
409 #--------------------------------------------------------------------#
410 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
411 #--------------------------------------------------------------------#
412 #
413 # Keep the script file name for Makefile dependencies.
414 PREV=$this_script
415
[045b2dc]416 done
[877cc6a]417}
418
419
[045b2dc]420#--------------------------------------#
[d55a1a1]421testsuite_tools_Makefiles() { #
[045b2dc]422#--------------------------------------#
[877cc6a]423
[d55a1a1]424 if [[ "${METHOD}" = "chroot" ]]; then
425 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
426 else
427 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
[010627d]428 PREV=""
[d55a1a1]429 fi
[877cc6a]430
431 for file in testsuite-tools/* ; do
432 # Keep the script file name
433 this_script=`basename $file`
434
435 # First append each name of the script files to a list (this will become
436 # the names of the targets in the Makefile
437 testsuitetools="$testsuitetools $this_script"
438
439 # Grab the name of the target, strip id number, XXX-script
440 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
441 -e 's@-64bit@@' \
442 -e 's@-64@@' \
443 -e 's@64@@' \
444 -e 's@n32@@'`
445
[a160d86]446 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]447
448 #--------------------------------------------------------------------#
449 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
450 #--------------------------------------------------------------------#
451 #
452 # Drop in the name of the target on a new line, and the previous target
453 # as a dependency. Also call the echo_message function.
[ca6b261]454 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]455 #
[ca6b261]456 CHROOT_Unpack "$pkg_tarball"
[3fed586]457 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]458 #
[ca6b261]459 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]460 #
[ca6b261]461 CHROOT_wrt_RemoveBuildDirs "${name}"
[877cc6a]462 #
463 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]464 wrt_touch
[877cc6a]465 #
466 #--------------------------------------------------------------------#
467 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
468 #--------------------------------------------------------------------#
469 #
470 # Keep the script file name for Makefile dependencies.
471 PREV=$this_script
472
473 done
474}
475
476
[045b2dc]477#--------------------------------------#
[d55a1a1]478final_system_Makefiles() { #
[045b2dc]479#--------------------------------------#
[45f82718]480 # Set envars and scripts for iteration targets
481 if [[ -z "$1" ]] ; then
482 local N=""
[d55a1a1]483 # In boot method the makesys phase was initiated in testsuite_tools_makefile
484 [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
[45f82718]485 else
486 local N=-build_$1
487 local basicsystem=""
488 mkdir final-system$N
489 cp final-system/* final-system$N
490 for script in final-system$N/* ; do
491 # Overwrite existing symlinks, files, and dirs
492 sed -e 's/ln -sv/&f/g' \
493 -e 's/mv -v/&f/g' \
494 -e 's/mkdir -v/&p/g' -i ${script}
[10c8b78]495 # Rename the scripts
496 mv ${script} ${script}$N
[45f82718]497 done
[a5f52ba]498 # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
[10c8b78]499 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
[45f82718]500 # Delete *old Readline libraries just after make install
[10c8b78]501 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
[45f82718]502 fi
503
[d55a1a1]504 if [[ "${METHOD}" = "chroot" ]]; then
505 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
506 else
507 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
508 fi
[877cc6a]509
[45f82718]510 for file in final-system$N/* ; do
[877cc6a]511 # Keep the script file name
512 this_script=`basename $file`
513
[45f82718]514 # Test if the stripping phase must be skipped.
515 # Skip alsp temp-perl for iterative runs
[877cc6a]516 case $this_script in
[401f81e]517 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
[45f82718]518 *temp-perl*) [[ -n "$N" ]] && continue ;;
[877cc6a]519 esac
520
521 # Grab the name of the target, strip id number, XXX-script
522 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
523 -e 's@temp-@@' \
524 -e 's@-64bit@@' \
525 -e 's@-64@@' \
526 -e 's@64@@' \
[10c8b78]527 -e 's@n32@@' \
528 -e 's,'$N',,'`
[877cc6a]529
[45f82718]530 # Find the version of the command files, if it corresponds with the building of
531 # a specific package. We need this here to can skip scripts not needed for
532 # iterations rebuilds
[a160d86]533 pkg_tarball=$(get_package_tarball_name $name)
[9d9ecf7]534
[a160d86]535 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]536 case "${this_script}" in
537 *stripping*) ;;
538 *) continue ;;
539 esac
540 fi
541
542 # Append each name of the script files to a list (this will become
543 # the names of the targets in the Makefile
[10c8b78]544 basicsystem="$basicsystem ${this_script}"
[45f82718]545
[877cc6a]546 #--------------------------------------------------------------------#
547 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
548 #--------------------------------------------------------------------#
549 #
550 # Drop in the name of the target on a new line, and the previous target
551 # as a dependency. Also call the echo_message function.
[10c8b78]552 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]553
[a160d86]554 # If $pkg_tarball isn't empty, we've got a package...
555 if [ "$pkg_tarball" != "" ] ; then
[f546320]556 # Touch timestamp file if installed files logs will be created.
557 # But only for the firt build when running iterative builds.
558 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
559 CHROOT_wrt_TouchTimestamp
560 fi
[045b2dc]561 CHROOT_Unpack "$pkg_tarball"
[a229600]562 # If the testsuites must be run, initialize the log file
563 case $name in
[df41521]564 binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
[10c8b78]565 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]566 ;;
567 * )
[10c8b78]568 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
[a229600]569 ;;
570 esac
571 # If using optimizations, write the instructions
[1b65a84]572 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]573 fi
574 #
[045b2dc]575 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]576 #
[f546320]577 # Write installed files log and remove the build directory(ies)
578 # except if the package build fails.
579 if [ "$pkg_tarball" != "" ] ; then
580 CHROOT_wrt_RemoveBuildDirs "$name"
581 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
582 CHROOT_wrt_LogNewFiles "$name"
583 fi
584 fi
[877cc6a]585 #
[f546320]586 # Include a touch of the target name so make can check
587 # if it's already been made.
[93f38e7]588 wrt_touch
[877cc6a]589 #
590 #--------------------------------------------------------------------#
591 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
592 #--------------------------------------------------------------------#
593 #
594 # Keep the script file name for Makefile dependencies.
[10c8b78]595 PREV=${this_script}
[45f82718]596 # Set system_build envar for iteration targets
597 system_build=$basicsystem
[877cc6a]598 done # for file in final-system/* ...
599}
600
[045b2dc]601#--------------------------------------#
[d55a1a1]602bootscripts_Makefiles() { #
[045b2dc]603#--------------------------------------#
[d55a1a1]604
605 if [[ "${METHOD}" = "chroot" ]]; then
606 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts ( CHROOT ) ${R_arrow}"
[45f82718]607 else
[d55a1a1]608 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts ( ROOT ) ${R_arrow}"
[45f82718]609 fi
[877cc6a]610
611 for file in bootscripts/* ; do
612 # Keep the script file name
613 this_script=`basename $file`
614
615 case $this_script in
616 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
617 *console*) continue ;; # Use the files that came with the bootscripts
618 *) ;;
619 esac
620
621 # First append each name of the script files to a list (this will become
622 # the names of the targets in the Makefile
623 bootscripttools="$bootscripttools $this_script"
624
625 # Grab the name of the target, strip id number, XXX-script
626 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
627 -e 's@-64bit@@' \
628 -e 's@-64@@' \
629 -e 's@64@@' \
630 -e 's@n32@@'`
631 case $name in
[c044e3c]632 *bootscripts*) name=bootscripts-cross-lfs ;;
[877cc6a]633 *udev-rules) name=udev-cross-lfs ;;
634 esac
[c044e3c]635
[a160d86]636 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]637
638 #--------------------------------------------------------------------#
639 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
640 #--------------------------------------------------------------------#
641 #
642 # Drop in the name of the target on a new line, and the previous target
643 # as a dependency. Also call the echo_message function.
[045b2dc]644 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]645 #
[a160d86]646 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]647 #
[f546320]648 if [ "$pkg_tarball" != "" ] ; then
649 if [ "${INSTALL_LOG}" = "y" ] ; then
650 CHROOT_wrt_LogNewFiles "$name"
651 fi
652 CHROOT_Unpack "$pkg_tarball"
653 fi
[877cc6a]654 #
[045b2dc]655 CHROOT_wrt_RunAsRoot "${file}"
[877cc6a]656 #
[f546320]657 # Write installed files log and remove the build directory(ies)
658 # except if the package build fails.
659 if [ "$pkg_tarball" != "" ] ; then
660 CHROOT_wrt_RemoveBuildDirs "$name"
661 if [ "${INSTALL_LOG}" = "y" ] ; then
662 CHROOT_wrt_LogNewFiles "$name"
663 fi
664 fi
[877cc6a]665 #
666 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]667 wrt_touch
[877cc6a]668 #
669 #--------------------------------------------------------------------#
670 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
671 #--------------------------------------------------------------------#
672 #
673 # Keep the script file name for Makefile dependencies.
674 PREV=$this_script
675
676 done # for file in bootscripts/* ...
677}
678
[608fbe1]679#--------------------------------------#
680network_Makefiles() { #
681#--------------------------------------#
682
683 if [[ "${METHOD}" = "chroot" ]]; then
684 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
685 else
686 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
687 fi
688
689 for file in network/* ; do
690 # Keep the script file name
691 this_script=`basename $file`
692
693 case $this_script in
694 *choose) continue ;; # This is not a script but a commentary.
695 *dhcp) continue ;; # Assume static networking.
696 *dhcpcd) continue ;; # Assume static networking.
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 networktools="$networktools $this_script"
703
704 # Grab the name of the target, strip id number, XXX-script
705 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
706 -e 's@-64bit@@' \
707 -e 's@-64@@' \
708 -e 's@64@@' \
709 -e 's@n32@@'`
710 case $name in
711 *network*) name=network-cross-lfs ;;
712 esac
713
714 pkg_tarball=$(get_package_tarball_name $name)
715
716 #--------------------------------------------------------------------#
717 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
718 #--------------------------------------------------------------------#
719 #
720 # Drop in the name of the target on a new line, and the previous target
721 # as a dependency. Also call the echo_message function.
722 CHROOT_wrt_target "${this_script}" "$PREV"
723 #
724 # If $pkg_tarball isn't empty, we've got a package...
725 #
726 if [ "$pkg_tarball" != "" ] ; then
727 if [ "${INSTALL_LOG}" = "y" ] ; then
728 CHROOT_wrt_LogNewFiles "$name"
729 fi
730 CHROOT_Unpack "$pkg_tarball"
731 fi
732 #
733 CHROOT_wrt_RunAsRoot "${file}"
734 #
735 # Write installed files log and remove the build directory(ies)
736 # except if the package build fails.
737 if [ "$pkg_tarball" != "" ] ; then
738 CHROOT_wrt_RemoveBuildDirs "$name"
739 if [ "${INSTALL_LOG}" = "y" ] ; then
740 CHROOT_wrt_LogNewFiles "$name"
741 fi
742 fi
743 #
744 # Include a touch of the target name so make can check if it's already been made.
745 wrt_touch
746 #
747 #--------------------------------------------------------------------#
748 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
749 #--------------------------------------------------------------------#
750 #
751 # Keep the script file name for Makefile dependencies.
752 PREV=$this_script
753
754 done # for file in network/* ...
755}
756
[045b2dc]757#--------------------------------------#
[d55a1a1]758bootable_Makefiles() { #
[045b2dc]759#--------------------------------------#
[877cc6a]760
[d55a1a1]761 if [[ "${METHOD}" = "chroot" ]]; then
762 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
763 else
764 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
765 fi
[877cc6a]766
767
[936efa8]768 for file in bootable/* ; do
[877cc6a]769 # Keep the script file name
770 this_script=`basename $file`
771
772 # A little housekeeping on the scripts
773 case $this_script in
774 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[045b2dc]775 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
[877cc6a]776 *kernel) # if there is no kernel config file do not build the kernel
777 [[ -z $CONFIG ]] && continue
778 # Copy the config file to /sources with a standardized name
779 cp $CONFIG $BUILDDIR/sources/kernel-config
780 ;;
781 esac
782 #
783 # First append each name of the script files to a list (this will become
784 # the names of the targets in the Makefile
785 bootabletools="$bootabletools $this_script"
786 #
787 # Grab the name of the target, strip id number and misc words.
788 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
789 case $this_script in
790 *kernel*) name=linux
791 ;;
792 esac
[a160d86]793
794 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]795
796 #--------------------------------------------------------------------#
797 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
798 #--------------------------------------------------------------------#
799 #
800 # Drop in the name of the target on a new line, and the previous target
801 # as a dependency. Also call the echo_message function.
[045b2dc]802 CHROOT_wrt_target "${this_script}" "$PREV"
[877cc6a]803 #
[a160d86]804 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]805 # Insert instructions for unpacking the package and changing directories
806 #
[f546320]807 if [ "$pkg_tarball" != "" ] ; then
808 if [ "${INSTALL_LOG}" = "y" ] ; then
809 CHROOT_wrt_LogNewFiles "$name"
810 fi
811 CHROOT_Unpack "$pkg_tarball"
812 fi
[877cc6a]813 #
814 # Select a script execution method
815 case $this_script in
[045b2dc]816 *fstab*) if [[ -n "$FSTAB" ]]; then
817 CHROOT_wrt_CopyFstab
818 else
819 CHROOT_wrt_RunAsRoot "${file}"
820 fi
821 ;;
822 *) CHROOT_wrt_RunAsRoot "${file}"
823 ;;
[877cc6a]824 esac
825 #
[f546320]826 # Write installed files log and remove the build directory(ies)
827 # except if the package build fails.
828 if [ "$pkg_tarball" != "" ] ; then
829 CHROOT_wrt_RemoveBuildDirs "$name"
830 if [ "${INSTALL_LOG}" = "y" ] ; then
831 CHROOT_wrt_LogNewFiles "$name"
832 fi
833 fi
[877cc6a]834 #
835 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]836 wrt_touch
[877cc6a]837 #
838 #--------------------------------------------------------------------#
839 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
840 #--------------------------------------------------------------------#
841 #
842 # Keep the script file name for Makefile dependencies.
843 PREV=$this_script
844
845 done
846
847}
848
849
[045b2dc]850#--------------------------------------#
851build_Makefile() { # Construct a Makefile from the book scripts
852#--------------------------------------#
853
854 echo "...Creating Makefile... ${BOLD}START${OFF}"
[877cc6a]855
856 cd $JHALFSDIR/${PROGNAME}-commands
[df41521]857 # Start with clean files
[045b2dc]858 >$MKFILE
[877cc6a]859 >$MKFILE.tmp
860
[d55a1a1]861 method_cmds=${METHOD}_Makefiles
[045b2dc]862
863 host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
864 cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
865 temptools_Makefiles # mk_TEMP (LUSER) $temptools
866 $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
867 if [[ ! $TEST = "0" ]]; then
[d55a1a1]868 testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
[877cc6a]869 fi
[d55a1a1]870 final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
[045b2dc]871 # Add the iterations targets, if needed
872 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
[d55a1a1]873 bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
[608fbe1]874 if [ -d network ]; then
875 network_Makefiles # If present, process network setup.
876 fi
[d55a1a1]877 bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
[877cc6a]878
[3e7ceed]879 # Add the CUSTOM_TOOLS targets, if needed
880 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
[c10570d]881
[877cc6a]882 # Add a header, some variables and include the function file
883 # to the top of the real Makefile.
[195ed9f]884 wrt_Makefile_header
[877cc6a]885
886 # Add chroot commands
887 if [ "$METHOD" = "chroot" ] ; then
[6ad5a2f]888 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
[15c9e72]889 chroot=`cat chroot/???-chroot | \
[6ad5a2f]890 sed -e "s@chroot@$CHROOT_LOC@" \
[830f28d]891 -e '/#!\/bin\/bash/d' \
[6ad5a2f]892 -e '/^export/d' \
893 -e '/^logout/d' \
894 -e 's@ \\\@ @g' | \
895 tr -d '\n' | \
896 sed -e 's/ */ /g' \
897 -e 's|\\$|&&|g' \
898 -e 's|exit||g' \
899 -e 's|$| -c|' \
[f4d9a48]900 -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
[f3a7f3b]901 -e 's|set -e||' \
902 -e 's|set +h||'`
[877cc6a]903 echo -e "CHROOT1= $chroot\n" >> $MKFILE
904 fi
905
[045b2dc]906################## CHROOT ####################
907
[877cc6a]908if [[ "${METHOD}" = "chroot" ]]; then
909(
[045b2dc]910cat << EOF
[877cc6a]911
[3e7ceed]912all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
[045b2dc]913 @sudo make do-housekeeping
[936efa8]914 @echo "$VERSION - jhalfs build" > clfs-release && \\
[df41521]915 sudo mv clfs-release \$(MOUNT_PT)/etc && \\
916 sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
[045b2dc]917 @\$(call echo_finished,$VERSION)
[a160d86]918
[045b2dc]919ck_UID:
920 @if [ \`id -u\` = "0" ]; then \\
921 echo "+--------------------------------------------------+"; \\
922 echo "|You cannot run this makefile from the root account|"; \\
923 echo "+--------------------------------------------------+"; \\
924 exit 1; \\
925 fi
926
927#---------------AS ROOT
928mk_SETUP:
929 @\$(call echo_SU_request)
[7a43320]930 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]931 @touch \$@
932
933#---------------AS LUSER
934mk_CROSS: mk_SETUP
935 @\$(call echo_PHASE,Cross and Temporary Tools)
[df41521]936 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
[045b2dc]937 @sudo make restore-luser-env
938 @touch \$@
939
940mk_SUDO: mk_CROSS
[7a43320]941 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[045b2dc]942 @touch \$@
943
944#---------------CHROOT JAIL
945mk_SYSTOOLS: mk_SUDO
946 @\$(call echo_CHROOT_request)
947 @\$(call echo_PHASE, CHROOT JAIL )
[6c1b96b]948 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
[7a43320]949 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
[045b2dc]950 @touch \$@
[877cc6a]951
[df41521]952mk_BLFS_TOOL: create-sbu_du-report
953 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
954 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
955 (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
956 fi;
957 @touch \$@
958
959mk_CUSTOM_TOOLS: mk_BLFS_TOOL
[3e7ceed]960 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[79da297]961 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3e7ceed]962 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
[7a43320]963 (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
[3e7ceed]964 fi;
965 @touch \$@
966
[6c1b96b]967SETUP: $host_prep
968AS_LUSER: $cross_tools $temptools
969SUDO: $orphan_scripts
970PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
971PREP_CHROOT_JAIL: ${chroottools}
972CHROOT_JAIL: SHELL=/tools/bin/bash
973CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
974CUSTOM_TOOLS: $custom_list
[877cc6a]975
[1838bc7]976
977create-sbu_du-report: mk_SYSTOOLS
978 @\$(call echo_message, Building)
979 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
980 ./create-sbu_du-report.sh logs $VERSION; \\
981 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
982 fi;
983 @touch \$@
984
[7d9a82d]985do-housekeeping:
[4524fb2]986 @-umount \$(MOUNT_PT)/dev/pts
[df41521]987 @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
988 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
989 umount \$(MOUNT_PT)/\$\$link; \\
990 unset link; \\
991 else \\
992 umount \$(MOUNT_PT)/dev/shm; \\
993 fi
[4524fb2]994 @-umount \$(MOUNT_PT)/dev
995 @-umount \$(MOUNT_PT)/sys
996 @-umount \$(MOUNT_PT)/proc
[045b2dc]997 @-rm /tools /cross-tools
[6ad5a2f]998 @-if [ ! -f luser-exist ]; then \\
999 userdel \$(LUSER); \\
[962793a]1000 rm -rf \$(LUSER_HOME); \\
[7d9a82d]1001 fi;
1002
[877cc6a]1003EOF
1004) >> $MKFILE
[045b2dc]1005
[877cc6a]1006fi
1007
[045b2dc]1008################### BOOT #####################
[877cc6a]1009
1010if [[ "${METHOD}" = "boot" ]]; then
1011(
[045b2dc]1012cat << EOF
[877cc6a]1013
[045b2dc]1014all: ck_UID mk_SETUP mk_CROSS mk_SUDO
1015 @sudo make restore-luser-env
1016 @sudo make do-housekeeping
[877cc6a]1017 @\$(call echo_boot_finished,$VERSION)
1018
[3e7ceed]1019makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
[936efa8]1020 @echo "$VERSION - jhalfs build" > /etc/clfs-release
[877cc6a]1021 @\$(call echo_finished,$VERSION)
1022
1023
[045b2dc]1024ck_UID:
1025 @if [ \`id -u\` = "0" ]; then \\
1026 echo "+--------------------------------------------------+"; \\
1027 echo "|You cannot run this makefile from the root account|"; \\
1028 echo "|However, if this is the boot environment |"; \\
1029 echo "| the command you are looking for is |"; \\
1030 echo "| make makesys |"; \\
[df41521]1031 echo "| to complete the build |"; \\
[045b2dc]1032 echo "+--------------------------------------------------+"; \\
1033 exit 1; \\
1034 fi
[877cc6a]1035
[045b2dc]1036#---------------AS ROOT
[877cc6a]1037
[045b2dc]1038mk_SETUP:
1039 @\$(call echo_SU_request)
[7a43320]1040 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]1041 @touch \$@
1042
1043#---------------AS LUSER
[a160d86]1044
[045b2dc]1045mk_CROSS: mk_SETUP
1046 @\$(call echo_PHASE,Cross Tool)
[df41521]1047 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
[045b2dc]1048 @touch \$@
1049
[c10570d]1050mk_SUDO: mk_CROSS
[7a43320]1051 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[045b2dc]1052 @touch \$@
1053
1054#---------------AS ROOT
1055
1056mk_FINAL:
1057 @\$(call echo_PHASE,Final System)
[7a43320]1058 @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
[045b2dc]1059 @touch \$@
1060
[df41521]1061mk_BLFS_TOOL: mk_FINAL
1062 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1063 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1064 ( make -C $BLFS_ROOT/work ); \\
1065 fi;
1066 @touch \$@
1067
1068mk_CUSTOM_TOOLS: mk_BLFS_TOOL
[3e7ceed]1069 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[79da297]1070 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3bc6078]1071 mkdir -p ${TRACKING_DIR}; \\
[7a43320]1072 ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
[3e7ceed]1073 fi;
1074 @touch \$@
1075
1076SETUP: $host_prep
1077AS_LUSER: $cross_tools $temptools ${boottools}
1078SUDO: $orphan_scripts
[aec4483]1079AS_ROOT: SHELL=/tools/bin/bash
[3e7ceed]1080AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
1081CUSTOM_TOOLS: $custom_list
[045b2dc]1082
1083do-housekeeping:
1084 @-rm /tools /cross-tools
1085 @-if [ ! -f luser-exist ]; then \\
[6ad5a2f]1086 userdel \$(LUSER); \\
[962793a]1087 rm -rf \$(LUSER_HOME); \\
[877cc6a]1088 fi;
1089
[045b2dc]1090EOF
1091) >> $MKFILE
1092fi
1093
1094(
1095 cat << EOF
1096
[6ad5a2f]1097restore-luser-env:
[877cc6a]1098 @\$(call echo_message, Building)
[962793a]1099 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
1100 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
[877cc6a]1101 fi;
[962793a]1102 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
1103 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
[877cc6a]1104 fi;
[962793a]1105 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
[93f38e7]1106 touch \$@ && \\
1107 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1108 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]1109
[045b2dc]1110########################################################
1111
[7d9a82d]1112
[877cc6a]1113EOF
1114) >> $MKFILE
1115
1116 # Bring over the items from the Makefile.tmp
1117 cat $MKFILE.tmp >> $MKFILE
1118 rm $MKFILE.tmp
1119
[045b2dc]1120 echo "Creating Makefile... ${BOLD}DONE${OFF}"
[877cc6a]1121}
Note: See TracBrowser for help on using the repository browser.