homebrew-cask/Casks/android-ndk.rb

41 lines
1.2 KiB
Ruby
Raw Normal View History

2017-04-19 03:36:53 +08:00
cask 'android-ndk' do
2017-06-15 08:38:02 +08:00
version '15'
sha256 '65a6df9d5cd100c51af17aa3e94f5125cc2233c449cc6fde3665265192ac1865'
2017-04-19 03:36:53 +08:00
# 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'
2017-04-19 03:36:53 +08:00
conflicts_with cask: 'crystax-ndk'
# shim script (https://github.com/caskroom/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")
2017-04-19 03:36:53 +08:00
IO.write shimscript, <<-EOS.undent
#!/bin/bash
readonly executable="#{staged_path}/android-ndk-r#{version}/$(basename ${0})"
test -f "${executable}" && exec "${executable}" "${@}"
EOS
end
%w[
ndk-build
ndk-depends
ndk-gdb
ndk-stack
ndk-which
].each { |link_name| binary shimscript, target: link_name }
2017-06-16 18:30:19 +08:00
uninstall_postflight do
FileUtils.rm("#{HOMEBREW_PREFIX}/share/android-ndk")
end
2017-04-19 03:36:53 +08:00
caveats <<-EOS.undent
You may want to add to your profile:
2017-06-16 18:30:19 +08:00
'export ANDROID_NDK_HOME="#{HOMEBREW_PREFIX}/share/android-ndk"'
2017-04-19 03:36:53 +08:00
EOS
end