source: CLFS/master.sh@ 34d1b6a

2.4 ablfs-more legacy new_features trunk
Last change on this file since 34d1b6a was ce262a7, checked in by Pierre Labastie <pierre@…>, 11 years ago

Add optimization (MAKEFLAGS only) for the cross tools part of CLFS

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