-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·116 lines (91 loc) · 2.82 KB
/
configure
File metadata and controls
executable file
·116 lines (91 loc) · 2.82 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
set -e
help() {
echo "$0 configures your Splinter build for you."
echo "Use: $0 [options], Where [options] are:"
echo "--with-lua"
echo "--with-wasm"
echo "--with-rust"
echo "--with-embeddings"
echo "--with-numa"
echo "--with-llama"
echo ""
echo "--dev can be passed as the only flag to just enable everything."
echo ""
echo "--install-deb-deps Install all Debian/Ubuntu packages needed to"
echo " build Splinter and its source-built dependencies"
echo " (llama.cpp, WASMEdge, Lua, NUMA, Valgrind)."
echo " Requires sudo. Exits after installation."
echo ""
echo "Once done, you can run 'make' / 'make install' / etc."
echo "To force re-compile, run 'rm -rf build'."
echo ""
echo "Valgrind is auto-detected during configuration."
}
install_deb_deps() {
if ! command -v apt-get &>/dev/null; then
echo "Error: apt-get not found. This option requires a Debian/Ubuntu system." >&2
exit 1
fi
DEB_PACKAGES=(
# Core build toolchain
build-essential g++ cmake ninja-build pkg-config
git curl wget unzip ca-certificates
# Valgrind
valgrind
# llama.cpp build dependencies
libopenblas-dev libopenblas0 liblapack-dev
# Lua 5.4 (latest packaged release)
lua5.4 liblua5.4-dev
# WASMEdge build-from-source dependencies
llvm-dev lld liblld-dev libzstd-dev
# NUMA
libnuma-dev numactl
# MISC
libclang-dev
)
echo "Updating package lists…"
sudo apt-get update -qq
echo "Installing: ${DEB_PACKAGES[*]}"
sudo apt-get install -y "${DEB_PACKAGES[@]}"
echo ""
echo "All dependency packages installed."
echo "You can now run './configure [options]' followed by 'make'."
}
CONFIG=""
for arg in "$@"; do
[ "${arg}" == "--help" ] && {
help
exit 0
}
[ "${arg}" == "--install-deb-deps" ] && {
install_deb_deps
exit 0
}
[ "${arg}" == "--dev" ] && {
CONFIG="-DWITH_LUA=ON -DWITH_WASM=ON -DWITH_RUST=ON -DWITH_EMBEDDINGS=ON -DWITH_LLAMA=ON -DWITH_NUMA=ON "
break
}
[ "${arg}" == "--with-lua" ] && {
CONFIG="${CONFIG}-DWITH_LUA=ON "
}
[ "${arg}" == "--with-wasm" ] && {
CONFIG="${CONFIG}-DWITH_WASM=ON "
}
[ "${arg}" == "--with-rust" ] && {
CONFIG="${CONFIG}-DWITH_RUST=ON "
}
[ "${arg}" == "--with-embeddings" ] && {
CONFIG="${CONFIG} -DWITH_EMBEDDINGS=ON "
}
[ "${arg}" == "--with-llama" ] && {
CONFIG="${CONFIG} -DWITH_LLAMA=ON "
}
done
CONFIG="${CONFIG}.."
cmake -B build
cd build && cmake ${CONFIG}
echo ""
echo "Build configured; you can now run 'make'."
echo "To install afterwards, run 'sudo -E make install'."
echo ""