download-jdks.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. #(c) jmonkeyengine.org
  3. #Author MeFisto94
  4. set -e # Quit on Error
  5. jdk_major_version="21"
  6. jvm_impl="hotspot"
  7. jdk_vendor="eclipse"
  8. function download_jdk {
  9. echo ">>> Downloading the JDK for $1_$2$3"
  10. if [ -f $2-$1/jdk-$1_$2$3 ];
  11. then
  12. echo "<<< Already existing, SKIPPING."
  13. else
  14. curl -# -o $2-$1/jdk-$1_$2$3 -L https://api.adoptium.net/v3/binary/latest/$jdk_major_version/ga/$2/$1/jdk/$jvm_impl/normal/$jdk_vendor?project=jdk
  15. echo "<<< OK!"
  16. fi
  17. }
  18. function build_mac_jdk {
  19. echo "> Getting the Mac JDK"
  20. download_jdk x64 macos .tar.gz
  21. download_jdk aarch64 macos .tar.gz
  22. echo "< OK!"
  23. }
  24. # PARAMS arch
  25. function unpack_windows {
  26. echo ">> Getting the JDK for windows-$1"
  27. download_jdk "$1" windows .zip
  28. echo "<< OK!"
  29. }
  30. function unpack_linux {
  31. echo ">> Getting the JDK for linux-$1"
  32. download_jdk "$1" linux .tar.gz
  33. echo "<< OK!"
  34. }
  35. # PARAMS: os arch arch_unzipsfx
  36. function compile_other {
  37. echo "> Getting JDK for $1-$2"
  38. if [[ $1 != "windows" && $1 != "linux" ]]; then
  39. echo "Unknown Platform $1. ERROR!!!"
  40. exit 1
  41. fi
  42. # Depends on UNPACK and thus DOWNLOAD
  43. if [ $1 == "windows" ]; then
  44. unpack_windows $2
  45. elif [ $1 == "linux" ]; then
  46. unpack_linux $2
  47. fi
  48. echo "< OK!"
  49. }
  50. # PARAMS: os arch arch_unzipsfx
  51. function build_other_jdk {
  52. echo "> Getting Package for $1-$2"
  53. compile_other $1 $2 $3 # Depend on Compile
  54. echo "< OK!"
  55. }
  56. if [ "x$TRAVIS" != "x" ]; then
  57. if [ "x$BUILD_X64" != "x" ]; then
  58. build_other_jdk windows x64 x64
  59. build_other_jdk linux x64 x64
  60. fi
  61. if [ "x$BUILD_X86" != "x" ]; then
  62. build_other_jdk windows x86-32 x86
  63. fi
  64. if [ "x$BUILD_OTHER" != "x" ]; then
  65. build_mac_jdk
  66. fi
  67. else
  68. if [ "x$PARALLEL" != "x" ];
  69. then
  70. build_mac_jdk &
  71. build_other_jdk linux x64 x64 &
  72. # Windows 32bit not by default build_other_jdk windows x86-32 x86 &
  73. build_other_jdk windows x64 x64 &
  74. else
  75. build_mac_jdk
  76. build_other_jdk linux x64 x64
  77. ## Windows 32bit not by default build_other_jdk windows x86-32 x86
  78. build_other_jdk windows x64 x64
  79. # Linux 32bit not supported... build_other_jdk linux x86-32
  80. fi
  81. fi
  82. if [ "x$PARALLEL" != "x" ];
  83. then
  84. wait
  85. fi
  86. cd ../../