Skip to content

Commit

Permalink
install the binary based on the arch/os
Browse files Browse the repository at this point in the history
  • Loading branch information
hone committed Dec 3, 2015
1 parent 55934ba commit e6048bf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,17 @@
EOF

bindir = RbConfig::CONFIG['bindir']
FileUtils.cp("mruby/build/x86_64-apple-darwin14/bin/mjruby", bindir)
arch = "#{ENV_JAVA['os.arch']}-#{ENV_JAVA['os.name']}"

binary =
case arch
when /^(amd64|x86_64)-Linux/ then "mruby/build/x86_64-pc-linux-gnu/bin/mjruby"
when /^i\d86-Linux/ then "mruby/build/i686-pc-linux-gnu/bin/mjruby"
when /^x86_64-Mac OS X/ then "mruby/build/x86_64-apple-darwin14/bin/mjruby"
when /^i\d86-Mac OS X/ then "mruby/build/x86_64-apple-darwin14/bin/mjruby"
when /^x86-Windows/ then "mruby/build/i686-w64-mingw32/bin/mjruby"
when /^(amd64|x86_64)-Windows/ then "mruby/build/x86_64-w64-mingw32/bin/mjruby"
else nil
raise "Could not find appropriate architecture for '#{arch}'"
end
FileUtils.cp(binary, bindir)

0 comments on commit e6048bf

Please sign in to comment.