-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
/
android-ndk.rb
40 lines (33 loc) · 1.23 KB
/
android-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
40
cask 'android-ndk' do
version '19'
sha256 '04159ade2fc5c7d055248cf65664039b8596f4b9ee3fbc44a9bf2ce2ee28d95d'
# dl.google.com/android/repository/android-ndk was verified as official when first introduced to the cask
url "https://dl.google.com/android/repository/android-ndk-r#{version}-darwin-x86_64.zip"
name 'Android NDK'
homepage 'https://developer.android.com/ndk/index.html'
conflicts_with cask: 'crystax-ndk'
# shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
shimscript = "#{staged_path}/ndk_exec.sh"
preflight do
FileUtils.ln_sf("#{staged_path}/android-ndk-r#{version}", "#{HOMEBREW_PREFIX}/share/android-ndk")
IO.write shimscript, <<~EOS
#!/bin/bash
readonly executable="#{staged_path}/android-ndk-r#{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/android-ndk")
end
caveats <<~EOS
You may want to add to your profile:
'export ANDROID_NDK_HOME="#{HOMEBREW_PREFIX}/share/android-ndk"'
EOS
end