Sha256: c9da209a94395b4f9f84168ee59b1cdc5f0a3299df9edab1c6a28e12faa938da

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 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 Architecture"
  end

  def extension
    '*.so'
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
picrate-1.3.0-java lib/picrate/native_folder.rb
picrate-1.2.4-java lib/picrate/native_folder.rb
picrate-1.2.3-java lib/picrate/native_folder.rb
picrate-1.2.2-java lib/picrate/native_folder.rb
picrate-1.2.1-java lib/picrate/native_folder.rb
picrate-1.2.0-java lib/picrate/native_folder.rb
picrate-1.1.0-java lib/picrate/native_folder.rb
picrate-1.0.0-java lib/picrate/native_folder.rb
picrate-0.9.0-java lib/picrate/native_folder.rb
picrate-0.8.0-java lib/picrate/native_folder.rb