Created
May 5, 2018 02:29
-
-
Save pulsejet/7b3ccb77c0f67e0f268fc5b43b0ff4cc to your computer and use it in GitHub Desktop.
Toolchain for building mruby with emscripten
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample usage | |
MRuby::CrossBuild.new('emscripten') do |conf| | |
toolchain :emscripten | |
# conf.gem :github => 'mattn/mruby-onig-regexp' | |
# conf.gem :github => 'take-cheeze/mruby-marshal' | |
conf.gembox 'default' | |
conf.cc do |cc| | |
cc.flags = [ENV['CFLAGS'] || %w()] | |
cc.compile_options = "%{flags} -O3 -MMD -o %{outfile} -c %{infile} -I$HOME/dev/onig/src" | |
# cc.defines = %w(MRB_INTEGER_DIVISION) | |
end | |
# conf.cxx.defines = %w(MRB_INTEGER_DIVISION) | |
conf.linker.command = 'emcc' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MRuby::Toolchain.new(:emscripten) do |conf| | |
toolchain :clang | |
conf.compilers.each do |cc| | |
cc.command = "emcc" | |
cc.flags.flatten! | |
cc.flags.reject! { |v| v =~ /^-g/ } | |
end | |
conf.archiver.command = "emar" | |
conf.cxx.command = "em++" | |
conf.linker.command = "emcc" | |
conf.linker.libraries.reject! { |v| v == 'm' } | |
conf.exts do |v| | |
v.executable = '.js' | |
v.library = '.a' | |
v.object = '.o.bc' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment