aboutsummaryrefslogtreecommitdiff
path: root/compile/nvim.sh
blob: be7903cdcc8b669634f053c0826ebb7a8b68dbe7 (plain) (blame)
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
#!/bin/sh
if [ "$(id -u)" -eq 0 ] ; then
	echo "Run as a regular user"
	exit 1
fi
set -ex
nproc=1
case "$(uname)" in
Darwin|OpenBSD) nproc="$(sysctl -n hw.ncpu)" ;;
Linux) nproc="$(nproc)" ;;
esac
codedir="${CODEDIR:-$HOME/scm}"
nvimdir="${codedir}/nvim"

# On OpenBSD:
# Workaround for OpenBSD's make being called endlessly...
#    #!/bin/sh
#    exec gmake "$@"
# Call it `make` and place it in your path before the system make.
# Then:
#    pkg_add gmake cmake cargo rust clang-tools-extra
# Also in the environment:
#     LIBCLANG_PATH=/usr/local/llvm21/lib
#     CARGO_TARGET_DIR=$HOME/.cache/cargo-target-dir # /tmp is usually small...
# Then cargo for tree-sitter-cli...
#     cargo install tree-sitter-cli
# Also add ~/.cargo/bin to your path when you're done.
# useful for clangd: `pkg_add bear spdlog`

if ! [ -d "$nvimdir" ] ; then
	git clone https://github.com/neovim/neovim "$nvimdir"
fi

cd "$nvimdir"
git clean -fdx .
rm -rf build || echo ""
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local" -j"$nproc"
make install
cd -