make.sh 978 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. OLD_PWD="$(pwd)"
  3. SWITCH_DIR=$(realpath "$(dirname "$0")")
  4. STK_DIR=$(dirname "${SWITCH_DIR}")
  5. echo "Compiling STK"
  6. if [[ ! -d "${STK_DIR}/cmake_build" ]]; then
  7. mkdir "${STK_DIR}/cmake_build"
  8. fi
  9. cd "${STK_DIR}/cmake_build"
  10. "${DEVKITPRO}/portlibs/switch/bin/aarch64-none-elf-cmake" -G"Unix Makefiles" \
  11. -DCMAKE_INSTALL_PREFIX=/ \
  12. ../
  13. make -j$(nproc) || exit 1
  14. make install DESTDIR=./install || exit 1
  15. # Build nro (executable for switch)
  16. "${SWITCH_DIR}/package.sh"
  17. echo "Building package"
  18. rm -rf sdcard
  19. mkdir sdcard
  20. # Move data over
  21. mv install/share/supertuxkart/data sdcard/stk-data
  22. # Add executable
  23. mkdir sdcard/switch
  24. mv bin/stk.nro sdcard/switch/stk.nro
  25. echo "Compressing"
  26. # Zip up actual release:
  27. cd sdcard
  28. ZIP_PATH="${STK_DIR}/cmake_build/bin/SuperTuxKart-${PROJECT_VERSION}-switch.zip"
  29. if [[ -f "${ZIP_PATH}" ]]; then
  30. rm "${ZIP_PATH}"
  31. fi
  32. zip -r "${ZIP_PATH}" .
  33. # Recover old pwd
  34. cd $OLD_PWD
  35. echo "Done. Package available at ${ZIP_PATH}"