M.Canales.es wrote:
> The optimize code developed on the experimental branch looks almost complete 
> and stable.

Looks good; the confirmation page was a really nice addition.

> At least I can't find bugs in the generated Makefile using several 
> combinations of configuration options.

Me neither; looks like it should work fine.

> I would to merge it to trunk in 2-3 days from now if there is no objetions or 
> some propossal about enchancements or additional features.


I do have a few nitpicks and code cleanups for you to look at though
(attached patch).

Changes:
  - DEF_OPT_LVL to DEV_OPT_MODE for consistency
    - changed all over the place
  - Zlib to defOpt_fPIC
    - With the nice confirmation page, "zlib   Zlib" isn't descriptive
    - Showing the inheritance in the override readout is moreso
    - Plus, if you have 5-10 packages that all need "-fPIC",
      it wouldn't make sense to have 5-10 identical files for each
      package or have such as "fooPkg  Zlib" in the override file..
  - Collected the if structures and such in defOpt_fPIC into a loop/case
    - Should serve as a good template to make other such tweaks later
  - With the time jhalfs is going to save me now, I can make my own
    damn coffee. :)

That's all I can think of to do with the code for now.  Adding new
variables can be done easily in the config without any extra code and I
can't think of any other useful features at the moment.

Regards,
Jeremy.
diff -Naur jhalfs-2666/optimize/opt_config jhalfs-2666-opt/optimize/opt_config
--- jhalfs-2666/optimize/opt_config     2006-05-07 13:51:54.000000000 -0700
+++ jhalfs-2666-opt/optimize/opt_config 2006-05-07 13:17:09.000000000 -0700
@@ -13,11 +13,11 @@
 MAKEFLAGS="-j3"
 
 #--- Default optimization mode
-#    This level is overridden by definitions in opt_override;
+#    This mode is overridden by definitions in opt_override;
 #    in this way, packages can be tuned independently.  For example,
 #    if you have trouble building a package in mode defOpt, add
 #    the package to opt_override with a different mode.
-DEF_OPT_LVL=defOpt
+DEF_OPT_MODE=defOpt
 
 
 #--- Active optimization variables
diff -Naur jhalfs-2666/optimize/opt_config.d/defOpt_fPIC 
jhalfs-2666-opt/optimize/opt_config.d/defOpt_fPIC
--- jhalfs-2666/optimize/opt_config.d/defOpt_fPIC       1969-12-31 
16:00:00.000000000 -0800
+++ jhalfs-2666-opt/optimize/opt_config.d/defOpt_fPIC   2006-05-07 
14:55:15.000000000 -0700
@@ -0,0 +1,28 @@
+#####
+#
+# 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 DEF_OPT_MODE
+source optimize/opt_config.d/${DEF_OPT_MODE}
+
+# Append " -fPIC" to default *C{,XX}FLAGS and retain other defaults
+for OPT_VAR in $ACTIVE_OPT_VARS ; do
+  case $OPT_VAR in
+    CFLAGS | CXXFLAGS | OTHER_CFLAGS | OTHER_CXXFLAGS)
+      if [[ "$(eval "echo \$${OPT_VAR}_${DEF_OPT_MODE}")" != "unset" ]] ; then
+        eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}\" -fPIC\"
+      else
+        eval ${OPT_VAR}_defOpt_fPIC="unset"
+      fi
+      ;;
+    *)
+      eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}
+      ;;
+  esac
+done
diff -Naur jhalfs-2666/optimize/opt_config.d/noOpt 
jhalfs-2666-opt/optimize/opt_config.d/noOpt
--- jhalfs-2666/optimize/opt_config.d/noOpt     2006-05-07 13:51:54.000000000 
-0700
+++ jhalfs-2666-opt/optimize/opt_config.d/noOpt 2006-05-07 13:56:58.000000000 
-0700
@@ -10,7 +10,7 @@
 #          of packages known to have build or runtime failure.
 #
 #          Also, if you what to use MAKEFLAGS but no build
-#          optimizations, set this mode in DEF_OPT_LVL
+#          optimizations, set this mode in DEF_OPT_MODE
 #
 # Usage: - Apply optimization string to each variable
 #        - "unset" will cause the variable to be not set
diff -Naur jhalfs-2666/optimize/opt_config.d/noSymbols 
jhalfs-2666-opt/optimize/opt_config.d/noSymbols
--- jhalfs-2666/optimize/opt_config.d/noSymbols 2006-05-07 13:51:54.000000000 
-0700
+++ jhalfs-2666-opt/optimize/opt_config.d/noSymbols     2006-05-07 
13:57:32.000000000 -0700
@@ -11,8 +11,8 @@
 #
 #####
 #
-# NOTE: If using this mode in DEF_OPT_LVL (alone or combined with
-# other mode) please set STRIP=0 in common/config
+# NOTE: If using this mode in DEF_OPT_MODE (alone or combined with
+# other modes) please set STRIP=0 in common/config
 #
 CFLAGS_noSymbols="-s"
 CXXFLAGS_noSymbols=$CFLAGS_noSymbols
diff -Naur jhalfs-2666/optimize/opt_config.d/Zlib 
jhalfs-2666-opt/optimize/opt_config.d/Zlib
--- jhalfs-2666/optimize/opt_config.d/Zlib      2006-05-07 13:51:54.000000000 
-0700
+++ jhalfs-2666-opt/optimize/opt_config.d/Zlib  1969-12-31 16:00:00.000000000 
-0800
@@ -1,56 +0,0 @@
-#
-#$Id: Zlib 2651 2006-05-06 14:17:16Z manuel $
-#
-#####
-#
-# MODE Zlib 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 DEF_OPT_LVL
-source optimize/opt_config.d/$DEF_OPT_LVL
-
-eval CFLAGS_Zlib_base=\$CFLAGS_${DEF_OPT_LVL}
-eval CXXFLAGS_Zlib_base=\$CXXFLAGS_${DEF_OPT_LVL}
-eval LDFLAGS_Zlib_base=\$LDFLAGS_${DEF_OPT_LVL}
-
-eval OTHER_CFLAGS_Zlib_base=\$CFLAGS_${DEF_OPT_LVL}
-eval OTHER_CXXFLAGS_Zlib_base=\$OTHER_CXXFLAGS_${DEF_OPT_LVL}
-eval OTHER_LDFLAGS_Zlib_base=\$OTHER_LDFLAGS_${DEF_OPT_LVL}
-
-# Set the actual values for Zlib mode
-if [[ "$CFLAGS_Zlib_base" != "unset" ]]; then
-  CFLAGS_Zlib=$CFLAGS_Zlib_base" -fPIC"
-else
-  CFLAGS_Zlib="unset"
-fi
-if [[ "$CXXFLAGS_Zlib_base" != "unset" ]]; then
-  CXXFLAGS_Zlib=$CXXFLAGS_Zlib_base" -fPIC"
-else
-  CXXFLAGS_Zlib="unset"
-fi
-if [[ "$LDFLAGS_Zlib_base" != "unset" ]]; then
-  LDFLAGS_Zlib=$LDFLAGS_Zlib_base
-else
-  LDFLAGS_Zlib="unset"
-fi
-
-if [[ "$OTHER_CFLAGS_Zlib_base" != "unset" ]]; then
-  OTHER_CFLAGS_Zlib=$OTHER_CFLAGS_Zlib_base" -fPIC"
-else
-  OTHER_CFLAGS_Zlib="unset"
-fi
-if [[ "$OTHER_CXXFLAGS_Zlib_base" != "unset" ]]; then
-  OTHER_CXXFLAGS_Zlib=$OTHER_CXXFLAGS_Zlib_base" -fPIC"
-else
-  OTHER_CXXFLAGS_Zlib="unset"
-fi
-if [[ "$OTHER_LDFLAGS_Zlib_base" != "unset" ]]; then
-  OTHER_LDFLAGS_Zlib=$OTHER_LDFLAGS_Zlib_base
-else
-  OTHER_LDFLAGS_Zlib="unset"
-fi
diff -Naur jhalfs-2666/optimize/optimize_functions 
jhalfs-2666-opt/optimize/optimize_functions
--- jhalfs-2666/optimize/optimize_functions     2006-05-07 13:51:54.000000000 
-0700
+++ jhalfs-2666-opt/optimize/optimize_functions 2006-05-07 14:05:33.000000000 
-0700
@@ -11,14 +11,14 @@
   local OPT_VAR optVal
 
   echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}\n"
-  echo -e "DEF_OPT_LVL: ${L_arrow}${BOLD}${DEF_OPT_LVL}${OFF}${R_arrow}\n"
+  echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
 
   for OPT_VAR in $ACTIVE_OPT_VARS ; do
-    eval optVal=\$${OPT_VAR}_${DEF_OPT_LVL}
+    eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
     echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
   done
 
-  echo -e "\nOverrided packages:"
+  echo -e "\nOverridden packages:"
   cat optimize/opt_override
   echo "${nl_}${SD_BORDER}${nl_}"
 
@@ -35,15 +35,15 @@
 wrt_optimize() {                   # Apply pkg specific opt's to build
 #----------------------------------#
   local pkg=$1
-  local optLvl optVal OPT_VAR
+  local optMode optVal OPT_VAR
 
-  optLvl=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
-  if [[ "$optLvl" = "" ]] ; then
-    optLvl=$DEF_OPT_LVL;
+  optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
+  if [[ "$optMode" = "" ]] ; then
+    optMode=$DEF_OPT_MODE;
   fi
 
   for OPT_VAR in $ACTIVE_OPT_VARS ; do
-    eval optVal=\$${OPT_VAR}_$optLvl
+    eval optVal=\$${OPT_VAR}_$optMode
 
     if [[ "$optVal" != "unset" ]]; then
 (
diff -Naur jhalfs-2666/optimize/opt_override 
jhalfs-2666-opt/optimize/opt_override
--- jhalfs-2666/optimize/opt_override   2006-05-07 13:51:54.000000000 -0700
+++ jhalfs-2666-opt/optimize/opt_override       2006-05-07 13:50:18.000000000 
-0700
@@ -2,4 +2,4 @@
 gcc            noOpt
 glibc          noOpt
 grub           noOpt
-zlib           Zlib
+zlib           defOpt_fPIC
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to