cp
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 5 May 2025 14:21:27 +0000 (07:21 -0700)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 5 May 2025 14:21:27 +0000 (07:21 -0700)
env_toolsmith
script_gcc_min-12πŸ–‰/build_all.sh
script_gcc_min-12πŸ–‰/mv_libs_to_gcc.sh [changed mode: 0644->0755]
script_gcc_min-12πŸ–‰/project_requisites.sh

index 7c40a62..2607d95 100644 (file)
@@ -6,6 +6,6 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
 fi
 
 export ROOT=$(dirname "$script_afp")
-export SCRIPT_DIR="$ROOT"/scriptπŸ–‰
+export SCRIPT_DIR="$ROOT"/script_gcc_min-12πŸ–‰
 
 cd "$SCRIPT_DIR"
index dbb890c..df90a0e 100755 (executable)
@@ -4,7 +4,6 @@ set -euo pipefail
 cd "$(dirname "$0")"
 SCRIPT_DIR="$PWD"
 
-echo "loading environment"
 source "$SCRIPT_DIR/environment.sh"
 
 cd "$SCRIPT_DIR"
old mode 100644 (file)
new mode 100755 (executable)
index 76bf171..c6c56ec 100755 (executable)
@@ -1,21 +1,24 @@
 #!/bin/bash
+# project_requisites.sh
+# Checks that all required tools, libraries, and sources are available
+# before proceeding with the GCC build.
+
 set -euo pipefail
 
 source "$(dirname "$0")/environment.sh"
 
 echo "Checking requisites for native standalone GCC build."
 
-if [ ! $(command -v pkg-config) ]; then
-  echo "pkg-config command required for this script"
-  echo "Debian: sudo apt install pkg-config"
-  echo "Fedora: sudo dnf install pkg-config"
+if ! command -v pkg-config >/dev/null; then
+  echo "❌ pkg-config command required for this script"
+  echo "    Debian: sudo apt install pkg-config"
+  echo "    Fedora: sudo dnf install pkg-config"
   exit 1
 fi
 
-
 missing_requisite_list=()
 failed_pkg_config_list=()
-found_reequisite_list=()
+found_requisite_list=()
 
 # --- Required Script Tools (must be usable by this script itself) ---
 script_tools=(
@@ -27,11 +30,11 @@ script_tools=(
 
 echo "Checking for essential script dependencies."
 for tool in "${script_tools[@]}"; do
-  location=$(command -v "$tool") 
+  location=$(command -v "$tool")
   if [ $? -eq 0 ]; then 
     found_requisite_list+=("$location")
   else
-    missing_requisite_list+=("$tool")
+    missing_requisite_list+=("tool: $tool")
   fi
 done
 
@@ -51,15 +54,15 @@ build_tools=(
 
 echo "Checking for required build tools."
 for tool in "${build_tools[@]}"; do
-  location=$(command -v "$tool") 
+  location=$(command -v "$tool")
   if [ $? -eq 0 ]; then 
     found_requisite_list+=("$location")
   else
-    missing_requisite_list+=("$tool")
+    missing_requisite_list+=("tool: $tool")
   fi
 done
 
-# --- Libraries ---
+# --- Libraries via pkg-config ---
 required_pkgs=(
   gmp
   mpfr
@@ -71,42 +74,39 @@ required_pkgs=(
 echo "Checking for required development libraries (via pkg-config)."
 for lib in "${required_pkgs[@]}"; do
   if pkg-config --exists "$lib"; then
-    found_reequisite_list+=("library: $lib => $(pkg-config --modversion "$lib")")
+    libdir=$(pkg-config --variable=libdir "$lib" 2>/dev/null)
+    soname="lib$lib.so"
+
+    if [[ -f "$libdir/$soname" ]]; then
+      found_requisite_list+=("library: $lib @ $libdir/$soname")
+    else
+      found_requisite_list+=("library: $lib @ (not found in $libdir)")
+    fi
   else
     failed_pkg_config_list+=("library: $lib")
   fi
 done
 
 # --- Source Trees ---
-required_sources=(
-  "$GCC_SRC"
-  "$BINUTILS_SRC"
-  "$GLIBC_SRC"
-  "$LINUX_SRC"
-  "$GMP_SRC"
-  "$MPFR_SRC"
-  "$MPC_SRC"
-  "$ISL_SRC"
-  "$ZSTD_SRC"
-)
-
 echo "Checking for required source directories."
-echo "These will be installed by download_sources.sh and extract_from_tar.sh"
-for src in "${required_sources[@]}"; do
+echo "These will be installed by project_download.sh and project_extract.sh"
+for src in "${SOURCE_DIR_LIST[@]}"; do
   if [[ -d "$src" && "$(ls -A "$src")" ]]; then
-    found_reequisite_list+=("source: $src")
+    found_requisite_list+=("source: $src")
   else
     missing_requisite_list+=("source: $src")
   fi
 done
 
-# --- Python Modules (non-fatal) ---
-optional_py_modules=(re sys os json gzip pathlib shutil time tempfile)
+# --- Optional Python Modules ---
+optional_py_modules=(
+  re sys os json gzip pathlib shutil time tempfile
+)
 
 echo "Checking optional Python3 modules."
 for mod in "${optional_py_modules[@]}"; do
   if python3 -c "import $mod" &>/dev/null; then
-    found_reequisite_list+=("python: module $mod")
+    found_requisite_list+=("python: module $mod")
   else
     missing_requisite_list+=("python (optional): module $mod")
   fi
@@ -116,40 +116,37 @@ echo
 echo "Summary:"
 echo "--------"
 
-# Found tools
-for item in "${found_reequisite_list[@]}"; do
+for item in "${found_requisite_list[@]}"; do
   echo "  found: $item"
 done
 
-# Missing essentials
 for item in "${missing_requisite_list[@]:-}"; do
-  echo "❌ missing required tool: $item"
+  echo "❌ missing required: $item"
 done
 
-# pkg-config failures
 for item in "${failed_pkg_config_list[@]:-}"; do
   echo "⚠️ pkg-config could not find: $item"
 done
 
-# Final verdict
 echo
 
 if [[ ${#missing_requisite_list[@]} -eq 0 && ${#failed_pkg_config_list[@]} -eq 0 ]]; then
-  echo "βœ… All required tools and libraries found."
+  echo "βœ… All required tools and sources are present."
 else
-  echo "❌ Some requisites are missing."
-
+  echo "❌ Some requisites are missing or unresolved."
   if [[ ${#failed_pkg_config_list[@]} -gt 0 ]]; then
     echo
-    echo "Note: pkg-config did not find some libraries:"
-    echo "  These are expected if you are building them from source:"
+    echo "Note: The following libraries were not found by pkg-config:"
+    for item in "${failed_pkg_config_list[@]}"; do
+      echo "  - $item"
+    done
+    echo
+    echo "These may be expected if you are building them from source:"
     echo "  - mpc"
     echo "  - isl"
     echo "  - zstd"
-    echo "  If not, consider installing the corresponding dev packages."
+    echo "If not, consider installing the appropriate development packages:"
     echo "    Debian: sudo apt install libmpc-dev libisl-dev libzstd-dev"
     echo "    Fedora: sudo dnf install libmpc-devel isl-devel libzstd-devel"
   fi
 fi
-
-