summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-02-03 16:12:13 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-02-03 16:12:13 -0800
commitbaa5ed9c8ec737e566ffd73a29361961422abe02 (patch)
treeccb4f6e61da16aff68908762aebe96e20cd6b595
parent70eaa9d58e6141248b2e035379d2f4a3f96976a5 (diff)
parent1af61f203040038dee9f8bf648bc43d6dc81572a (diff)
downloadmruby-baa5ed9c8ec737e566ffd73a29361961422abe02.tar.gz
mruby-baa5ed9c8ec737e566ffd73a29361961422abe02.zip
Merge pull request #812 from shtirlic/androideabi
Add androideabi toolchain rake task (Build mruby with Android NDK)
-rw-r--r--tasks/toolchains/androideabi.rake23
1 files changed, 23 insertions, 0 deletions
diff --git a/tasks/toolchains/androideabi.rake b/tasks/toolchains/androideabi.rake
new file mode 100644
index 000000000..9c6d423e2
--- /dev/null
+++ b/tasks/toolchains/androideabi.rake
@@ -0,0 +1,23 @@
+# Download and unarchive latest Android NDK from https://developer.android.com/tools/sdk/ndk/index.html
+# Make custom standalone toolchain as described here (android_ndk/docs/STANDALONE-TOOLCHAIN.html)
+# Please export custom standalone toolchain path
+# export ANDROID_STANDALONE_TOOLCHAIN=/tmp/android-14-toolchain
+
+# Add to your build_config.rb
+# MRuby::CrossBuild.new('androideabi') do |conf|
+# toolchain :androideabi
+# end
+
+MRuby::Toolchain.new(:androideabi) do |conf|
+ toolchain :gcc
+
+ ANDROID_STANDALONE_TOOLCHAIN = ENV['ANDROID_STANDALONE_TOOLCHAIN'] + '/bin/arm-linux-androideabi-'
+ SYSROOT = ENV['ANDROID_STANDALONE_TOOLCHAIN'] + '/sysroot'
+
+ [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
+ cc.command = ENV['CC'] || ANDROID_STANDALONE_TOOLCHAIN + 'gcc'
+ cc.flags = [ENV['CFLAGS'] || ['--sysroot ' + SYSROOT]]
+ end
+ conf.linker.command = ENV['LD'] || ANDROID_STANDALONE_TOOLCHAIN + 'gcc'
+ conf.archiver.command = ENV['AR'] || ANDROID_STANDALONE_TOOLCHAIN + 'ar'
+end