build.sh 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/sh
  2. set -e # Exit immediately if a command exits with a non-zero status
  3. RED='\e[31m'
  4. GREEN='\e[32m'
  5. YELLOW='\e[33m'
  6. BLUE='\e[34m'
  7. RESET='\e[0m'
  8. # Check and update git submodules
  9. printf "${BLUE}[INFO] Checking for git submodules...${RESET}\n"
  10. git submodule update --init --recursive
  11. # Change directory to hpff and build
  12. printf "${GREEN}[BUILD] Building hpff...${RESET}\n"
  13. cd hpff/
  14. # Check if libhpff.so already exists
  15. if [ -f "../libhpff.so" ]; then
  16. printf "${YELLOW}[WARNING] libhpff.so already built. Skipping build process.${RESET}\n"
  17. else
  18. ./build.sh
  19. # Move the built library to the parent directory
  20. mv ./libhpff.so ../
  21. printf "${GREEN}[SUCCESS] libhpff.so moved to the parent directory.${RESET}\n"
  22. fi
  23. # Return to the original directory
  24. cd ..
  25. # Change directory to hpff and build
  26. printf "${GREEN}[BUILD] Building raylib...${RESET}\n"
  27. cd raylib/src/
  28. # Check if libhpff.so already exists
  29. if [ -f "../../libraylib.so" ]; then
  30. printf "${YELLOW}[WARNING] libraylib.so already built. Skipping build process.${RESET}\n"
  31. else
  32. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED -j $(nproc)
  33. # Move the built library to the parent directory
  34. mv ./libraylib.so* ../../
  35. printf "${GREEN}[SUCCESS] libraylib.so and company moved to the parent directory.${RESET}\n"
  36. fi
  37. cd ../../
  38. # Change directory to libplayback/
  39. #cd libplayback/
  40. # Check if libplayback.so already exists
  41. #if [ -f "../libplayback.so" ]; then
  42. # printf "${YELLOW}[WARNING] libplayback.so already built. Skipping build process.${RESET}\n"
  43. #else
  44. # # Compile with optimization flags
  45. # cc -fPIC -c text.c -O3 -march=native -lraylib -I /opt/local/include -L /opt/local/lib
  46. # gcc -shared -o libplayback.so text.o -O3 -march=native -lraylib -I /opt/local/include -L /opt/local/lib
  47. # # Move the built library to the parent directory
  48. # mv ./libplayback.so ../
  49. # printf "${GREEN}[SUCCESS] libplayback.so moved to the parent directory.${RESET}\n"
  50. #fi
  51. ## Return to the original directory
  52. #cd ..
  53. printf "enter repo address with https:\n"
  54. read babah
  55. printf "Done, cloning $babah...\n"
  56. git clone $babah
  57. printf "Move data from cloned folder to current folder with engine binary(aka heaven-engine)\n"
  58. # Check for the --release flag
  59. if [ "$1" = "--release" ]; then
  60. BUILD_CMD="dub build --build=release --force"
  61. else
  62. BUILD_CMD="dub build --force"
  63. fi
  64. # Execute the build command and hide output, but capture errors
  65. printf "${GREEN}[BUILD] Building engine...${RESET}\n"
  66. # check if log file exists
  67. printf "${BLUE}[INFO] If no Build complete shown, then engine not built, check log.txt for details!${RESET}\n"
  68. if [ -f "./log.txt" ]; then
  69. printf "${YELLOW}[WARNING] log file already exists, continue build...${RESET}\n"
  70. $BUILD_CMD &> log.txt
  71. else
  72. printf "${YELLOW}[WARNING] log file does not exist, creating and continue build...${RESET}\n"
  73. touch log.txt && $BUILD_CMD &> log.txt
  74. fi
  75. # If the build was successful, proceed with further steps
  76. #strip ./libplayback.so
  77. strip ./libhpff.so
  78. strip ./heaven-engine
  79. echo "MADE_BY_QUANTUMDE1_UNDERLEVEL_STUDIOS_2024_ALL_RIGHTS_RESERVED_UNDER_MIT_LICENSE_LMAO" >> ./heaven-engine
  80. printf "${GREEN}[BUILD] Build complete!${RESET}\n"
  81. printf "${GREEN}[INFO] All processes completed successfully!${RESET}\n"