11#! /usr/bin/env bash
22set -euo pipefail
33
4- install_dependencies () {
5- echo " Checking and installing system dependencies..."
6-
7- # Determine if we need to use sudo
8- SUDO=" "
9- if [ " $EUID " -ne 0 ]; then
10- if command -v sudo & > /dev/null; then
11- SUDO=" sudo"
12- else
13- echo " Warning: Not running as root and sudo not found. Package installation may fail."
14- echo " Please run as root or install sudo."
15- fi
16- fi
17-
18- if command -v conda & > /dev/null; then
19- echo " Installing cmake via conda..."
20- conda install -y cmake
21- else
22- echo " Warning: conda not found. Skipping cmake installation via conda."
23- echo " Please install conda or manually install cmake."
24- fi
25-
26- # Detect OS type
27- if [ -f /etc/os-release ]; then
28- . /etc/os-release
29- OS=$ID
30- elif [ -f /etc/debian_version ]; then
31- OS=" debian"
32- elif [ -f /etc/redhat-release ]; then
33- OS=" rhel"
34- else
35- echo " Warning: Unable to detect OS type. Skipping dependency installation."
36- return 0
37- fi
38-
39- # Install dependencies based on OS
40- case " $OS " in
41- debian|ubuntu|linuxmint|pop)
42- echo " Detected Debian-based system. Installing libhwloc-dev and pkg-config..."
43- $SUDO apt update
44- $SUDO apt install -y libhwloc-dev pkg-config
45- ;;
46- fedora|rhel|centos|rocky|almalinux)
47- echo " Detected Red Hat-based system. Installing hwloc-devel and pkgconfig..."
48- $SUDO dnf install -y hwloc-devel pkgconfig || $SUDO yum install -y hwloc-devel pkgconfig
49- ;;
50- arch|manjaro)
51- echo " Detected Arch-based system. Installing hwloc and pkgconf..."
52- $SUDO pacman -S --noconfirm hwloc pkgconf
53- ;;
54- opensuse* |sles)
55- echo " Detected openSUSE-based system. Installing hwloc-devel and pkg-config..."
56- $SUDO zypper install -y hwloc-devel pkg-config
57- ;;
58- * )
59- echo " Warning: Unsupported OS '$OS '. Please manually install libhwloc-dev and pkg-config."
60- ;;
61- esac
62- }
63-
64- install_dependencies
65-
664usage () {
675 cat << EOF
686Usage: $0 [SUBCOMMAND] [BUILD_OPTIONS]
@@ -78,7 +16,6 @@ SUBCOMMANDS:
7816BUILD_OPTIONS (for "build" or "all"):
7917 (none) Auto-detect CPU and configure automatically (recommended)
8018 --manual Skip auto-detection, use manual configuration (see below)
81- --skip-deps Skip deps step even with subcommand "all"
8219 --no-clean Do not delete local build/ before building (default cleans)
8320
8421AUTO-DETECTION (Default):
@@ -90,7 +27,7 @@ MANUAL CONFIGURATION:
9027 Use --manual flag and set these environment variables before running:
9128
9229 CPUINFER_CPU_INSTRUCT - CPU instruction set
93- Options: NATIVE, AVX512, AVX2
30+ Options: NATIVE, AVX512, AVX2, FANCY
9431 CPUINFER_ENABLE_AMX - Enable Intel AMX support
9532 Options: ON, OFF
9633
@@ -107,7 +44,7 @@ Manual configuration examples:
10744 Example manual build:
10845 export CPUINFER_CPU_INSTRUCT=AVX512
10946 export CPUINFER_ENABLE_AMX=OFF
110- $0 --manual
47+ $0 build --manual
11148
11249Advanced option (for binary distribution):
11350 FANCY - AVX512 with full extensions for Ice Lake+/Zen 4+
@@ -206,7 +143,6 @@ build_step() {
206143 while [[ $# -gt 0 ]]; do
207144 case " $1 " in
208145 --manual) MANUAL_MODE=1; shift ;;
209- --skip-deps) shift ;; # ignore here
210146 --no-clean) CLEAN_BUILD=0; shift ;;
211147 -h|--help) usage ;;
212148 * ) break ;;
@@ -241,9 +177,9 @@ build_step() {
241177 echo " Configuration: NATIVE + AMX=ON (best performance)"
242178 echo " "
243179 echo " ⚠️ Note: If you plan to use LLAMAFILE backend, use manual mode:"
244- echo " export CPUINFER_CPU_INSTRUCT=AVX512( AVX2/FANCY) "
180+ echo " export CPUINFER_CPU_INSTRUCT=AVX512 # or AVX2/FANCY"
245181 echo " export CPUINFER_ENABLE_AMX=OFF"
246- echo " ./install.sh --manual"
182+ echo " ./install.sh build --manual"
247183 else
248184 echo " ℹ AMX instructions not detected"
249185 export CPUINFER_CPU_INSTRUCT=NATIVE
@@ -252,7 +188,7 @@ build_step() {
252188 fi
253189
254190 echo " "
255- echo " To use manual configuration instead, run: $0 --manual"
191+ echo " To use manual configuration instead, run: $0 build --manual"
256192 echo " "
257193 else
258194 # Manual mode - validate user configuration (no exports)
@@ -336,11 +272,7 @@ case "$SUBCMD" in
336272 build_step " $@ "
337273 ;;
338274 all)
339- if [[ " ${*:- } " == * " --skip-deps " * ]]; then
340- build_step " $@ "
341- else
342- install_dependencies
343- build_step " $@ "
344- fi
275+ install_dependencies
276+ build_step " $@ "
345277 ;;
346278esac
0 commit comments