forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrystax-ndk.rb
39 lines (32 loc) · 1.11 KB
/
crystax-ndk.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
cask 'crystax-ndk' do
version '10.3.2'
sha256 '382bc6bf8bf4fb1278372ac70f4b86cf6a633d60b33f30b6895f5c9975d3d7bf'
url "https://www.crystax.net/download/crystax-ndk-#{version}-darwin-x86_64.tar.xz"
name 'Crystax NDK'
homepage 'https://www.crystax.net/android/ndk'
conflicts_with cask: 'android-ndk'
# shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
shimscript = "#{staged_path}/ndk_exec.sh"
preflight do
FileUtils.ln_sf("#{staged_path}/crystax-ndk-#{version}", "#{HOMEBREW_PREFIX}/share/crystax-ndk")
IO.write shimscript, <<~EOS
#!/bin/bash
readonly executable="#{staged_path}/crystax-ndk-#{version}/$(basename ${0})"
test -f "${executable}" && exec "${executable}" "${@}"
EOS
end
[
'ndk-build',
'ndk-depends',
'ndk-gdb',
'ndk-stack',
'ndk-which',
].each { |link_name| binary shimscript, target: link_name }
uninstall_postflight do
FileUtils.rm_f("#{HOMEBREW_PREFIX}/share/crystax-ndk")
end
caveats <<~EOS
You may want to add to your profile:
'export ANDROID_NDK_HOME="#{HOMEBREW_PREFIX}/share/crystax-ndk"'
EOS
end