mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-05 04:24:39 -04:00
fix(packaging): skip Linux GPU libraries on Darwin (#12466)
Return before initializing Linux library helpers on macOS. The system Bash lacks associative arrays, and Metal uses system frameworks. Assisted-by: Codex:gpt-6 Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
This commit is contained in:
1 parent
ed1fbc5674
commit
def5a0085e
2 files changed
+29
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Darwin uses system GPU frameworks and ships Bash 3.2 without associative arrays.
|
||||
set -euo pipefail
|
||||
SCRIPT="$(dirname "$(realpath "$0")")/package-gpu-libs.sh"
|
||||
WORK=$(mktemp -d)
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
uname() { echo Darwin; }
|
||||
declare() {
|
||||
if [[ "${1:-}" == -A ]]; then
|
||||
echo 'Bash 3.2 does not support declare -A' >&2
|
||||
return 2
|
||||
fi
|
||||
builtin declare "$@"
|
||||
}
|
||||
export BUILD_TYPE=metal
|
||||
source "$SCRIPT" "$WORK/lib"
|
||||
package_gpu_libs
|
||||
test -z "$(find "$WORK" -type f -print)"
|
||||
echo 'PASS: Darwin does not load the Linux GPU packager'
|
||||
@@ -15,6 +15,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
# macOS uses system GPU frameworks; this packager handles Linux ELF libraries.
|
||||
# Return before Bash 3.2 encounters the associative arrays used below.
|
||||
if [[ "$(uname -s)" == Darwin ]]; then
|
||||
package_gpu_libs() {
|
||||
echo "Detected Darwin; no Linux GPU libraries to package"
|
||||
}
|
||||
export -f package_gpu_libs
|
||||
return 0 2>/dev/null || exit 0
|
||||
fi
|
||||
|
||||
TARGET_LIB_DIR="${1:-./lib}"
|
||||
|
||||
# Create target directory if it doesn't exist
|
||||
|
||||
Reference in new issue
Block a user