Sha256: 66707ce7f0c8cbee5d6039ea163cae1501adab6f7dd21dd44139d211be7c5294

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

Stored size: 660 Bytes

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

  def initialize
    @os = RbConfig::CONFIG['host_os'].downcase
    @bit = java.lang.System.get_property('os.arch')
  end

  def name
    if /linux/.match?(os)
      return format(LINUX_FORMAT, '64') if /amd64/.match?(bit)
      return format(LINUX_FORMAT, ARM32) if /arm/.match?(bit)
    end
    raise RuntimeError, "Unsupported Archicture"
  end

  def extension
    '*.so'
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
picrate-0.7.0-java lib/picrate/native_folder.rb
picrate-0.6.0-java lib/picrate/native_folder.rb
picrate-0.5.0-java lib/picrate/native_folder.rb
picrate-0.4.3-java lib/picrate/native_folder.rb
picrate-0.4.2-java lib/picrate/native_folder.rb
picrate-0.4.1-java lib/picrate/native_folder.rb
picrate-0.4.0-java lib/picrate/native_folder.rb
picrate-0.3.0-java lib/picrate/native_folder.rb
picrate-0.2.0-java lib/picrate/native_folder.rb
picrate-0.1.0-java lib/picrate/native_folder.rb