Skip to content

Commit

Permalink
Add androideabi toolchain rake task (Build mruby with Android NDK)
Browse files Browse the repository at this point in the history
  • Loading branch information
shtirlic committed Feb 3, 2013
1 parent dfff732 commit 1af61f2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tasks/toolchains/androideabi.rake
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1af61f2

Please sign in to comment.