zoi-cli 3.8.0-beta-prod

Universal Package Manager & Environment Setup Tool
#!/bin/sh

PREFIX="/usr/local"

for arg in "$@"; do
  case $arg in
    --prefix=*)
      PREFIX=$(echo "$arg" | sed 's/--prefix=//')
      ;;
    *)
      echo "Unknown option: $arg"
      echo "Usage: ./configure [--prefix=/path/to/install]"
      exit 1
      ;;
  esac
done

OS_NAME=$(uname -s)
ARCH_NAME=$(uname -m)

case $OS_NAME in
  Linux) OS_NAME="linux" ;;
  Darwin) OS_NAME="macos" ;;
  FreeBSD) OS_NAME="freebsd" ;;
  OpenBSD) OS_NAME="openbsd" ;;
  *NT*) OS_NAME="windows" ;;
  *)
    echo "Warning: Unsupported OS '$OS_NAME' detected. The build may fail."
    ;;
esac

case $ARCH_NAME in
  x86_64 | amd64) ARCH_NAME="amd64" ;;
  aarch64 | arm64) ARCH_NAME="arm64" ;;
  *)
    echo "Warning: Unsupported architecture '$ARCH_NAME' detected. The build may fail."
    ;;
esac

if [ "$OS_NAME" = "openbsd" ] && [ "$ARCH_NAME" = "arm64" ]; then
    echo "Warning: OpenBSD on arm64 is not officially supported. The build may fail."
fi

cat << EOF > config.mk
# This file is generated by ./configure. Do not edit.

# Installation prefix
PREFIX = $PREFIX

# Directory for executables (derived from PREFIX)
BINDIR = \$(PREFIX)/bin

# Detected OS and Architecture
OS_NAME = $OS_NAME
ARCH_NAME = $ARCH_NAME
EOF

echo "Zoi configured successfully:"
echo "  Installation prefix:  $PREFIX"
echo "  Binary directory:     \$PREFIX/bin"
echo "  Operating System:     $OS_NAME"
echo "  Architecture:         $ARCH_NAME"
echo ""
echo "Now run 'make' to build, and 'make install' to install."