-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (51 loc) · 2.1 KB
/
install.sh
File metadata and controls
executable file
·60 lines (51 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
set -euo pipefail
# Usage:
# ./install.sh # install into active Python env, build Python bindings (default)
# ./install.sh /some/path # install into /some/path, build Python bindings
# ./install.sh /some/path off # install into /some/path, NO Python bindings
# ./install.sh "" off # install into Python env, NO Python bindings
INSTALL_PREFIX="${1:-}"
WITH_PYTHON_ARG="${2:-on}"
# Normalize second arg to ON/OFF
case "${WITH_PYTHON_ARG,,}" in
on|yes|y|1)
BUILD_PYTHON_BINDINGS="ON"
;;
off|no|n|0)
BUILD_PYTHON_BINDINGS="OFF"
;;
*)
echo "[ERROR] Second argument (WITH_PYTHON) must be one of: on/off/yes/no/1/0"
exit 1
;;
esac
# If no explicit install prefix was passed, use the active Python env's purelib
if [ -z "$INSTALL_PREFIX" ]; then
# Prefer 'python' if available, fall back to 'python3'
if command -v python >/dev/null 2>&1; then
PYTHON_BIN="python"
elif command -v python3 >/dev/null 2>&1; then
PYTHON_BIN="python3"
else
echo "[ERROR] Could not find 'python' or 'python3' in PATH."
echo " Either install Python or pass an explicit install prefix as the first argument."
exit 1
fi
INSTALL_PREFIX="$("$PYTHON_BIN" -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')"
echo "[INFO] No install prefix specified. Using Python env site-packages:"
echo " $INSTALL_PREFIX"
else
echo "[INFO] Using custom install prefix: $INSTALL_PREFIX"
echo "[INFO] After installation, ensure Python can find DataStates-LLM by adding:"
echo " export PYTHONPATH=\"$INSTALL_PREFIX:\$PYTHONPATH\""
echo " # (assuming the 'datastates' package will live under: $INSTALL_PREFIX/datastates)"
fi
echo "[INFO] BUILD_PYTHON_BINDINGS = $BUILD_PYTHON_BINDINGS"
# Configure and build
cmake -B build \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DBUILD_PYTHON_BINDINGS="$BUILD_PYTHON_BINDINGS"
cmake --build build -j"$(nproc)"
cmake --install build
echo "[INFO] DataStates-LLM installation complete."