Changeset 50fb011 for HLFS


Ignore:
Timestamp:
08/30/2006 02:01:04 AM (18 years ago)
Author:
George Boudreau <georgeb@…>
Branches:
experimental
Children:
08a4953
Parents:
01b6d52
Message:

First commit of changes to makefile generation. Makefile now does recursive calls to itself for the different phases..SETUP,LUSER,CHROOT,ROOT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • HLFS/master.sh

    r01b6d52 r50fb011  
    88###################################
    99
     10
    1011#----------------------------#
    1112process_toolchain() {        # embryo,cocoon and butterfly need special handling
     
    1314  local toolchain=$1
    1415  local this_script=$2
    15   local  tc_phase
     16  local tc_phase
    1617  local binutil_tarball
    1718  local gcc_core_tarball
     19  local TC_MountPT
     20  local remove_existing
    1821 
    19   echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}"
     22  tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
     23  case $tc_phase in
     24    embryo | \
     25    cocoon)    # Vars for LUSER phase
     26       remove_existing="remove_existing_dirs"
     27            TC_MountPT="\$(MOUNT_PT)\$(SRC)"
     28       ;;
     29    butterfly) # Vars for CHROOT phase
     30       remove_existing="remove_existing_dirs2"
     31            TC_MountPT="\$(SRC)"
     32       ;;
     33  esac
    2034
    2135  #
     
    2539(
    2640cat << EOF
    27         @\$(call remove_existing_dirs,$binutil_tarball)
    28         @\$(call remove_existing_dirs,$gcc_core_tarball)
     41        @\$(call ${remove_existing},$binutil_tarball)
     42        @\$(call ${remove_existing},$gcc_core_tarball)
    2943EOF
    3044) >> $MKFILE.tmp
     
    3246  #
    3347  # Manually remove the toolchain directories..
    34   tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
    3548(
    3649cat << EOF
    37         @rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
    38         rm  -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
     50        @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
     51        rm  -rf ${TC_MountPT}/${tc_phase}-build
    3952EOF
    4053) >> $MKFILE.tmp
    4154
    42   case ${toolchain} in
    43     *butterfly*)
     55
    4456(
    4557cat << EOF
    46         @echo "export PKGDIR=\$(SRC)" > envars
     58        @echo "export PKGDIR=${TC_MountPT}" > envars
    4759EOF
    4860) >> $MKFILE.tmp
    49       [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
    50       wrt_run_as_chroot1 "$toolchain" "$this_script"
     61
     62  case ${tc_phase} in
     63    butterfly)
     64        [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
     65        CHROOT_wrt_RunAsRoot "$toolchain" "$this_script"
    5166      ;;
    52 
    53     *)
    54 (
    55 cat << EOF
    56         @echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
    57 EOF
    58 ) >> $MKFILE.tmp
    59       wrt_RunAsUser "$toolchain" "$this_script"
     67    *)  LUSER_wrt_RunAsUser "$toolchain" "$this_script"
    6068      ;;
    6169  esac
     
    6371(
    6472cat << EOF
    65         @\$(call remove_existing_dirs,$binutil_tarball)
    66         @\$(call remove_existing_dirs,$gcc_core_tarball)
     73        @\$(call ${remove_existing},$binutil_tarball)
     74        @\$(call ${remove_existing},$gcc_core_tarball)
    6775EOF
    6876) >> $MKFILE.tmp
     
    7078  #
    7179  # Manually remove the toolchain directories..
    72   tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
    7380(
    7481cat << EOF
    75         @rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
    76         rm  -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
     82        @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\
     83        rm  -rf ${TC_MountPT}/${tc_phase}-build
    7784EOF
    7885) >> $MKFILE.tmp
     
    8592#----------------------------#
    8693
    87   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
     94  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3     ( SETUP ) ${R_arrow}"
    8895
    8996  # Define a few model dependant variables
     
    9198    TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
    9299  else
    93     TARGET="pc-linux-gnu";    LOADER="ld-linux.so.2"
     100    TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
    94101  fi
    95102
     
    152159EOF
    153160) >> $MKFILE.tmp
    154 
     161  chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
    155162}
    156163
     
    161168  local this_script
    162169
    163   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
     170  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5     ( LUSER ) ${R_arrow}"
    164171
    165172  for file in chapter05/* ; do
     
    206213    if [[ ${name} = "embryo-toolchain" ]] || \
    207214       [[ ${name} = "cocoon-toolchain" ]]; then
    208        wrt_target "$this_script" "$PREV"
     215       LUSER_wrt_target "$this_script" "$PREV"
    209216         process_toolchain "${this_script}" "${file}"
    210217       wrt_touch
     
    213220    fi
    214221    #
    215     wrt_target "$this_script" "$PREV"
     222    LUSER_wrt_target "$this_script" "$PREV"
    216223    # Find the version of the command files, if it corresponds with the building of
    217224    # a specific package
     
    220227    if [ "$pkg_tarball" != "" ] ; then
    221228      # Insert instructions for unpacking the package and to set the PKGDIR variable.
    222       wrt_unpack "$pkg_tarball"
     229      LUSER_wrt_unpack "$pkg_tarball"
    223230      # If using optimizations, write the instructions
    224231      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     
    226233    # Insert date and disk usage at the top of the log file, the script run
    227234    # and date and disk usage again at the bottom of the log file.
    228     wrt_RunAsUser "$this_script" "${file}"
     235    LUSER_wrt_RunAsUser "${file}"
    229236
    230237    # Remove the build directory(ies) except if the package build fails
    231238    # (so we can review config.cache, config.log, etc.)
    232239    if [ "$pkg_tarball" != "" ] ; then
    233        wrt_remove_build_dirs "$name"
     240      LUSER_RemoveBuildDirs "$name"
    234241    fi
    235242
     
    276283  fi
    277284
    278   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
     285  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N     ( CHROOT ) ${R_arrow}"
    279286
    280287  for file in chapter06$N/* ; do
     
    325332    # as a dependency. Also call the echo_message function.
    326333    if [[ ${name} = "butterfly-toolchain" ]]; then
    327        wrt_target "${this_script}${N}" "$PREV"
     334       CHROOT_wrt_target "${this_script}${N}" "$PREV"
    328335         process_toolchain "${this_script}" "${file}"
    329336       wrt_touch
     
    332339    fi
    333340
    334     wrt_target "${this_script}${N}" "$PREV"
     341    CHROOT_wrt_target "${this_script}${N}" "$PREV"
    335342
    336343    # If $pkg_tarball isn't empty, we've got a package...
    337344    # Insert instructions for unpacking the package and changing directories
    338345    if [ "$pkg_tarball" != "" ] ; then
    339       wrt_unpack2 "$pkg_tarball"
     346      CHROOT_Unpack "$pkg_tarball"
    340347      # If the testsuites must be run, initialize the log file
    341348      # butterfly-toolchain tests are enabled in 'process_tookchain' function
    342349      case $name in
    343         glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
     350        glibc ) [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
    344351          ;;
    345             * ) [[ "$TEST" > "1" ]] && wrt_test_log2 "${this_script}"
     352            * ) [[ "$TEST" > "1" ]]  && CHROOT_wrt_test_log "${this_script}"
    346353          ;;
    347354      esac
     
    356363        ;;
    357364      *)   # The rest of Chapter06
    358         wrt_run_as_chroot1 "${this_script}" "${file}"
     365        CHROOT_wrt_RunAsRoot "${file}"
    359366       ;;
    360367    esac
     
    362369    # Remove the build directory(ies) except if the package build fails.
    363370    if [ "$pkg_tarball" != "" ] ; then
    364       wrt_remove_build_dirs "$name"
     371      CHROOT_wrt_RemoveBuildDirs "$name"
    365372    fi
    366373    #
     
    386393  local this_script
    387394
    388   echo  "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
     395  echo  "${tab_}${GREEN}Processing... ${L_arrow}Chapter7     ( BOOT ) ${R_arrow}"
    389396  for file in chapter07/*; do
    390397    # Keep the script file name
     
    399406      *grub)    continue  ;;
    400407      *console) continue  ;; # Use the file generated by lfs-bootscripts
    401 
    402       *kernel)
    403           # If no .config file is supplied, the kernel build is skipped
    404         [[ -z $CONFIG ]] && continue
    405         cp $CONFIG $BUILDDIR/sources/kernel-config
    406          ;;
     408      *fstab)   [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab
     409        ;;
     410      *kernel)  # If no .config file is supplied, the kernel build is skipped
     411                [[ -z $CONFIG ]] && continue
     412                cp $CONFIG $BUILDDIR/sources/kernel-config
     413        ;;
    407414    esac
    408415
     
    417424    # Drop in the name of the target on a new line, and the previous target
    418425    # as a dependency. Also call the echo_message function.
    419     wrt_target "$this_script" "$PREV"
     426    CHROOT_wrt_target "$this_script" "$PREV"
    420427
    421428    case "${this_script}" in
    422429      *bootscripts*)
    423         wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
     430        CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts")
    424431        blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
    425432        echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
     
    430437      *fstab*) # Check if we have a real /etc/fstab file
    431438        if [[ -n "$FSTAB" ]] ; then
    432           wrt_copy_fstab "$this_script"
    433         else  # Initialize the log and run the script
    434           wrt_run_as_chroot2 "${this_script}" "${file}"
     439           CHROOT_wrt_CopyFstab
     440        else
     441           CHROOT_wrt_RunAsRoot "$file"
    435442        fi
    436443        ;;
    437444      *)  # All other scripts
    438         wrt_run_as_chroot2 "${this_script}" "${file}"
     445        CHROOT_wrt_RunAsRoot "${file}"
    439446        ;;
    440447    esac
     
    445452(
    446453cat << EOF
    447         @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
    448         rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
     454        @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
     455        rm -r \$(SRC)/\$\$ROOT
    449456        @rm -r \`cat sources-dir\` && \\
    450457        rm sources-dir
     
    546553(
    547554  cat << EOF
     555
     556all:    mk_SETUP mk_LUSER mk_CHROOT mk_BOOT
     557        @\$(call echo_finished,$VERSION)
     558
     559
     560mk_SETUP:
     561        @\$(call echo_SU_request)
     562        @sudo make SETUP
     563        @touch \$@
     564       
     565mk_LUSER: mk_SETUP
     566        @\$(call echo_SULUSER_request)
     567        @( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" )
     568        @touch \$@
     569
     570mk_CHROOT: mk_LUSER 057-changingowner 059-kernfs
     571        @mkdir \$(MOUNT_PT)/bin && \
     572        cd \$(MOUNT_PT)/bin && \
     573        ln -sf /tools/bin/bash bash; ln -sf bash sh
     574        @sed -e 's|^ln -sv|ln -svf|' -i \$(CMDSDIR)/chapter06/064-createfiles
     575        @\$(call echo_CHROOT_request)
     576        @( sudo \$(CHROOT1) "env && cd \$(SCRIPT_ROOT) && make CHROOT")
     577        @touch \$@
     578
     579mk_BOOT: mk_CHROOT
     580        @\$(call echo_CHROOT_request)
     581        @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT")
     582        @touch \$@
     583       
     584
     585SETUP:  $chapter3
     586
     587LUSER:  $chapter5
     588
     589CHROOT: $chapter6
     590
     591BOOT:   $chapter7
     592
     593
     594
     595 
    548596all:  chapter3 chapter5 chapter6 chapter7 do-housekeeping
    549597        @\$(call echo_finished,$VERSION)
Note: See TracChangeset for help on using the changeset viewer.