source: CLFS/master.sh@ 269d81c

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

Incorporates BLFS tools to CLFS. WOrks with method=chroot. Not tested
with method=boot

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