Sha256: a83eaa863980d4128f5bb4f14a405ef36db4fcb49d262b5f9da90be17d0020b8
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'rbconfig' # Utility to load native binaries on Java CLASSPATH # HACK until jruby returns a more specific 'host_os' than 'linux' class NativeFolder attr_reader :os, :bit LINUX_FORMAT = 'linux%s'.freeze ARM32 = '-armv6hf'.freeze # ARM64 = '-aarch64'.freeze WIN_FORMAT = 'windows%d'.freeze WIN_PATTERNS = [ /bccwin/i, /cygwin/i, /djgpp/i, /ming/i, /mswin/i, /wince/i ].freeze def initialize @os = RbConfig::CONFIG['host_os'].downcase @bit = java.lang.System.get_property('os.arch') end def name return 'macosx' if /darwin|mac/.match?(os) if /linux/.match?(os) return format(LINUX_FORMAT, '64') if /amd64/.match?(bit) return format(LINUX_FORMAT, ARM32) if /arm/.match?(bit) end if WIN_PATTERNS.any? { |pat| pat.match?(os) } return format(WINDOWS_FORMAT, '64') if /64/.match?(bit) return format(WINDOWS_FORMAT, '32') if /32/.match?(bit) end raise 'Unsupported Architecture' end def extension return '*.so' if /linux/.match?(os) return '*.dll' if WIN_PATTERNS.any? { |pat| pat =~ os } '*.dylib' # MacOS end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jruby_art-1.5.1 | lib/jruby_art/native_folder.rb |