Nimbin[12]?Mirrors & Forks / jhalfs / commits / 645ec47

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Reorganize advanced options in Config.in

Pierre Labastie · 2023-11-15 17:04 · 645ec4780e533fec30b56ae6e1fca4f0ba88207d

- Put parallelization menu first
- Fix the logic for variable definitions in this menu
- change jhalfs to reflect the separation of optimization and
  parallelization
- validate new variables
- remove MAKEFLAGS from the validation of optimize variables
- also remove the black list, which has not been used in years.
 Config.in                            | 170 +++++++++++++++++------------------
 common/libs/func_validate_configs.sh |   6 +-
 jhalfs                               |   9 +-
 optimize/optimize_functions          |   5 +-
 4 files changed, 94 insertions(+), 96 deletions(-)

diff --git a/Config.in b/Config.in
index 8bc7161..a0bfc0f 100644
--- a/Config.in
+++ b/Config.in
@@ -771,51 +771,56 @@ endmenu        #--- System configuration
 menu "Advanced Features"
 depends on !BOOK_BLFS
 
-    config    REPORT
-        bool "Create SBU and disk usage report"
+    #--- Parallelism
+    menu "Parallelism settings"
+    if HAVE_NPROC
+        config ALL_CORES
+        bool "Use all cores as in new books (say n for old books)"
         default y
-
-    config    SAVE_CH5
-        bool "Save Chapter 5 work"
-        depends on BOOK_LFS || BOOK_LFS_SYSD
-        default n
-        help
-            Save the state of jhalfs at the end of chapter 5:
-            
-            if you tick this item, the whole $LFS directory is
-            saved when chapter 5 is finished. It'll be in an xz
-            compressed tarball in the $LFS/jhalfs directory
-
-    #--- ICA
-    config    COMPARE
-        bool "Run comparison analysis on final stage"
-        default n
         help
-            #-- Should an iterative comparison analysis be performed?
-            #
-            #   Unless you are familiar with ICA, do not
-            #   select this option
-            #
-            #  ICA is an analysis tool for comparing one
-            #  build to the next. Builds mays differ from one iteration
-            #  to another due to the build order and this tool try
-            #  to ferret out those differences by examining the stored
-            #  build logs and binary files.
-            #
-            #  The scripts are well commented and can be found in ./extras/*
-            #
+              Use book instructions as written for parallelism since version
+              r12.0-87 included. If you answer no, then jhalfs will fall back
+              to a static number of cores, defined below. If you answer y, and
+              your system supports it, you'll be asked for a cpu set to use.
+                 There is no detection of book version. If the book version
+              is lower than r12.0-87, say no!
 
-    config    ITERATIONS
-        int    "Number of test runs (2,3,4,5)"    if COMPARE
-        depends on COMPARE
-        range    2 5
-        default    3
+        if ALL_CORES && HAVE_CGROUP
+            config CPUSET
+            string "set of cpus to use, or 'all' for all cpus"
+            default "all"
+            help
+                 See "List format" in cpuset(7). Choosing cpus depend
+                 on the topology of your processors. Sometimes two
+                 hyperthreads on the same core are numbered consecutively.
+                 For example for using all cores and no hyperthreading on
+                 a Haswell, use "0,2,4,6". Other brands may have a different
+                 topology, and may require e.g. "0-3" to use the first 4 cores.
+                 If not sure, keep the default.
+        endif
 
-    config    RUN_ICA
+    endif # HAVE_NPROC
+    if !HAVE_NPROC
+        config ALL_CORES
         bool
-        default y if COMPARE
+        default n
+    endif
 
-    #--- End ICA
+    config    N_PARALLEL
+        int "Number of parallel `make' jobs"
+        depends on !ALL_CORES
+        default 1
+        help
+            #-- The usual recommandation is (number of CPU cores)+1
+            #   Do not set for meaningful SBU calculations.
+
+    config    REALSBU
+        bool    "Build Binutils pass1 without parallelism (Real SBU)"
+        default    n
+        help
+           #-- Use -j1 in make invokation for Binutils pass1 to
+           #   get a valid SBU value.
+    endmenu # parallelism
 
     #--- Optimizations
     config    CONFIG_OPTIMIZE
@@ -854,61 +859,52 @@ depends on !BOOK_BLFS
         default    "2"    if OPT_2
 
     #--- End Optimizations
-    #--- Parallelism
-    menu "Parallelism settings"
-    if HAVE_NPROC
-        config ALL_CORES
-        bool "Use all cores as in the book"
-        default y
-        help
-              Use book instructions as written for parallelism. If you
-              answer no, then jhalfs will fall back to a static number of
-              cores, defined below. If you answer y, and your system
-              supports it, you'll be asked for a cpu set to use.
 
-        if HAVE_CGROUP
-            config CPUSET
-            string "set of cpus to use, or 'all' for all cpus"
-            default "all"
-            help
-                 See "List format" in cpuset(7). Choosing cpus depend
-                 on the topology of your processors. Sometimes two
-                 hyperthreads on the same core are numbered consecutively.
-                 For example for using all cores and no hyperthreading on
-                 a Haswell, use "0,2,4,6". Other brands may have a different
-                 topology, and may require e.g. "0-3" to use the first 4 cores.
-                 If not sure, keep the default.
-        endif
-        if !HAVE_CGROUP
-            config CPUSET
-            string
-            default "all"
-        endif
+    config    REPORT
+        bool "Create SBU and disk usage report"
+        default y
 
-    endif # HAVE_NPROC
-    if !HAVE_NPROC
-        config ALL_CORES
-        bool
+    config    SAVE_CH5
+        bool "Save Chapter 5 work"
+        depends on BOOK_LFS || BOOK_LFS_SYSD
         default n
-    endif
-
-    config    N_PARALLEL
-        int "Number of parallel `make' jobs"
-        depends on !ALL_CORES
-        default 1
         help
-            #-- The usual recommandation is (number of CPU cores)+1
-            #   Do not set for meaningful SBU calculations.
+            Save the state of jhalfs at the end of chapter 5:
+            
+            if you tick this item, the whole $LFS directory is
+            saved when chapter 5 is finished. It'll be in an xz
+            compressed tarball in the $LFS/jhalfs directory
 
-    config    REALSBU
-        bool    "Build Binutls pass1 without parallelism (Real SBU)"
-        depends on ALL_CORES != 1
-        default    n
+    #--- ICA
+    config    COMPARE
+        bool "Run comparison analysis on final stage"
+        default n
         help
-           #-- Use -j1 in make invokation for Binutils pass1 to
-           #   get a valid SBU value.
-    endmenu # parallelism
+            #-- Should an iterative comparison analysis be performed?
+            #
+            #   Unless you are familiar with ICA, do not
+            #   select this option
+            #
+            #  ICA is an analysis tool for comparing one
+            #  build to the next. Builds mays differ from one iteration
+            #  to another due to the build order and this tool try
+            #  to ferret out those differences by examining the stored
+            #  build logs and binary files.
+            #
+            #  The scripts are well commented and can be found in ./extras/*
+            #
+
+    config    ITERATIONS
+        int    "Number of test runs (2,3,4,5)"    if COMPARE
+        depends on COMPARE
+        range    2 5
+        default    3
 
+    config    RUN_ICA
+        bool
+        default y if COMPARE
+
+    #--- End ICA
 
     #-- Internal Settings
     menu "Internal Settings (WARNING: for jhalfs developers only)"
diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh
index ec21656..34d07ec 100644
--- a/common/libs/func_validate_configs.sh
+++ b/common/libs/func_validate_configs.sh
@@ -35,7 +35,7 @@ inline_doc
   local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT KEYMAP LOCAL LOG_LEVEL"
 
   # Full list of books settings
-  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build $LFS_system  $ADVANCED_chroot N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common"
+  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build $LFS_system  $ADVANCED_chroot ALL_CORES CPUSET N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common"
 #  local -r  blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
 
   # Additional variables
@@ -133,8 +133,8 @@ inline_doc
       RETRYSRCDOWNLOAD) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
       RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
       DOWNLOADTIMEOUT)  [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      N_PARALLEL)       [[ "$OPTIMIZE" -gt "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      REALSBU)          [[ "$OPTIMIZE" = "2" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      CPUSET)           [[ "$HAVE_CGROUP" = "y" ]] && [[ "$ALL_CORES" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      N_PARALLEL)       [[ "$ALL_CORES" = "n" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
 
       # Envars that requires some validation
       LUSER)      echo -e "`eval echo $PARAM_VALS`"
diff --git a/jhalfs b/jhalfs
index 2166769..fe2c30c 100755
--- a/jhalfs
+++ b/jhalfs
@@ -175,6 +175,7 @@ SET_MISC=${SET_MISC:=n}
 SET_BLOWFISH=${SET_BLOWFISH:=n}
 UNICODE=${UNICODE:=n}
 LOCAL=${LOCAL:=n}
+ALL_CORES=${ALL_CORES:=n}
 REALSBU=${REALSBU:=n}
 SAVE_CH5=${SAVE_CH5:=n}
 
@@ -287,12 +288,14 @@ if [[ "$OPTIMIZE" != "0" ]]; then
   #
   # optimize configurations
   load_file optimize/opt_config 'Loading optimization config'
-  # The number of parallel jobs is taken from configuration now
-  # shellcheck disable=SC2034
-  JH_MAKEFLAGS="-j${N_PARALLEL}"
   # Validate optimize settings, if required
   validate_opt_settings
 fi
+# Parallelization is outside optimization, because it is now in the book
+if [[ "$ALL_CORES" = "n" ]]; then
+  # shellcheck disable=SC2034
+  JH_MAKEFLAGS="-j${N_PARALLEL}"
+fi
 #
 
 if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
diff --git a/optimize/optimize_functions b/optimize/optimize_functions
index 26d5043..1a73cd3 100644
--- a/optimize/optimize_functions
+++ b/optimize/optimize_functions
@@ -16,9 +16,8 @@ validate_opt_settings() {          # Show optimize setting and wait user agreeme
   echo -e "expected, please rebuild without optimizations before"
   echo -e "asking for support.${OFF}\n"
 
-  echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}"
-  [ -n "$JH_MAKEFLAGS" ] && \
-  echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
+#  [ -n "$JH_MAKEFLAGS" ] && \
+#  echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
 
   echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"