build(mk): added meson auto installer

This commit is contained in:
2025-03-21 11:39:02 -04:00
parent 30a795e6b1
commit 9f524cf821

54
mk
View File

@@ -119,8 +119,62 @@ fi
log "${BLUE}[Info] Checking if Meson is installed...${NC}"
if ! command -v meson &> /dev/null; then
log "${RED}[Error] Meson is not installed. Exiting...${NC}"
# Check if the user would like to try to install meson by getting input
installMeson=0
while true; do
read -p "Would you like to try to install Meson? [y/n]: " yn
case $yn in
[Yy]* ) installMeson=1; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
if [[ $installMeson -eq 1 ]]; then
# check if pip is installed
if ! command -v pip &> /dev/null; then
log "${RED}[Error] pip is not installed. Exiting...${NC}"
log "${YELLOW}[Info] Please install pip and try again.${NC}"
exit 1
else
log "${MAGENTA}[Success] pip is installed. Continuing...${NC}"
fi
# check if python3 is installed
if ! command -v python3 &> /dev/null; then
log "${RED}[Error] python3 is not installed. Exiting...${NC}"
log "${YELLOW}[Info] Please install python3 and try again.${NC}"
log "${YELLOW}[INFO] If you have python3 installed, please add it to your PATH.${NC}"
exit 1
else
log "${MAGENTA}[Success] python3 is installed. Continuing...${NC}"
fi
# Check if the venv ~/.4DSSE_env exists
if [[ ! -d "$HOME/.4DSSE_env" ]]; then
log "${BLUE}[Info] Creating virtual environment...${NC}"
python3 -m venv "$HOME/.4DSSE_env"
source "$HOME/.4DSSE_env/bin/activate"
log "${GREEN}[Success] Virtual environment created.${NC}"
else
log "${MAGENTA}[Succsess] Virtual environment already exists. Skipping...${NC}"
fi
# install meson
log "${BLUE}[Info] Installing Meson...${NC}"
pip install meson
# confirm meson is installed
if ! command -v meson &> /dev/null; then
log "${RED}[Error] Meson did not install properly. Exiting...${NC}"
log "${YELLOW}[Info] Please manually install Meson and try again.${NC}"
exit 1
else
log "${GREEN}[Success] Meson installed.${NC}"
fi
else
log "${YELLOW}[Info] Please install Meson and try again.${NC}"
exit 1
fi
else
log "${MAGENTA}[Success] Meson is installed. Continuing...${NC}"
fi