File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Download pre-built MLX library for Go bindings
3+ # Usage: ./scripts/download-lib.sh [version]
4+
5+ set -e
6+
7+ VERSION=" ${1:- latest} "
8+ REPO=" luxfi/mlx"
9+ LIB_DIR=" $( dirname " $0 " ) /../lib"
10+
11+ # Detect platform
12+ OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
13+ ARCH=$( uname -m)
14+
15+ case " $OS " in
16+ darwin)
17+ case " $ARCH " in
18+ arm64) PLATFORM=" macos-arm64" ;;
19+ x86_64) PLATFORM=" macos-x64" ;;
20+ * ) echo " Unsupported macOS architecture: $ARCH " ; exit 1 ;;
21+ esac
22+ ;;
23+ linux)
24+ case " $ARCH " in
25+ x86_64) PLATFORM=" linux-x64" ;;
26+ aarch64) PLATFORM=" linux-arm64" ;;
27+ * ) echo " Unsupported Linux architecture: $ARCH " ; exit 1 ;;
28+ esac
29+ ;;
30+ mingw* |msys* |cygwin* )
31+ PLATFORM=" windows-x64"
32+ ;;
33+ * )
34+ echo " Unsupported OS: $OS "
35+ exit 1
36+ ;;
37+ esac
38+
39+ FILENAME=" libmlx-${PLATFORM} .tar.gz"
40+
41+ echo " === Downloading MLX library for $PLATFORM ==="
42+ mkdir -p " $LIB_DIR "
43+
44+ if [ " $VERSION " = " latest" ]; then
45+ URL=" https://github.com/${REPO} /releases/latest/download/${FILENAME} "
46+ else
47+ URL=" https://github.com/${REPO} /releases/download/${VERSION} /${FILENAME} "
48+ fi
49+
50+ echo " Downloading from: $URL "
51+ curl -fsSL " $URL " -o " /tmp/${FILENAME} " || {
52+ echo " Failed to download. Available releases:"
53+ echo " https://github.com/${REPO} /releases"
54+ exit 1
55+ }
56+
57+ echo " Extracting to: $LIB_DIR "
58+ tar -xzf " /tmp/${FILENAME} " -C " $LIB_DIR "
59+ rm " /tmp/${FILENAME} "
60+
61+ echo " === MLX library installed successfully ==="
62+ ls -la " $LIB_DIR "
You can’t perform that action at this time.
0 commit comments