Module: FFI::Platform

Defined in:
lib/tebako-runtime/pass-through/ffi-platform-stub.rb

Constant Summary collapse

ARCH =
case RbConfig::CONFIG["host_cpu"].downcase
when /amd64|x86_64|x64/
  "x86_64"
when /i\d86|x86|i86pc/
  "i386"
when /ppc64|powerpc64/
  "powerpc64"
when /ppc|powerpc/
  "powerpc"
when /sparcv9|sparc64/
  "sparcv9"
when /arm64|aarch64/ # MacOS calls it "arm64", other operating systems "aarch64"
  "aarch64"
when /^arm/
  if OS == "darwin" # Ruby before 3.0 reports "arm" instead of "arm64" as host_cpu on darwin
    "aarch64"
  else
    "arm"
  end
else
  RbConfig::CONFIG["host_cpu"].downcase
end
OS =
case RbConfig::CONFIG["host_os"].downcase
when /linux/
  "linux"
when /darwin/
  "darwin"
when /freebsd/
  "freebsd"
when /netbsd/
  "netbsd"
when /openbsd/
  "openbsd"
when /dragonfly/
  "dragonflybsd"
when /sunos|solaris/
  "solaris"
when /mingw|mswin/
  "windows"
else
  RbConfig::CONFIG["host_os"].downcase
end
LIBPREFIX =
case OS
when /windows|msys/
  ""
when /cygwin/
  "cyg"
else
  "lib"
end
LIBSUFFIX =
case OS
when /darwin/
  "dylib"
when /windows|cygwin|msys/
  "dll"
else
  # Punt and just assume a sane unix (i.e. anything but AIX)
  # when /linux|bsd|solaris/
  # "so"
  "so"
end
PASS_THROUGH =
true

Class Method Summary collapse

Class Method Details

.mac?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/tebako-runtime/pass-through/ffi-platform-stub.rb', line 98

def self.mac?
  RUBY_PLATFORM =~ /darwin/
end