install.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. RED="\033[31m"
  3. GREEN="\033[32m"
  4. YELLOW="\033[33m"
  5. MAGENTA="\033[35m"
  6. TEAL="\033[36m"
  7. CYAN="\033[96m"
  8. RESET="\033[0m"
  9. if [[ "$(uname)" == "Darwin" ]]; then
  10. THISOS="macOS"
  11. else
  12. THISOS="Linux_amd64"
  13. fi
  14. clear
  15. echo
  16. echo " This script will install Free Oberon."
  17. echo
  18. echo "Free Oberon dependencies are:"
  19. echo -e " * ${YELLOW}Allegro5${RESET} - for the module Graph and the graphical IDE"
  20. echo -e " * ${YELLOW}Git${RESET} - to download Ofront+"
  21. echo -e " * ${YELLOW}GCC${RESET} - to compile the generated C-code"
  22. echo
  23. echo "You can find the information on how to install the dependencies"
  24. echo "in the README.md file."
  25. echo
  26. echo -e "${TEAL}Debian / Ubuntu / Linux Mint${RESET} etc.:"
  27. echo " sudo apt-get update"
  28. echo " sudo apt-get install -y git gcc libc-dev liballegro5-dev liballegro-image5-dev liballegro-audio5-dev liballegro-acodec5-dev"
  29. echo "or, if sudo is not installed (on Debian):"
  30. echo " su"
  31. echo " apt-get update"
  32. echo " apt-get install -y git gcc libc-dev liballegro5-dev liballegro-image5-dev liballegro-audio5-dev liballegro-acodec5-dev"
  33. echo
  34. echo -e "${TEAL}Fedora${RESET}:"
  35. echo " sudo dnf install -y git gcc glibc-devel allegro5-devel allegro5-addon-image allegro5-addon-audio allegro5-addon-acodec allegro5-devel allegro5-addon-image-devel allegro5-addon-audio-devel allegro5-addon-acodec-devel"
  36. echo
  37. echo -e "${TEAL}Arch Linux${RESET}:"
  38. echo " sudo pacman -Sy git gcc pkgconf glibc allegro"
  39. echo
  40. echo -e "${TEAL}openSUSE${RESET}:"
  41. echo " sudo zypper install -y git gcc glibc-devel liballegro5_2-devel liballegro_audio5_2-devel liballegro_image5_2-devel liballegro_primitives5_2-devel liballegro_dialog5_2-devel liballegro_acodec5_2-devel liballegro_acodec5_2-devel liballegro_font5_2-devel"
  42. echo -e "${YELLOW}"
  43. read -p " Are the dependencies installed? [y/n] " -n 1 -r
  44. echo -e "${RESET}"
  45. echo
  46. if [[ $REPLY =~ ^[Yy]$ ]]; then
  47. echo -e "${YELLOW}"
  48. echo -e " Downloading Ofront+...${MAGENTA}"
  49. echo -e " ~~~~~~~~~~~~~~~~~~~~~~${RESET}"
  50. if [ ! -f "Data/bin/OfrontPlus/Readme.txt" ]; then
  51. if [ -d ".git" ]; then
  52. git submodule update --init
  53. else
  54. echo -e "${RED}"
  55. echo " Could not download Ofront+, as this is not a Git repository."
  56. echo " Please Download Ofront+ from Git and place it in Data/bin/OfrontPlus"
  57. echo -e "${RESET}"
  58. fi
  59. [ -d ".git" ] && git submodule update --init
  60. else
  61. echo -e "${GREEN} Ofront+ already present."
  62. echo -e " If there are errors in installation process, delete Data/bin/OfrontPlus${RESET}"
  63. fi
  64. echo -e "${YELLOW}"
  65. echo -e " Building Ofront+...${MAGENTA}"
  66. echo -e " ~~~~~~~~~~~~~~~~~~~${RESET}"
  67. cd Data/bin/OfrontPlus/Target/$THISOS/Bin
  68. ./build
  69. cd ../../../../../..
  70. echo -e "${YELLOW}"
  71. echo -e " Building Free Oberon...${MAGENTA}"
  72. echo -e " ~~~~~~~~~~~~~~~~~~~~~~~${RESET}"
  73. cd src
  74. ./make.sh
  75. cd ..
  76. echo -e "${YELLOW}"
  77. echo -e " Done building Free Oberon${MAGENTA}"
  78. echo -e " ${MAGENTA}~~~~~~~~~~~~~~~~~~~~~~~~~${RESET}"
  79. if [ -f "./FreeOberon" ]; then
  80. echo -e "${GREEN}"
  81. echo -e " Free Oberon is installed. You can now run: ${CYAN}./FreeOberon${GREEN}"
  82. echo -e " Add the following line to ${CYAN}~/.bashrc${GREEN} to use the command ${CYAN}fob${GREEN}:"
  83. echo -e "${CYAN} export PATH=$PWD:\$PATH${GREEN}"
  84. echo -e " To run Free Oberon IDE in a specific language, type ${CYAN}./FreeOberon --lang ru${GREEN}"
  85. echo -e " To run Free Oberon IDE in a a window, type ${CYAN}./FreeOberon --window${GREEN}"
  86. else
  87. echo -e "${RED}"
  88. echo " An error occurred while setting up Free Oberon."
  89. echo " Please check your dependencies."
  90. fi
  91. echo -e "${RESET}"
  92. fi