- Timestamp:
- 06/20/2020 04:45:26 PM (4 years ago)
- Branches:
- ablfs-more, legacy, trunk
- Children:
- 7b33f40
- Parents:
- 0a0753d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LFS/master.sh
r0a0753d r9a4c530 220 220 } 221 221 222 # NOT USED -- NOT USED223 #----------------------------#224 chapter5_Makefiles() {225 #----------------------------#226 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"227 228 # Initialize the Makefile target: it'll change during chapter229 # For vanilla lfs, the "changingowner" script should be run as root. So230 # it belongs to the "SUDO" target, with list in the "runasroot" variable.231 # For new lfs, changingowner and kernfs are in "runasroot", then the following,232 # starting at creatingdirs, are in the "CHROOT" target, in variable "chapter6".233 # Makefile_target records the variable, not really the target!234 # We use a case statement on that variable, because instructions in the235 # Makefile change according to the phase of the build (LUSER, SUDO, CHROOT).236 Makefile_target=chapter5237 238 # Start loop239 for file in chapter05/* ; do240 # Keep the script file name241 this_script=`basename $file`242 243 # Append each name of the script files to a list that Makefile_target244 # points to. But before that, change Makefile_target at the first script245 # of each target.246 case "${this_script}" in247 *changingowner) Makefile_target=runasroot ;;248 *creatingdirs ) Makefile_target=chapter6 ;; # only run for new lfs249 esac250 eval $Makefile_target=\"\$$Makefile_target ${this_script}\"251 252 # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc253 # and binutils in chapter 5)254 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' \255 -e 's@-pass[0-9]\{1\}@@' \256 -e 's@-libstdc++@@'`257 258 #--------------------------------------------------------------------#259 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #260 #--------------------------------------------------------------------#261 #262 # Find the name of the tarball and the version of the package263 pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)264 pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)265 266 # Drop in the name of the target on a new line, and the previous target267 # as a dependency. Also call the echo_message function.268 case $Makefile_target in269 chapter6) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;270 *) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;271 esac272 273 # If $pkg_tarball isn't empty, we've got a package...274 if [ "$pkg_tarball" != "" ] ; then275 # Always initialize the log file, since the test instructions may be276 # "uncommented" by the user277 case $Makefile_target in278 chapter6) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;279 *) LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;280 esac281 282 # If using optimizations, write the instructions283 case "${OPTIMIZE}${this_script}${REALSBU}" in284 *binutils-pass1y) ;;285 2*) wrt_optimize "$name" && wrt_makeflags "$name" ;;286 *) ;;287 esac288 fi289 290 # Insert date and disk usage at the top of the log file, the script run291 # and date and disk usage again at the bottom of the log file.292 # The changingowner script must be run as root.293 case "${Makefile_target}" in294 runasroot) wrt_RunAsRoot "$file" "$pkg_version" ;;295 chapter5) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;296 chapter6) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;297 esac298 299 # Include a touch of the target name so make can check300 # if it's already been made.301 wrt_touch302 #303 #--------------------------------------------------------------------#304 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #305 #--------------------------------------------------------------------#306 307 # Keep the script file name for Makefile dependencies.308 PREV=${this_script}309 done # end for file in chapter05/*310 }311 312 # NOT USED -- NOT USED keep for ICA code313 #----------------------------#314 chapter6_Makefiles() {315 #----------------------------#316 317 # Set envars and scripts for iteration targets318 if [[ -z "$1" ]] ; then319 local N=""320 else321 local N=-build_$1322 local chapter6=""323 mkdir chapter06$N324 cp chapter06/* chapter06$N325 for script in chapter06$N/* ; do326 # Overwrite existing symlinks, files, and dirs327 sed -e 's/ln *-sv/&f/g' \328 -e 's/mv *-v/&f/g' \329 -e 's/mkdir *-v/&p/g' -i ${script}330 # Suppress the mod of "test-installation.pl" because now331 # the library path points to /usr/lib332 if [[ ${script} =~ glibc ]]; then333 sed '/DL=/,/unset DL/d' -i ${script}334 fi335 # Rename the scripts336 mv ${script} ${script}$N337 done338 # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)339 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N340 # Remove openssl-<version> from /usr/share/doc (LFS-9.x), because341 # otherwise the mv command creates an openssl directory.342 sed -e 's@mv -v@rm -rfv /usr/share/doc/openssl-*\n&@' \343 -i chapter06$N/*-openssl$N344 fi345 346 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"347 348 # Initialize the Makefile target. In vanilla lfs, kernfs should be run as root,349 # then the others are run in chroot. If in new lfs, we should start in chroot.350 # this will be changed later because man-pages is the first script in351 # chapter 6. Note that this Makefile_target business is not really needed here352 # but we do it to have a similar structure to chapter 5 (we may merge all353 # those functions at some point).354 case "$N" in355 -build*) Makefile_target=chapter6 ;;356 *) Makefile_target=runasroot ;;357 esac358 359 # Start loop360 for file in chapter06$N/* ; do361 # Keep the script file name362 this_script=`basename $file`363 364 # Skip the "stripping" scripts if the user does not want to strip.365 # Skip also linux-headers in iterative builds.366 case "${this_script}" in367 *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;368 *linux-headers*) [[ -n "$N" ]] && continue ;;369 esac370 371 # Grab the name of the target.372 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`373 374 # Find the tarball corresponding to our script.375 # If it doesn't exist, we skip it in iterations rebuilds (except stripping376 # and revisedchroot, where .a and .la files are removed).377 pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)378 pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)379 380 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then381 case "${this_script}" in382 *stripping*|*revised*) ;;383 *) continue ;;384 esac385 fi386 387 # Append each name of the script files to a list (this will become388 # the names of the targets in the Makefile)389 # The kernfs script must be run as part of SUDO target.390 case "${this_script}" in391 *creatingdirs) Makefile_target=chapter6 ;;392 *man-pages ) Makefile_target=chapter6 ;;393 esac394 eval $Makefile_target=\"\$$Makefile_target ${this_script}\"395 396 #--------------------------------------------------------------------#397 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #398 #--------------------------------------------------------------------#399 #400 # Drop in the name of the target on a new line, and the previous target401 # as a dependency. Also call the echo_message function.402 # In the mount of kernel filesystems we need to set LFS403 # and not to use chroot.404 case "${Makefile_target}" in405 runasroot) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;406 *) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;407 esac408 409 # If $pkg_tarball isn't empty, we've got a package...410 # Insert instructions for unpacking the package and changing directories411 if [ "$pkg_tarball" != "" ] ; then412 # Touch timestamp file if installed files logs will be created.413 # But only for the firt build when running iterative builds.414 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then415 CHROOT_wrt_TouchTimestamp416 fi417 # Always initialize the log file, so that the user may reinstate a418 # commented out test419 CHROOT_wrt_test_log "${this_script}" "$pkg_version"420 # If using optimizations, write the instructions421 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"422 fi423 424 # In the mount of kernel filesystems we need to set LFS425 # and not to use chroot.426 case "${Makefile_target}" in427 runasroot) wrt_RunAsRoot "$file" "$pkg_version" ;;428 *) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;429 esac430 431 # Write installed files log and remove the build directory(ies)432 # except if the package build fails.433 if [ "$pkg_tarball" != "" ] ; then434 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then435 CHROOT_wrt_LogNewFiles "$name"436 fi437 fi438 439 # Include a touch of the target name so make can check440 # if it's already been made.441 wrt_touch442 #443 #--------------------------------------------------------------------#444 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #445 #--------------------------------------------------------------------#446 447 # Keep the script file name for Makefile dependencies.448 PREV=${this_script}449 # Set system_build envar for iteration targets450 if [ -z "$N" ]; then451 system_build="$system_build $this_script"452 fi453 done # end for file in chapter06/*454 if [ -n "$N" ]; then455 system_build="$chapter6"456 fi457 }458 # NOT USED -- NOT USED459 #----------------------------#460 chapter78_Makefiles() {461 #----------------------------#462 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"463 464 for file in chapter0{7,8}/* ; do465 # Keep the script file name466 this_script=`basename $file`467 468 # Grub must be configured manually.469 # Handle fstab creation.470 # If no .config file is supplied, the kernel build is skipped471 case ${this_script} in472 *grub) continue ;;473 *fstab) [[ -z "${FSTAB}" ]] ||474 [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||475 cp ${FSTAB} $BUILDDIR/sources/fstab ;;476 *kernel) [[ -z ${CONFIG} ]] && continue477 [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||478 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;479 esac480 481 # First append each name of the script files to a list (this will become482 # the names of the targets in the Makefile483 chapter78="$chapter78 ${this_script}"484 485 #--------------------------------------------------------------------#486 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #487 #--------------------------------------------------------------------#488 #489 # Drop in the name of the target on a new line, and the previous target490 # as a dependency. Also call the echo_message function.491 CHROOT_wrt_target "${this_script}" "$PREV"492 493 # Find the bootscripts or networkscripts (for systemd)494 # and kernel package names495 case "${this_script}" in496 *bootscripts)497 name="lfs-bootscripts"498 if [ "${INSTALL_LOG}" = "y" ] ; then499 CHROOT_wrt_TouchTimestamp500 fi501 ;;502 *network-scripts)503 name="lfs-network-scripts"504 if [ "${INSTALL_LOG}" = "y" ] ; then505 CHROOT_wrt_TouchTimestamp506 fi507 ;;508 *kernel)509 name="linux"510 if [ "${INSTALL_LOG}" = "y" ] ; then511 CHROOT_wrt_TouchTimestamp512 fi513 # If using optimizations, use MAKEFLAGS (unless blacklisted)514 # no setting of CFLAGS and friends.515 [[ "$OPTIMIZE" != "0" ]] && wrt_makeflags "$name"516 ;;517 esac518 519 # Check if we have a real /etc/fstab file520 case "${this_script}" in521 *fstab) if [[ -n "$FSTAB" ]]; then522 CHROOT_wrt_CopyFstab523 else524 CHROOT_wrt_RunAsRoot "$file"525 fi526 ;;527 *) CHROOT_wrt_RunAsRoot "$file"528 ;;529 esac530 531 case "${this_script}" in532 *bootscripts|*network-scripts|*kernel)533 if [ "${INSTALL_LOG}" = "y" ] ; then534 CHROOT_wrt_LogNewFiles "$name"535 fi ;;536 esac537 # Include a touch of the target name so make can check538 # if it's already been made.539 wrt_touch540 #541 #--------------------------------------------------------------------#542 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #543 #--------------------------------------------------------------------#544 545 # Keep the script file name for Makefile dependencies.546 PREV=${this_script}547 done # for file in chapter0{7,8}/*548 549 }550 551 222 #----------------------------# 552 223 build_Makefile() { #
Note:
See TracChangeset
for help on using the changeset viewer.