r2677 - in jhalfs/trunk: . CLFS HLFS LFS common optimize optimize/opt_config.d

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Thu May 11 13:21:16 PDT 2006


Author: manuel
Date: 2006-05-11 14:21:14 -0600 (Thu, 11 May 2006)
New Revision: 2677

Added:
   jhalfs/trunk/optimize/
Modified:
   jhalfs/trunk/CLFS/master.sh
   jhalfs/trunk/HLFS/master.sh
   jhalfs/trunk/LFS/master.sh
   jhalfs/trunk/common/common-functions
   jhalfs/trunk/common/config
   jhalfs/trunk/common/func_validate_configs.sh
   jhalfs/trunk/master.sh
   jhalfs/trunk/optimize/opt_config
   jhalfs/trunk/optimize/opt_config.d/O3pipe
   jhalfs/trunk/optimize/opt_config.d/O3pipe_march
   jhalfs/trunk/optimize/opt_config.d/defOpt_fPIC
   jhalfs/trunk/optimize/opt_config.d/noOpt
   jhalfs/trunk/optimize/opt_config.d/noSymbols
   jhalfs/trunk/optimize/opt_override
   jhalfs/trunk/optimize/optimize_functions
Log:
Merged optimize code from experimental branch.

Modified: jhalfs/trunk/CLFS/master.sh
===================================================================
--- jhalfs/trunk/CLFS/master.sh	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/CLFS/master.sh	2006-05-11 20:21:14 UTC (rev 2677)
@@ -184,6 +184,7 @@
     # Insert instructions for unpacking the package and to set the PKGDIR variable.
     #
     [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     wrt_run_as_su "${this_script}" "${file}"
     #
@@ -255,6 +256,7 @@
     # Insert instructions for unpacking the package and changing directories
     #
     [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     # Select a script execution method
     case $this_script in
@@ -325,6 +327,7 @@
         *util-linux)    wrt_unpack  "$name-$vrs.tar.*"  ;;
         *)              wrt_unpack2 "$name-$vrs.tar.*"  ;;
       esac
+      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     #
     # Select a script execution method
@@ -385,6 +388,7 @@
       tcl)    wrt_unpack2 "$name$vrs-src.tar.*" ;;
       *)      wrt_unpack2 "$name-$vrs.tar.*"    ;;
     esac
+    [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
     #
@@ -439,6 +443,7 @@
       tcl)    wrt_unpack3 "$name$vrs-src.tar.*" ;;
       *)      wrt_unpack3 "$name-$vrs.tar.*"    ;;
     esac
+    [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     wrt_run_as_root2 "${this_script}" "${file}"
     #
@@ -537,6 +542,7 @@
     if [ "$vrs" != "" ] ; then
       FILE="$name-$vrs.tar.*"
       wrt_unpack2 "$FILE"
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
@@ -639,6 +645,7 @@
     if [ "$vrs" != "" ] ; then
       FILE="$name-$vrs.tar.*"
       wrt_unpack3 "$FILE"
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
     #
     wrt_run_as_root2 "${this_script}" "${file}"

Modified: jhalfs/trunk/HLFS/master.sh
===================================================================
--- jhalfs/trunk/HLFS/master.sh	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/HLFS/master.sh	2006-05-11 20:21:14 UTC (rev 2677)
@@ -140,9 +140,10 @@
         gcc)    FILE="gcc-core-$vrs.tar.*"  ;;
         *)      FILE="$name-$vrs.tar.*"     ;;
       esac
-     # Insert instructions for unpacking the package and to set the PKGDIR variable.
-     wrt_unpack "$FILE"
-  fi
+      # Insert instructions for unpacking the package and to set the PKGDIR variable.
+      wrt_unpack "$FILE"
+      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    fi
 
     case $this_script in
       *binutils* )  # Dump the path to sources directory for later removal
@@ -308,6 +309,7 @@
       esac
       wrt_unpack2 "$FILE"
       wrt_target_vars
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
 
     case $this_script in

Modified: jhalfs/trunk/LFS/master.sh
===================================================================
--- jhalfs/trunk/LFS/master.sh	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/LFS/master.sh	2006-05-11 20:21:14 UTC (rev 2677)
@@ -112,6 +112,7 @@
 
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
       wrt_unpack "$FILE"
+      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
 
     # Insert date and disk usage at the top of the log file, the script run
@@ -215,6 +216,7 @@
     if [ "$vrs" != "" ] ; then
       FILE="$name-$vrs.tar.*"
       wrt_unpack2 "$FILE"
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
 
     # In the mount of kernel filesystems we need to set LFS

Modified: jhalfs/trunk/common/common-functions
===================================================================
--- jhalfs/trunk/common/common-functions	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/common/common-functions	2006-05-11 20:21:14 UTC (rev 2677)
@@ -65,6 +65,13 @@
         in the configuration file has the proper packages and patches for the
         book version being processed.
 
+${BOLD}  -O, --optimize${OFF}
+        Optimize [0-2]
+          0 = no optimization
+          1 = optimize chapter06 only
+          2 = optimize both chapter05 and chapter06
+        Edit common/opt_config{,.d/*} and common/opt_override as desired.
+
 ${BOLD}  -T, --testsuites N ${OFF}
         Run test suites  [0-3]
           0 = none
@@ -267,7 +274,6 @@
 }
 
 
-
 #----------------------------------#
 wrt_target_vars() {                # Target vars for hlfs (cross-build method)
 #----------------------------------#

Modified: jhalfs/trunk/common/config
===================================================================
--- jhalfs/trunk/common/config	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/common/config	2006-05-11 20:21:14 UTC (rev 2677)
@@ -34,6 +34,14 @@
 #    In BLFS the Makefile can't be run automatically
 RUNMAKE=0
 
+#--- Optimize the build  [0-2]
+#  0 = no optimization
+#  1 = optimize final system only
+#  2 = optimize both temporary tools and final system
+#
+# Optimization values are set in optimize/* files
+OPTIMIZE=0
+
 #--- Run test suites  [0-3]
 #  0 = none
 #  1 = only chapter06 Glibc, GCC and Binutils testsuites

Modified: jhalfs/trunk/common/func_validate_configs.sh
===================================================================
--- jhalfs/trunk/common/func_validate_configs.sh	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/common/func_validate_configs.sh	2006-05-11 20:21:14 UTC (rev 2677)
@@ -84,10 +84,10 @@
 inline_doc
 
   # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
-  local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG         DEPEND                TEST"
-  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
-  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
+  local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG         DEPEND                TEST OPTIMIZE"
+  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
+  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
+  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
   local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
@@ -205,6 +205,7 @@
       RUN_FARCE)  [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;;
       ITERATIONS) [[ "$COMPARE" = "1" ]] && validate_against_str "x2x x3x x4x x5x" ;;
       TEST)       validate_against_str "x0x x1x x2x x3x" ;;
+      OPTIMIZE)   validate_against_str "x0x x1x x2x" ;;
       STRIP)      validate_against_str "x0x x1x" ;;
       VIMLANG)    validate_against_str "x0x x1x" ;;
       DEPEND)     validate_against_str "x0x x1x x2x" ;;

Modified: jhalfs/trunk/master.sh
===================================================================
--- jhalfs/trunk/master.sh	2006-05-11 19:15:34 UTC (rev 2676)
+++ jhalfs/trunk/master.sh	2006-05-11 20:21:14 UTC (rev 2677)
@@ -147,6 +147,21 @@
 
     --help | -h )  usage | more && exit  ;;
 
+    --optimize | -O )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      case $1 in
+        0 | 1 | 2 )
+          OPTIMIZE=$1
+          ;;
+        * )
+          echo -e "\n$1 isn't a valid optimize level value."
+          echo -e "You must use 0, 1, or 2.\n"
+          exit 1
+          ;;
+      esac
+      ;;
+
     --testsuites | -T )
       test $# = 1 && eval "$exit_missing_arg"
       shift
@@ -448,7 +463,27 @@
   [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
   [[ $VERBOSITY > 0 ]] && echo "OK"
 fi
+#
+# optimize module
+if [[ "$OPTIMIZE" != "0" ]]; then
+  [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
+  source optimize/optimize_functions
+  [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
+  [[ $VERBOSITY > 0 ]] && echo "OK"
+fi
+#
+# optimize configurations
+if [[ "$OPTIMIZE" != "0" ]]; then
+  [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
+  source optimize/opt_config
+  [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
+  [[ $VERBOSITY > 0 ]] && echo "OK"
+fi
+#
 
+# Validate optimize settings, if required
+[[ "$OPTIMIZE" != "0" ]] && validate_opt_settings
+
 # Prevents setting "-d /" by mistake.
 
 if [ $BUILDDIR = / ] ; then
@@ -472,6 +507,7 @@
 
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp $COMMON_DIR/makefile-functions $JHALFSDIR/
+  [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
   if [[ "$COMPARE" != "0" ]] ; then
     mkdir -p $JHALFSDIR/extras
     cp extras/* $JHALFSDIR/extras

Copied: jhalfs/trunk/optimize (from rev 2676, jhalfs/branches/experimental/optimize)




More information about the alfs-log mailing list