package-windows.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
  3. if [ -n "${BUILD_DIR}" ]; then
  4. build="${BUILD_DIR}"
  5. elif [ -n "${OSTYPE}" ]; then
  6. if [ -n "${MSYSTEM}" ]; then
  7. build="${repo_root}/build-${OSTYPE}-${MSYSTEM}"
  8. else
  9. build="${repo_root}/build-${OSTYPE}"
  10. fi
  11. elif [ "$USER" = "vk" ]; then
  12. build="${repo_root}/build"
  13. else
  14. build="${repo_root}/build"
  15. fi
  16. set -exu -o pipefail
  17. ${GITHUB_ACTIONS+echo "::group::Installing"}
  18. cmake --install "${build}"
  19. ${GITHUB_ACTIONS+echo "::endgroup::"}
  20. if [ ! -f "/msys2-installer.exe" ]; then
  21. ${GITHUB_ACTIONS+echo "::group::Fetching MSYS2 installer"}
  22. "${repo_root}/packaging/windows/fetch-msys2-installer.py" /msys2-installer.exe
  23. ${GITHUB_ACTIONS+echo "::endgroup::"}
  24. fi
  25. ${GITHUB_ACTIONS+echo "::group::Packaging"}
  26. NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
  27. NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
  28. NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
  29. if [ -f "/gpl-3.0.txt" ]; then
  30. ${GITHUB_ACTIONS+echo "::group::Fetching GPL3 License"}
  31. curl -o /gpl-3.0.txt "https://www.gnu.org/licenses/gpl-3.0.txt"
  32. ${GITHUB_ACTIONS+echo "::endgroup::"}
  33. fi
  34. /mingw64/bin/makensis.exe -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${repo_root}/packaging/windows/installer.nsi"
  35. ${GITHUB_ACTIONS+echo "::endgroup::"}