build-installers.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/bash
  2. #(c) jmonkeyengine.org
  3. # Uses NBPackage to create installers for different platforms.
  4. # Prequisites for running this script:
  5. # - The SDK ZIP build must already exist
  6. # - JDKs must already been downloaded
  7. # Some quirks exist with the different platform installers:
  8. # - Linux DEPs are only created with current architecture
  9. # - Windows installer requires Inno Setup, this seems like an easy thing to break in this chain
  10. set -e # Quit on Error
  11. nbpackage_version="1.0-beta6"
  12. nbpackage_url="https://archive.apache.org/dist/netbeans/netbeans-nbpackage/$nbpackage_version/nbpackage-$nbpackage_version-bin.zip"
  13. inno_setup_url="https://files.jrsoftware.org/is/6/innosetup-6.5.1.exe"
  14. function download_nbpackage {
  15. echo "> Downloading the nbpackage"
  16. if [ -f "downloads/nbpackage.zip" ];
  17. then
  18. echo "< Already existing, SKIPPING."
  19. else
  20. mkdir -p downloads
  21. curl -# -o downloads/nbpackage.zip -L $nbpackage_url
  22. echo "< OK!"
  23. fi
  24. }
  25. function prepare_nbpackage {
  26. echo "> Extracting the nbpackage"
  27. if [ -d "nbpackage" ];
  28. then
  29. echo "< Already existing, SKIPPING."
  30. else
  31. unzip -qq downloads/nbpackage.zip -d nbpackage
  32. echo "< OK!"
  33. fi
  34. }
  35. function build_linux_deb {
  36. echo "> Building the Linux DEB"
  37. ./nbpackage/nbpackage-$nbpackage_version/bin/nbpackage --input ../dist/jmonkeyplatform.zip --config linux-x64/jmonkeyengine-x64-deb.properties --output ../dist/ -v -Ppackage.version=$1
  38. echo "< OK!"
  39. }
  40. function build_windows_installer {
  41. echo "> Building the Windows installer"
  42. setup_inno_setup $2
  43. ./nbpackage/nbpackage-$nbpackage_version/bin/nbpackage --input ../dist/jmonkeyplatform.zip --config windows-x64/jmonkeyengine-windows-x64.properties --output ../dist/ -v -Ppackage.version=$1
  44. echo "< OK!"
  45. }
  46. function setup_inno_setup {
  47. echo ">> Setting up Inno Setup"
  48. download_inno_setup
  49. # Needs Wine!!!
  50. if [ -z "$1" ];
  51. then
  52. wine downloads/innosetup.exe /VERYSILENT
  53. else
  54. echo "<< Trying headless mode"
  55. xvfb-run wine downloads/innosetup.exe /VERYSILENT
  56. fi
  57. echo "<< OK!"
  58. }
  59. function download_inno_setup {
  60. echo ">>> Downloading Inno Setup"
  61. if [ -f "downloads/innosetup.exe" ];
  62. then
  63. echo "<<< Already existing, SKIPPING."
  64. else
  65. mkdir -p downloads
  66. curl -# -o downloads/innosetup.exe -L $inno_setup_url
  67. echo "<<< OK!"
  68. fi
  69. }
  70. function build_macos_pgk {
  71. echo "> Building the MacOS pgk"
  72. build_macos_x64_pgk $1
  73. build_macos_aarch64_pgk $1
  74. echo "< OK!"
  75. }
  76. function build_macos_x64_pgk {
  77. echo ">> Building the MacOS x64 pgk"
  78. ./nbpackage/nbpackage-$nbpackage_version/bin/nbpackage --input ../dist/jmonkeyplatform.zip --config macos-x64/jmonkeyengine-macos-x64.properties --output ../dist/ -v -Ppackage.version=$1
  79. echo "<< OK!"
  80. }
  81. function build_macos_aarch64_pgk {
  82. echo ">> Building the MacOS aarch64 pgk"
  83. ./nbpackage/nbpackage-$nbpackage_version/bin/nbpackage --input ../dist/jmonkeyplatform.zip --config macos-aarch64/jmonkeyengine-macos-aarch64.properties --output ../dist/ -v -Ppackage.version=$1
  84. echo "<< OK!"
  85. }
  86. echo "Building installers with version tag $1"
  87. versionString=$1
  88. if [[ $versionString != [[:digit:]]* ]];
  89. then
  90. versionString=${versionString:1}
  91. echo "Stripped version tag to $versionString"
  92. fi
  93. download_nbpackage
  94. prepare_nbpackage
  95. build_linux_deb $versionString
  96. build_windows_installer $versionString $2
  97. build_macos_pgk $versionString