Sha256: 5b24a420b0c189d9907ca342aeb25c301f6d2f2f12f705f7129f7661d2459cd8

Contents?: true

Size: 1.17 KB

Versions: 37

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/
        "x86"
      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

37 entries across 37 versions & 2 rubygems

Version Path
skylight-1.0.1 lib/skylight/util/platform.rb
skylight-1.0.0 lib/skylight/util/platform.rb
skylight-0.10.6 lib/skylight/util/platform.rb
skylight-1.0.0.beta5 lib/skylight/util/platform.rb
skylight-0.10.5 lib/skylight/util/platform.rb
skylight-0.10.4 lib/skylight/util/platform.rb
skylight-1.0.0.beta4 lib/skylight/util/platform.rb
skylight-1.0.0.beta3 lib/skylight/util/platform.rb
skylight-0.10.3 lib/skylight/util/platform.rb
skylight-0.10.2 lib/skylight/util/platform.rb
skylight-1.0.0.beta2 lib/skylight/util/platform.rb
skylight-0.10.0 lib/skylight/util/platform.rb
skylight-0.9.4 lib/skylight/util/platform.rb
skylight-0.9.3 lib/skylight/util/platform.rb
skylight-0.9.2 lib/skylight/util/platform.rb
skylight-0.9.1 lib/skylight/util/platform.rb
skylight-0.9.0 lib/skylight/util/platform.rb
skylight-0.8.1 lib/skylight/util/platform.rb
skylight-0.8.0 lib/skylight/util/platform.rb
skylight-0.8.0.beta.3 lib/skylight/util/platform.rb