Changeset d55a1a1


Ignore:
Timestamp:
11/13/2006 09:01:21 PM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
010627d
Parents:
1838bc7
Message:

Using only one set of functions for both chroot and boot methods in CLFS Makefile creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLFS/master.sh

    r1838bc7 rd55a1a1  
    388388
    389389#--------------------------------------#
    390 chroot_testsuite_tools_Makefiles() {   #
    391 #--------------------------------------#
    392   echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools  ( CHROOT ) ${R_arrow}"
     390testsuite_tools_Makefiles() {          #
     391#--------------------------------------#
     392
     393  if [[ "${METHOD}" = "chroot" ]]; then
     394    echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools  ( CHROOT ) ${R_arrow}"
     395  else
     396    echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
     397  fi
    393398
    394399  for file in testsuite-tools/* ; do
     
    437442}
    438443
    439 #--------------------------------------#
    440 boot_testsuite_tools_Makefiles() {     #
    441 #--------------------------------------#
    442   echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
    443   for file in testsuite-tools/* ; do
    444     # Keep the script file name
    445     this_script=`basename $file`
    446 
    447     # First append each name of the script files to a list (this will become
    448     # the names of the targets in the Makefile
    449     PREV=
    450     testsuitetools="$testsuitetools $this_script"
    451 
    452     # Grab the name of the target, strip id number, XXX-script
    453     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
    454                                   -e 's@-64bit@@' \
    455                                   -e 's@-64@@' \
    456                                   -e 's@64@@' \
    457                                   -e 's@n32@@'`
    458 
    459     pkg_tarball=$(get_package_tarball_name $name)
    460 
    461     #--------------------------------------------------------------------#
    462     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    463     #--------------------------------------------------------------------#
    464     #
    465     # Drop in the name of the target on a new line, and the previous target
    466     # as a dependency. Also call the echo_message function.
    467     CHROOT_wrt_target "${this_script}" "$PREV"
    468     #
    469     CHROOT_Unpack "$pkg_tarball"
    470     [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    471     #
    472     CHROOT_wrt_RunAsRoot "${file}"
    473     #
    474     CHROOT_wrt_RemoveBuildDirs "${name}"
    475     #
    476     # Include a touch of the target name so make can check if it's already been made.
    477     wrt_touch
    478     #
    479     #--------------------------------------------------------------------#
    480     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    481     #--------------------------------------------------------------------#
    482     #
    483     # Keep the script file name for Makefile dependencies.
    484     PREV=$this_script
    485 
    486   done
    487 
    488 }
    489 
    490 
    491 #--------------------------------------#
    492 chroot_final_system_Makefiles() {      #
     444
     445#--------------------------------------#
     446final_system_Makefiles() {             #
    493447#--------------------------------------#
    494448  # Set envars and scripts for iteration targets
     
    496450  if [[ -z "$1" ]] ; then
    497451    local N=""
     452    # In boot method the makesys phase was initiated in testsuite_tools_makefile
     453    [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
    498454  else
    499455    local N=-build_$1
     
    513469  fi
    514470
    515   echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
     471  if [[ "${METHOD}" = "chroot" ]]; then
     472    echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
     473  else
     474    echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N  ( ROOT ) ${R_arrow}"
     475  fi
    516476
    517477  for file in final-system$N/* ; do
     
    597557
    598558#--------------------------------------#
    599 boot_final_system_Makefiles() {        #
    600 #--------------------------------------#
    601   # Set envars and scripts for iteration targets
    602   LOGS="" # Start with an empty global LOGS envar
    603   if [[ -z "$1" ]] ; then
    604     local N=""
    605     # The makesys phase was initiated in bm_testsuite_tools_makefile
    606     [[ "$TEST" = 0 ]] && PREV=""
     559bootscripts_Makefiles() {              #
     560#--------------------------------------#
     561
     562  if [[ "${METHOD}" = "chroot" ]]; then
     563    echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts   ( CHROOT ) ${R_arrow}"
    607564  else
    608     local N=-build_$1
    609     local basicsystem=""
    610     mkdir final-system$N
    611     cp final-system/* final-system$N
    612     for script in final-system$N/* ; do
    613       # Overwrite existing symlinks, files, and dirs
    614       sed -e 's/ln -sv/&f/g' \
    615           -e 's/mv -v/&f/g' \
    616           -e 's/mkdir -v/&p/g' -i ${script}
    617     done
    618     # Remove Bzip2 binaries before make install
    619     sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
    620     # Delete *old Readline libraries just after make install
    621     sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
     565    echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts     ( ROOT ) ${R_arrow}"
    622566  fi
    623 
    624   echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N  ( ROOT ) ${R_arrow}"
    625 
    626   for file in final-system$N/* ; do
    627     # Keep the script file name
    628     this_script=`basename $file`
    629 
    630     # Test if the stripping phase must be skipped
    631     # Skip alsp temp-perl for iterative runs
    632     case $this_script in
    633       *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
    634       *temp-perl*) [[ -n "$N" ]] && continue ;;
    635     esac
    636 
    637     # Grab the name of the target, strip id number, XXX-script
    638     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
    639                                   -e 's@temp-@@' \
    640                                   -e 's@-64bit@@' \
    641                                   -e 's@-64@@' \
    642                                   -e 's@64@@' \
    643                                   -e 's@n32@@'`
    644 
    645     # Find the version of the command files, if it corresponds with the building of
    646     # a specific package. We need this here to can skip scripts not needed for
    647     # iterations rebuilds
    648 
    649     pkg_tarball=$(get_package_tarball_name $name)
    650 
    651     if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
    652       case "${this_script}" in
    653         *stripping*) ;;
    654         *)  continue ;;
    655       esac
    656     fi
    657 
    658     # Append each name of the script files to a list (this will become
    659     # the names of the targets in the Makefile
    660     basicsystem="$basicsystem ${this_script}${N}"
    661 
    662     # Append each name of the script files to a list (this will become
    663     # the names of the logs to be moved for each iteration)
    664     LOGS="$LOGS ${this_script}"
    665 
    666     #--------------------------------------------------------------------#
    667     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    668     #--------------------------------------------------------------------#
    669     #
    670     # Drop in the name of the target on a new line, and the previous target
    671     # as a dependency. Also call the echo_message function.
    672     CHROOT_wrt_target "${this_script}${N}" "$PREV"
    673 
    674     # If $pkg_tarball isn't empty, we've got a package...
    675     if [ "$pkg_tarball" != "" ] ; then
    676       FILE="$pkg_tarball"
    677       CHROOT_Unpack "$FILE"
    678       # If the testsuites must be run, initialize the log file
    679       case $name in
    680         binutils | gcc | glibc )
    681           [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
    682           ;;
    683         * )
    684           [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
    685           ;;
    686       esac
    687       # If using optimizations, write the instructions
    688       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    689     fi
    690     #
    691     CHROOT_wrt_RunAsRoot "${file}"
    692     #
    693     [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
    694     #
    695     # Include a touch of the target name so make can check if it's already been made.
    696     wrt_touch
    697     #
    698     #--------------------------------------------------------------------#
    699     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    700     #--------------------------------------------------------------------#
    701     #
    702     # Keep the script file name for Makefile dependencies.
    703     PREV=${this_script}${N}
    704     # Set system_build envar for iteration targets
    705     system_build=$basicsystem
    706   done  # for file in final-system/* ...
    707 
    708 }
    709 
    710 #--------------------------------------#
    711 chroot_bootscripts_Makefiles() {       #
    712 #--------------------------------------#
    713   echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts   ( CHROOT ) ${R_arrow}"
    714567
    715568  for file in bootscripts/* ; do
     
    770623
    771624#--------------------------------------#
    772 boot_bootscripts_Makefiles() {         #
    773 #--------------------------------------#
    774   echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts     ( ROOT ) ${R_arrow}"
    775 
    776   for file in bootscripts/* ; do
    777     # Keep the script file name
    778     this_script=`basename $file`
    779 
    780     case $this_script in
    781       *udev) continue    ;;  # This is not a script but a commentary
    782       *console*) continue ;; # Use the files that came with the bootscripts
    783       *)  ;;
    784     esac
    785 
    786     # First append each name of the script files to a list (this will become
    787     # the names of the targets in the Makefile
    788     bootscripttools="$bootscripttools $this_script"
    789 
    790     # Grab the name of the target, strip id number, XXX-script
    791     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
    792                                   -e 's@-64bit@@' \
    793                                   -e 's@-64@@' \
    794                                   -e 's@64@@' \
    795                                   -e 's@n32@@'`
    796     case $name in
    797       *bootscripts*) name=bootscripts-cross-lfs ;;
    798       *udev-rules)   name=udev-cross-lfs ;;
    799     esac
    800 
    801     pkg_tarball=$(get_package_tarball_name $name)
    802 
    803     #--------------------------------------------------------------------#
    804     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    805     #--------------------------------------------------------------------#
    806     #
    807     # Drop in the name of the target on a new line, and the previous target
    808     # as a dependency. Also call the echo_message function.
    809     CHROOT_wrt_target "${this_script}" "$PREV"
    810     #
    811     # If $pkg_tarball isn't empty, we've got a package...
    812     #
    813     [[ "$pkg_tarball" != "" ]] && CHROOT_Unpack "$pkg_tarball"
    814     #
    815     CHROOT_wrt_RunAsRoot "${file}"
    816     #
    817     [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
    818     #
    819     # Include a touch of the target name so make can check if it's already been made.
    820     wrt_touch
    821     #
    822     #--------------------------------------------------------------------#
    823     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    824     #--------------------------------------------------------------------#
    825     #
    826     # Keep the script file name for Makefile dependencies.
    827     PREV=$this_script
    828 
    829   done  # for file in bootscripts/* ...
    830 }
    831 
    832 #--------------------------------------#
    833 chroot_bootable_Makefiles() {          #
    834 #--------------------------------------#
    835   echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
     625bootable_Makefiles() {                 #
     626#--------------------------------------#
     627
     628  if [[ "${METHOD}" = "chroot" ]]; then
     629    echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
     630  else
     631    echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable   ( ROOT ) ${R_arrow}"
     632  fi
     633
    836634
    837635  for file in {bootable,the-end}/* ; do
     
    905703}
    906704
    907 #--------------------------------------#
    908 boot_bootable_Makefiles() {            #
    909 #--------------------------------------#
    910   echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable   ( ROOT ) ${R_arrow}"
    911 
    912   for file in {bootable,the-end}/* ; do
    913     # Keep the script file name
    914     this_script=`basename $file`
    915 
    916     # A little housekeeping on the scripts
    917     case $this_script in
    918       *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* )  continue  ;;
    919       *kernel) # if there is no kernel config file do not build the kernel
    920                [[ -z $CONFIG ]] && continue
    921                  # Copy the named config file to /sources with a standardized name
    922                cp $CONFIG $BUILDDIR/sources/kernel-config
    923          ;;
    924     esac
    925     #
    926     # First append each name of the script files to a list (this will become
    927     # the names of the targets in the Makefile
    928     bootabletools="$bootabletools $this_script"
    929     #
    930     # Grab the name of the target, strip id number and misc words.
    931     case $this_script in
    932       *kernel) name=linux  ;;
    933       *)       name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
    934     esac
    935 
    936     pkg_tarball=$(get_package_tarball_name $name)
    937 
    938     #--------------------------------------------------------------------#
    939     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
    940     #--------------------------------------------------------------------#
    941     #
    942     # Drop in the name of the target on a new line, and the previous target
    943     # as a dependency. Also call the echo_message function.
    944     CHROOT_wrt_target "${this_script}" "$PREV"
    945     #
    946     # If $pkg_tarball isn't empty, we've got a package...
    947     # Insert instructions for unpacking the package and changing directories
    948     #
    949     [[ "$pkg_tarball" != "" ]] && CHROOT_Unpack "$pkg_tarball"
    950     #
    951     # Select a script execution method
    952     case $this_script in
    953       *fstab*)  if [[ -n "$FSTAB" ]]; then
    954                   # Minimal boot mode has no access to original file, store in /sources
    955                   cp $FSTAB $BUILDDIR/sources/fstab
    956                   CHROOT_wrt_CopyFstab
    957                 else
    958                   CHROOT_wrt_RunAsRoot  "${file}"
    959                 fi
    960           ;;
    961       *)  CHROOT_wrt_RunAsRoot  "${file}"   ;;
    962     esac
    963     #
    964     # Housekeeping...remove any build directory(ies) except if the package build fails.
    965     [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
    966     #
    967     # Include a touch of the target name so make can check if it's already been made.
    968     wrt_touch
    969     #
    970     #--------------------------------------------------------------------#
    971     #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
    972     #--------------------------------------------------------------------#
    973     #
    974     # Keep the script file name for Makefile dependencies.
    975     PREV=$this_script
    976   done
    977 
    978 }
    979 
    980705
    981706#--------------------------------------#
     
    987712set +e
    988713  declare -f  method_cmds
    989   declare -f  testsuite_cmds
    990   declare -f  final_sys_cmds
    991   declare -f  bootscripts_cmds
    992   declare -f  bootable_cmds
    993714set -e
    994715
     
    1000721  >$MKFILE.tmp
    1001722
    1002        method_cmds=${METHOD}_Makefiles
    1003     testsuite_cmds=${METHOD}_testsuite_tools_Makefiles
    1004     final_sys_cmds=${METHOD}_final_system_Makefiles
    1005   bootscripts_cmds=${METHOD}_bootscripts_Makefiles
    1006      bootable_cmds=${METHOD}_bootable_Makefiles
     723  method_cmds=${METHOD}_Makefiles
    1007724
    1008725  host_prep_Makefiles        # mk_SETUP      (SETUP)  $host_prep
     
    1011728  $method_cmds               # mk_SYSTOOLS   (CHROOT) $chroottools/$boottools
    1012729  if [[ ! $TEST = "0" ]]; then
    1013     $testsuite_cmds          # mk_SYSTOOLS   (CHROOT) $testsuitetools
     730    testsuite_tools_Makefiles    # mk_SYSTOOLS   (CHROOT) $testsuitetools
    1014731  fi
    1015   $final_sys_cmds            # mk_FINAL      (CHROOT) $basicsystem
     732  final_system_Makefiles         # mk_FINAL      (CHROOT) $basicsystem
    1016733    # Add the iterations targets, if needed
    1017734  [[ "$COMPARE" = "y" ]] && wrt_compare_targets
    1018   $bootscripts_cmds          # mk_BOOTSCRIPT (CHROOT) $bootscripttools
    1019   $bootable_cmds             # mk_BOOTABLE   (CHROOT) $bootabletools
     735  bootscripts_Makefiles          # mk_BOOTSCRIPT (CHROOT) $bootscripttools
     736  bootable_Makefiles             # mk_BOOTABLE   (CHROOT) $bootabletools
    1020737
    1021738  # Add the BLFS_TOOL targets, if needed
     
    1111828AS_LUSER:    $cross_tools $temptools
    1112829SUDO:        $orphan_scripts
    1113 CHROOT_JAIL: ${chroottools}${boottools} $testsuitetools $basicsystem  $bootscripttools  $bootabletools
     830CHROOT_JAIL: ${chroottools} $testsuitetools $basicsystem  $bootscripttools  $bootabletools
    1114831BLFS_TOOL:   $blfs_tool
    1115832
     
    1171888mk_SETUP:
    1172889        @\$(call echo_SU_request)
    1173         @sudo make SETUP
     890        @sudo make SHELL=/bin/bash SETUP
    1174891        @touch \$@
    1175892
     
    1189906mk_FINAL:
    1190907        @\$(call echo_PHASE,Final System)
    1191         @( make AS_ROOT )
     908        @( source /root/.bash_profile && make AS_ROOT )
    1192909        @touch \$@
    1193910
     
    1196913        @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
    1197914          mkdir -p $TRACKING_DIR; \\
    1198           make BLFS_TOOL; \\
     915          ( make BLFS_TOOL ); \\
    1199916        fi
    1200917        @touch \$@
    1201918
    1202919SETUP:      $host_prep
    1203 AS_LUSER:   $cross_tools $temptools ${chroottools}${boottools}
     920AS_LUSER:   $cross_tools $temptools ${boottools}
    1204921SUDO:       $orphan_scripts
    1205922AS_ROOT:    $testsuitetools $basicsystem $bootscripttools $bootabletools
Note: See TracChangeset for help on using the changeset viewer.