build(mk): added meson auto installer
This commit is contained in:
58
mk
58
mk
@@ -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}"
|
||||
log "${YELLOW}[Info] Please install Meson and try again.${NC}"
|
||||
exit 1
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user