r2641 - in jhalfs/branches/experimental: . LFS common common/opt_config.d

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Fri May 5 10:41:57 PDT 2006


Author: manuel
Date: 2006-05-05 11:41:56 -0600 (Fri, 05 May 2006)
New Revision: 2641

Added:
   jhalfs/branches/experimental/common/opt_config.d/
   jhalfs/branches/experimental/common/opt_config.d/defOpt
   jhalfs/branches/experimental/common/opt_config.d/defOpt_fPIC
   jhalfs/branches/experimental/common/opt_config.d/noOpt
   jhalfs/branches/experimental/common/opt_config.d/noSymbols
Modified:
   jhalfs/branches/experimental/LFS/master.sh
   jhalfs/branches/experimental/common/common-functions
   jhalfs/branches/experimental/common/config
   jhalfs/branches/experimental/common/func_validate_configs.sh
   jhalfs/branches/experimental/common/opt_config
   jhalfs/branches/experimental/common/opt_override
   jhalfs/branches/experimental/master.sh
Log:
Applied optimize patch from Jeremy Byron.

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-05-05 17:41:56 UTC (rev 2641)
@@ -112,6 +112,7 @@
 
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
       wrt_unpack "$FILE"
+      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name"
     fi
 
     # Insert date and disk usage at the top of the log file, the script run
@@ -215,7 +216,7 @@
     if [ "$vrs" != "" ] ; then
       FILE="$name-$vrs.tar.*"
       wrt_unpack2 "$FILE"
-      [[ "$OPTIMIZE" = "1" ]] && wrt_optimize "$name"
+      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name"
     fi
 
     # In the mount of kernel filesystems we need to set LFS

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/common/common-functions	2006-05-05 17:41:56 UTC (rev 2641)
@@ -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
@@ -291,13 +298,10 @@
     optLvl=$DEF_OPT_LVL;
   fi
 
-  for OPT_VAR in CFLAGS CXXFLAGS LDFLAGS; do
+  for OPT_VAR in $ACTIVE_OPT_VARS ; do
     eval optVal=\$${OPT_VAR}_$optLvl
 
     if [[ "$optVal" != "unset" ]]; then
-     case $pkg in
-       *zlib* ) [[ "$OPT_VAR" != "LDFLAGS" ]] && optVal="$optVal -fPIC" ;;
-     esac
 (
 cat << EOF
 	@echo "export $OPT_VAR=\"$optVal\"" >> envars

Modified: jhalfs/branches/experimental/common/config
===================================================================
--- jhalfs/branches/experimental/common/config	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/common/config	2006-05-05 17:41:56 UTC (rev 2641)
@@ -34,9 +34,13 @@
 #    In BLFS the Makefile can't be run automatically
 RUNMAKE=0
 
-#--- Optimize the build? 0(no)/1(yes)
+#--- Optimize the build  [0-2]
+#  0 = no optimization
+#  1 = optimize chapter06 only
+#  2 = optimize both chapter05 and chapter06
+#
 # Optimization values are set in opt_config and opt_override
-OPTIMIZE=1
+OPTIMIZE=0
 
 #--- Run test suites  [0-3]
 #  0 = none

Modified: jhalfs/branches/experimental/common/func_validate_configs.sh
===================================================================
--- jhalfs/branches/experimental/common/func_validate_configs.sh	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/common/func_validate_configs.sh	2006-05-05 17:41:56 UTC (rev 2641)
@@ -205,7 +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" ;;
+      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/branches/experimental/common/opt_config
===================================================================
--- jhalfs/branches/experimental/common/opt_config	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/common/opt_config	2006-05-05 17:41:56 UTC (rev 2641)
@@ -3,48 +3,36 @@
 # optimization configuration file
 #
 #####
+#
+#$Id$
+#
 
-#--- Default optimization level
-#    This level is overridden by definitions in common/def_opt_override;
+#--- Default optimization mode
+#    This level is overridden by definitions in common/opt_override;
 #    in this way, packages can be tuned independently.  For example,
-#    if you have trouble building a package at level 3, add it to
-#    common/def_opt_override as an alternate level.
-#
-#    Optimization levels need not be numeric; custom strings
-#    can be defined.
-#      For example: CFLAGS_myLevel="-O3 -pipe"
-#                   cat "fooPkg myLevel" >> common/def_opt_override
-DEF_OPT_LVL=3
+#    if you have trouble building a package in mode defOpt, add
+#    the package to common/opt_override with a different mode.
+DEF_OPT_LVL=defOpt
 
-#--- Optimization level definitions
-#      Usage: - Apply optimization string at any given level
-#             - "unset" will cause the variable to be not set
-#               instead of set to null
-#--- LEVEL 0
-#      WARNING: Do not edit this level unless you know what you are
-#               doing.  By default, this is set to affect packages
-#               which may have problems with optimization.
-CFLAGS_0="unset"
-CXXFLAGS_0=$CFLAGS_0
-LDFLAGS_0="unset"
 
+#--- Active optimization variables
+#    Variables listed here will be set as defined in the appropriate
+#    file in common/opt_config.d/; others will be ignored.
+ACTIVE_OPT_VARS="CFLAGS CXXFLAGS LDFLAGS \
+                 OTHER_CFLAGS OTHER_CXXFLAGS OTHER_LDFLAGS"
 
-#--- LEVEL 1
-CFLAGS_1="-O2 -pipe"
-CXXFLAGS_1=$CFLAGS_1
-LDFLAGS_1=""
-
-#--- LEVEL 2
-CFLAGS_2="-O3 -pipe"
-CXXFLAGS_2=$CFLAGS_2
-LDFLAGS_2=""
-
-#--- LEVEL 3
-CFLAGS_3="-O3 -march=pentium4 -pipe -s"
-CXXFLAGS_3=$CFLAGS_3
-LDFLAGS_3="-s"
-
-#--- LEVEL noOpt_noSymbols
-CFLAGS_noOpt_noSymbols="-s"
-CXXFLAGS_noOpt_noSymbols=$CFLAGS_noOpt_noSymbols
-LDFLAGS_noOpt_noSymbols="-s"
+#--- Load optimization modes
+#    To add modes, create a working template..
+#      cp opt_config.d/defOpt opt_config.d/newMode
+#    ..and edit it as desired.
+#
+#    To inherit another mode and add to it, see opt_config.d/defOpt_fPIC
+#    as an example.  Given opt_config.d/modeA_modeB_modeC, modeB inherits
+#    the optimizations of modeA by sourcing it, and modeC inherits those
+#    of modeB (which includes those of modeA).
+#
+#    Add packages that are to use this mode to opt_override with:
+#      echo 'myPkg  newMode' >> opt_override
+for mode in $COMMON_DIR/opt_config.d/* ; do
+  source $mode
+done

Added: jhalfs/branches/experimental/common/opt_config.d/defOpt
===================================================================
--- jhalfs/branches/experimental/common/opt_config.d/defOpt	                        (rev 0)
+++ jhalfs/branches/experimental/common/opt_config.d/defOpt	2006-05-05 17:41:56 UTC (rev 2641)
@@ -0,0 +1,20 @@
+#
+#$Id$
+#
+#####
+#
+# MODE defOpt configuration
+#
+# Usage: - Apply optimization string to each variable
+#        - "unset" will cause the variable to be not set
+#          instead of just set to null.
+#
+#####
+
+CFLAGS_defOpt="-O3 -pipe -s"
+CXXFLAGS_defOpt=$CFLAGS_defOpt
+LDFLAGS_defOpt="-s"
+
+OTHER_CFLAGS_defOpt=$CFLAGS_defOpt
+OTHER_CXXFLAGS_defOpt=$CXXFLAGS_defOpt
+OTHER_LDFLAGS_defOpt=$LDFLAGS_defOpt


Property changes on: jhalfs/branches/experimental/common/opt_config.d/defOpt
___________________________________________________________________
Name: svn:keywords
   + Author Date Revision Id

Added: jhalfs/branches/experimental/common/opt_config.d/defOpt_fPIC
===================================================================
--- jhalfs/branches/experimental/common/opt_config.d/defOpt_fPIC	                        (rev 0)
+++ jhalfs/branches/experimental/common/opt_config.d/defOpt_fPIC	2006-05-05 17:41:56 UTC (rev 2641)
@@ -0,0 +1,23 @@
+#
+#$Id$
+#
+#####
+#
+# MODE defOpt_fPIC configuration
+#
+# Usage: - Apply optimization string to each variable
+#        - "unset" will cause the variable to be not set
+#          instead of just set to null.
+#
+#####
+
+# Inherit optimizations from defOpt
+source $COMMON_DIR/opt_config.d/defOpt
+
+CFLAGS_defOpt_fPIC=$CFLAGS_defOpt" -fPIC"
+CXXFLAGS_defOpt_fPIC=$CFLAGS_defOpt" -fPIC"
+LDFLAGS_defOpt_fPIC=$LDFLAGS_defOpt
+
+OTHER_CFLAGS_defOpt_fPIC=$CFLAGS_defOpt" -fPIC"
+OTHER_CXXFLAGS_defOpt_fPIC=$CXXFLAGS_defOpt" -fPIC"
+OTHER_LDFLAGS_defOpt_fPIC=$LDFLAGS_defOpt


Property changes on: jhalfs/branches/experimental/common/opt_config.d/defOpt_fPIC
___________________________________________________________________
Name: svn:keywords
   + Author Date Revision Id

Added: jhalfs/branches/experimental/common/opt_config.d/noOpt
===================================================================
--- jhalfs/branches/experimental/common/opt_config.d/noOpt	                        (rev 0)
+++ jhalfs/branches/experimental/common/opt_config.d/noOpt	2006-05-05 17:41:56 UTC (rev 2641)
@@ -0,0 +1,24 @@
+#
+#$Id$
+#
+#####
+#
+# MODE noOpt configuration
+#
+# WARNING: Do not edit this mode unless you know what you are
+#          doing.  By default, this is set to disable optimization
+#          of packages known to have build or runtime failure.
+#
+# Usage: - Apply optimization string to each variable
+#        - "unset" will cause the variable to be not set
+#          instead of being just set to null.
+#
+#####
+
+CFLAGS_noOpt="unset"
+CXXFLAGS_noOpt="unset"
+LDFLAGS_noOpt="unset"
+
+OTHER_CFLAGS_noOpt="unset"
+OTHER_CXXFLAGS_noOpt="unset"
+OTHER_LDFLAGS_noOpt="unset"


Property changes on: jhalfs/branches/experimental/common/opt_config.d/noOpt
___________________________________________________________________
Name: svn:keywords
   + Author Date Revision Id

Added: jhalfs/branches/experimental/common/opt_config.d/noSymbols
===================================================================
--- jhalfs/branches/experimental/common/opt_config.d/noSymbols	                        (rev 0)
+++ jhalfs/branches/experimental/common/opt_config.d/noSymbols	2006-05-05 17:41:56 UTC (rev 2641)
@@ -0,0 +1,20 @@
+#
+#$Id$
+#
+#####
+#
+# MODE noOpt_noSymbols configuration
+#
+# Usage: - Apply optimization string to each variable
+#        - "unset" will cause the variable to be not set
+#          instead of just set to null.
+#
+#####
+
+CFLAGS_noSymbols="-s"
+CXXFLAGS_noSymbols=$CFLAGS_noSymbols
+LDFLAGS_noSymbols="-s"
+
+OTHER_CFLAGS_noSymbols=$CFLAGS_noSymbols
+OTHER_CXXFLAGS_noSymbols=$CXXFLAGS_noSymbols
+OTHER_LDFLAGS_noSymbols=$LDFLAGS_noSymbols


Property changes on: jhalfs/branches/experimental/common/opt_config.d/noSymbols
___________________________________________________________________
Name: svn:keywords
   + Author Date Revision Id

Modified: jhalfs/branches/experimental/common/opt_override
===================================================================
--- jhalfs/branches/experimental/common/opt_override	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/common/opt_override	2006-05-05 17:41:56 UTC (rev 2641)
@@ -1,4 +1,5 @@
-binutils       0
-gcc            0
-glibc          0
-grub           0
+binutils       noOpt
+gcc            noOpt
+glibc          noOpt
+grub           noOpt
+zlib           defOpt_fPIC

Modified: jhalfs/branches/experimental/master.sh
===================================================================
--- jhalfs/branches/experimental/master.sh	2006-05-05 17:28:39 UTC (rev 2640)
+++ jhalfs/branches/experimental/master.sh	2006-05-05 17:41:56 UTC (rev 2641)
@@ -157,6 +157,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
@@ -473,7 +488,7 @@
 
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp $COMMON_DIR/makefile-functions $JHALFSDIR/
-  [[ "$OPTIMIZE" = "1" ]] && cp $COMMON_DIR/opt_override $JHALFSDIR/
+  [[ "$OPTIMIZE" != "0" ]] && cp $COMMON_DIR/opt_override $JHALFSDIR/
   if [[ "$COMPARE" != "0" ]] ; then
     mkdir -p $JHALFSDIR/extras
     cp extras/* $JHALFSDIR/extras




More information about the alfs-log mailing list