Sha256: 06ea8b53ce8e92fa2616514881db14c29cc09737b4c0bb895adbf7b8e5c81d08

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'rbconfig'

# Used from extconf and to load libskylight
module Skylight
  module Util
    module Platform
      # Normalize the platform OS
      OS = case os = RbConfig::CONFIG['host_os'].downcase
      when /linux/
        "linux"
      when /darwin/
        "darwin"
      when /freebsd/
        "freebsd"
      when /netbsd/
        "netbsd"
      when /openbsd/
        "openbsd"
      when /sunos|solaris/
        "solaris"
      when /mingw|mswin/
        "windows"
      else
        os
      end

      # Normalize the platform CPU
      ARCH = case cpu = RbConfig::CONFIG['host_cpu'].downcase
      when /amd64|x86_64/
        "x86_64"
      when /i?86|x86|i86pc/
        "i386"
      when /ppc|powerpc/
        "powerpc"
      when /^arm/
        "arm"
      else
        cpu
      end

      LIBEXT = case OS
      when /darwin/
        'dylib'
      when /linux|bsd|solaris/
        'so'
      when /windows|cygwin/
        'dll'
      else
        'so'
      end

      TUPLE = "#{ARCH}-#{OS}"

      def self.tuple
        TUPLE
      end

      def self.libext
        LIBEXT
      end

      def self.dlext
        RbConfig::CONFIG['DLEXT']
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
skylight-0.4.0 lib/skylight/util/platform.rb
skylight-0.4.0.beta2 lib/skylight/util/platform.rb
skylight-0.4.0.beta1 lib/skylight/util/platform.rb
skylight-0.4.0.alpha1 lib/skylight/util/platform.rb