Last active
October 2, 2024 17:21
-
-
Save RaphGL/9c4068d3db2b5a18381cfb1771993dcb to your computer and use it in GitHub Desktop.
Install Odin compiler and LSP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env sh | |
USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6) | |
# where to put the odin repos | |
REPO_DIR=${USER_HOME}/Documents | |
if [ "$EUID" -ne 0 ]; | |
then echo "Please run as root" | |
exit | |
fi | |
function notify() { | |
echo | |
echo "[[ $1 ]]" | |
echo | |
} | |
function clone_odin_compiler_and_lsp() { | |
notify "CLONING ODIN COMPILER" | |
git clone https://github.com/odin-lang/Odin ${REPO_DIR}/Odin | |
notify "CLONING ODIN LSP" | |
git clone https://github.com/DanielGavin/ols ${REPO_DIR}/ols | |
} | |
function get_latest_tagged_release() { | |
git checkout $(git describe --tags "$(git rev-list --tags --max-count=1)") | |
} | |
function install_odin_compiler() { | |
notify "INSTALLING ODIN COMPILER" | |
cd ${REPO_DIR}/Odin | |
git pull | |
get_latest_tagged_release | |
make release-native | |
mkdir -p /usr/lib/odin | |
cp odin "/usr/lib/odin/odin" | |
cp -r base "/usr/lib/odin/base" | |
cp -r core "/usr/lib/odin/core" | |
cp -r shared "/usr/lib/odin/shared" | |
cp -r vendor "/usr/lib/odin/vendor" | |
rm -f /usr/bin/odin | |
ln -s "/usr/lib/odin/odin" "/usr/bin/odin" | |
} | |
function install_odin_lsp() { | |
notify "INSTALLING ODIN LSP" | |
cd ${REPO_DIR}/ols | |
git pull | |
sh build.sh | |
mv -f ols /usr/bin/ols | |
} | |
clone_odin_compiler_and_lsp | |
install_odin_compiler | |
install_odin_lsp | |
echo | |
echo | |
echo "Odin has been installed" | |
echo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment