Update the Emacs installation script

This commit is contained in:
tar 2024-05-01 20:09:53 +02:00
parent fa0b7b998c
commit 5e07b8ad42
1 changed files with 148 additions and 137 deletions

View File

@ -59,7 +59,9 @@ error() {
# 1 - INSTALL ESSENTIAL PACKAGES # 1 - INSTALL ESSENTIAL PACKAGES
############################################################# #############################################################
install_essential_packages() { install_essential_packages() {
info "STEP 1 Installing essential packages" local step_name='STEP 1 Installing essential packages'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
apt install -y \ apt install -y \
git \ git \
@ -70,17 +72,18 @@ install_essential_packages() {
software-properties-common \ software-properties-common \
unzip unzip
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 1 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 2 - INSTALL BUILD DEPENDENCIES FOR EMASC # 2 - INSTALL BUILD DEPENDENCIES FOR EMASC
############################################################# #############################################################
install_emacs_build_dependencies() { install_emacs_build_dependencies() {
info "STEP 2 Installing essential packages for building Emacs and tree-sitter" local step_name='STEP 2 Installing essential packages for building Emacs and tree-sitter'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
apt install -y \ apt install -y \
build-essential \ build-essential \
@ -109,17 +112,18 @@ install_emacs_build_dependencies() {
libgirepository1.0-dev libgirepository1.0-dev
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 2 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 3 - CLONE AND BUILD TREE_SITTER # 3 - CLONE AND BUILD TREE_SITTER
############################################################# #############################################################
clone_and_build_tree_sitter() { clone_and_build_tree_sitter() {
info "STEP 3 Installing tree-sitter from source" local step_name='STEP 3 Installing tree-sitter from source'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
# Alternative solution might be just installing via apt: # Alternative solution might be just installing via apt:
# sudo apt install libtree-sitter-dev # sudo apt install libtree-sitter-dev
@ -133,78 +137,83 @@ clone_and_build_tree_sitter() {
# this step might help: # this step might help:
# export LD_LIBRARY_PATH=/usr/local/lib/ # export LD_LIBRARY_PATH=/usr/local/lib/
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
cd .. cd ..
info "STEP 3 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 4 - INSTALL PDF SUPPORT DEPENDENCIES # 4 - INSTALL PDF SUPPORT DEPENDENCIES
############################################################# #############################################################
install_pdf_support_dependencies() { install_pdf_support_dependencies() {
info "STEP 4 Installing PDF support dependencies" local step_name='STEP 4 Installing PDF support dependencies'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
apt install -y mupdf mupdf-tools apt install -y mupdf mupdf-tools
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 4 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 5 - INSTALL NATIVE JIT COMPILATION DEPENDENCIES # 5 - INSTALL NATIVE JIT COMPILATION DEPENDENCIES
############################################################# #############################################################
install_native_jit_compilation_dependencies() { install_native_jit_compilation_dependencies() {
info "STEP 5 Installing native JIT compilation support dependencies" local step_name='STEP 5 Installing native JIT compilation support dependencies'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
# apt install build-essential will install gcc-12, so matching libgccjit for it will be: # apt install build-essential will install gcc-12, so matching libgccjit for it will be:
apt -y install libgccjit-12-dev apt -y install libgccjit-12-dev
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 5 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 6 - INSTALL NATIVE JSON SERIALIZATION DEPENDENCIES # 6 - INSTALL NATIVE JSON SERIALIZATION DEPENDENCIES
############################################################# #############################################################
install_native_json_serialization_dependencies() { install_native_json_serialization_dependencies() {
info "STEP 6 Installing native JSON serialization support dependencies" local step_name='STEP 6 Installing native JSON serialization support dependencies'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
# speeds up LSP communication # speeds up LSP communication
apt install -y libjansson4 libjansson-dev apt install -y libjansson4 libjansson-dev
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 6 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 7 - INSTALL IMAGE DYNAMIC RESIZING DEPENDENCIES # 7 - INSTALL IMAGE DYNAMIC RESIZING DEPENDENCIES
############################################################# #############################################################
install_image_dynamic_resizing_dependencies() { install_image_dynamic_resizing_dependencies() {
info "STEP 7 Installing image dynamic resizing dependencies" local step_name='STEP 7 Installing image dynamic resizing dependencies'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
apt install -y libmagickcore-dev libmagick++-dev apt install -y libmagickcore-dev libmagick++-dev
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 7 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 8 - CLONE AND BUILD EMACS # 8 - CLONE AND BUILD EMACS
############################################################# #############################################################
clone_and_build_emacs() { clone_and_build_emacs() {
info "STEP 8 Building Emacs from source [./configure --help]" local step_name='STEP 8 Building Emacs from source [./configure --help]'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
git clone https://git.savannah.gnu.org/git/emacs.git -b emacs-29 git clone https://git.savannah.gnu.org/git/emacs.git -b emacs-29
cd emacs cd emacs
@ -221,19 +230,20 @@ clone_and_build_emacs() {
make make
make install make install
[[ $? -gt 0 ]] && { error 'Install failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
cd .. cd ..
info "STEP 8 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 9 - INSTALL FONTS # 9 - INSTALL FONTS
############################################################# #############################################################
install_fonts() { install_fonts() {
info "STEP 9 Installing fonts" local step_name='STEP 9 Installing fonts'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
VICTOR_MONO="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/VictorMono.zip" VICTOR_MONO="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/VictorMono.zip"
FONTS_DIR="/home/${SUDO_USER}/.local/share/fonts/" FONTS_DIR="/home/${SUDO_USER}/.local/share/fonts/"
@ -246,17 +256,18 @@ install_fonts() {
chown -Rv $SUDO_USER:$SUDO_USER $FONTS_DIR && \ chown -Rv $SUDO_USER:$SUDO_USER $FONTS_DIR && \
chmod -Rv 755 $FONTS_DIR chmod -Rv 755 $FONTS_DIR
[[ $? -gt 0 ]] && { error 'Fonts installation failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
info "STEP 9 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 10 - INSTALL PYENV # 10 - INSTALL PYENV
############################################################# #############################################################
install_pyenv() { install_pyenv() {
info "STEP 10 Installing pyenv" local step_name='STEP 10 Installing pyenv'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
BASHRC="/home/${SUDO_USER}/.bashrc" BASHRC="/home/${SUDO_USER}/.bashrc"
PROFILE="/home/${SUDO_USER}/.profile" PROFILE="/home/${SUDO_USER}/.profile"
@ -276,7 +287,7 @@ install_pyenv() {
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> $PROFILE echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> $PROFILE
echo 'eval "$(pyenv init -)"' >> $PROFILE echo 'eval "$(pyenv init -)"' >> $PROFILE
[[ $? -gt 0 ]] && { error 'pyenv installation failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
chown -Rv $SUDO_USER:$SUDO_USER $LOCAL_BIN $PYENV && \ chown -Rv $SUDO_USER:$SUDO_USER $LOCAL_BIN $PYENV && \
chmod -Rv 755 $LOCAL_BIN chmod -Rv 755 $LOCAL_BIN
@ -305,15 +316,16 @@ install_pyenv() {
trace "usage: pyenv install -l | pyenv versions | pyenv install 3.12 | pyenv global 3.12" trace "usage: pyenv install -l | pyenv versions | pyenv install 3.12 | pyenv global 3.12"
info "STEP 10 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 11 - INSTALL PYTHON PACKAGES FOR EMACS # 11 - INSTALL PYTHON PACKAGES FOR EMACS
############################################################# #############################################################
install_python_packages() { install_python_packages() {
info "STEP 11 Installing python packages" local step_name='STEP 11 Installing python packages'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
apt install -y python3-pip \ apt install -y python3-pip \
python3-jedi \ python3-jedi \
@ -325,21 +337,22 @@ install_python_packages() {
black \ black \
flake8 flake8
[[ $? -gt 0 ]] && { error 'python packages installation failed, stopping now'; exit 1; } [[ $? -gt 0 ]] && { error "$step_name failed, stopping now"; exit 1; }
trace "Ensure the following in ~/emacs.d/init.el" trace "Ensure the following in ~/emacs.d/init.el"
trace "to use the system stuff rather than the eply's virtual environment:" trace "to use the system stuff rather than the eply's virtual environment:"
trace "(setq elpy-rpc-virtualenv-path 'current)" trace "(setq elpy-rpc-virtualenv-path 'current)"
info "STEP 11 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
############################################################# #############################################################
# 12 - CLONE EMACS CONFIG # 12 - CLONE EMACS CONFIG
############################################################# #############################################################
clone_emacs_config() { clone_emacs_config() {
info "STEP 12 Cloning emacs config to ~/.emacs.d" local step_name='STEP 12 Cloning emacs config to ~/.emacs.d'
warn "Press enter to proceed with $step_name"; read
info "$step_name"
EMACS_DIR="/home/${SUDO_USER}/.emacs.d/" EMACS_DIR="/home/${SUDO_USER}/.emacs.d/"
@ -353,8 +366,7 @@ clone_emacs_config() {
trace "Emacs will throw a lot of compilation warnings on first startup - that's ok" trace "Emacs will throw a lot of compilation warnings on first startup - that's ok"
trace "To install the icons you need to run: M-x nerd-icons-install-fonts" trace "To install the icons you need to run: M-x nerd-icons-install-fonts"
info "STEP 12 done" info "done"
warn "Press enter to proceed with the next step"; read
} }
@ -392,4 +404,3 @@ info "Bye!"
info "PS. Log is here: ${LOG}" info "PS. Log is here: ${LOG}"
exit 0 exit 0