|
| 1 | + |
| 2 | + version '19.3.2' |
| 3 | + sha256 '3809582f4b616fbf603ed9c917c404a1ce160067e41ba6e56b07d0a11ca70764' |
| 4 | + |
| 5 | + NAME_AND_VER = cask.to_s.split('@') |
| 6 | + JVMS_DIR = '/Library/Java/JavaVirtualMachines'.freeze |
| 7 | + TARGET_DIR = "#{JVMS_DIR}/#{NAME_AND_VER.first}-v#{NAME_AND_VER.last}-#{version}".freeze |
| 8 | + |
| 9 | + # github.com/graalvm/graalvm-ce-builds was verified as official when first introduced to the cask |
| 10 | + url "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-#{version}/#{NAME_AND_VER.first}-darwin-amd64-#{version}.tar.gz" |
| 11 | + appcast 'https://github.com/oracle/graal/releases.atom' |
| 12 | + name 'GraalVM Community Edition 19.3 (Java 11)' |
| 13 | + homepage 'https://www.graalvm.org/' |
| 14 | + |
| 15 | + artifact "#{NAME_AND_VER.first}-#{version}", target: TARGET_DIR |
| 16 | + |
| 17 | + postflight do |
| 18 | + # Ensure GraalVM JDK 11 is listed by `/usr/libexec/java_home -V`. |
| 19 | + macos_dir = "#{TARGET_DIR}/Contents/MacOS" |
| 20 | + libjli_filename = 'libjli.dylib' |
| 21 | + libjli_path = "#{TARGET_DIR}/Contents/Home/lib/jli/#{libjli_filename}" |
| 22 | + libjli_symlink_path = "#{macos_dir}/#{libjli_filename}" |
| 23 | + next if File.exist?(libjli_symlink_path) |
| 24 | + |
| 25 | + system_command '/bin/mkdir', args: ['-p', macos_dir], sudo: true |
| 26 | + system_command '/bin/ln', args: ['-s', libjli_path, libjli_symlink_path], sudo: true |
| 27 | + end |
| 28 | + |
| 29 | + caveats <<~EOS |
| 30 | + Installing GraalVM CE #{NAME_AND_VER.last} (Java 11) in #{JVMS_DIR} requires root permissions. |
| 31 | + You may be asked to enter your password to proceed. |
| 32 | +
|
| 33 | + On macOS Catalina, you may get a warning that "the developer cannot be |
| 34 | + verified". This check can be disabled in the "Security & Privacy" |
| 35 | + preferences pane or by running the following command: |
| 36 | + xattr -r -d com.apple.quarantine #{TARGET_DIR} |
| 37 | +
|
| 38 | + To use GraalVM CE #{NAME_AND_VER.last}, you may want to change your `JAVA_HOME`: |
| 39 | + export JAVA_HOME=#{TARGET_DIR}/Contents/Home |
| 40 | +
|
| 41 | + or you may want to add its `bin` directory to your `PATH`: |
| 42 | + export PATH=#{TARGET_DIR}/Contents/Home/bin:"$PATH" |
| 43 | +
|
| 44 | + GraalVM CE is licensed under the GPL 2 with Classpath exception: |
| 45 | + https://github.com/oracle/graal/blob/master/LICENSE |
| 46 | +
|
| 47 | + EOS |
| 48 | +end |
0 commit comments