source: CLFS/master.sh@ cd668b9

ablfs
Last change on this file since cd668b9 was 608fbe1, checked in by Matthew Burgess <matthew@…>, 13 years ago

Fix various issues when building CLFS.

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