Sha256: 9d52a5c5f7cda7f95d7d347693141227525d19e4169b8114280524c0891a169c

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

module Libv8
  module Compiler
    module_function

    def compiler
      unless defined?(@compiler)
        cc   = check_gcc_compiler "g++"

        # Check alternative GCC names
        # These are common on BSD's after
        # GCC has been installed by a port
        cc ||= check_gcc_compiler "g++44"
        cc ||= check_gcc_compiler "g++46"
        cc ||= check_gcc_compiler "g++48"

        if cc.nil?
          warn "Unable to find a compiler officially supported by v8."
          warn "It is recommended to use GCC v4.4 or higher"
          @compiler = cc = 'g++'
        end

        puts "Using compiler: #{cc}"
        @compiler = cc
      end

      @compiler
    end

    def check_gcc_compiler(name)
      compiler = `which #{name}`
      return nil unless $?.success?

      compiler.chomp!
      return nil unless `#{compiler} --version` =~ /([0-9]\.[0-9]\.[0-9])/

      return nil if $1 < "4.4"
      compiler
    end

    def check_clang_compiler(name)
      compiler = `which #{name}`
      return nil unless $?.success?
      compiler.chomp
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
libv8-3.11.8.13 ext/libv8/compiler.rb
libv8-3.11.8.12 ext/libv8/compiler.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/libv8-3.11.8.4/ext/libv8/compiler.rb
libv8-3.11.8.11 ext/libv8/compiler.rb
libv8-3.11.8.10 ext/libv8/compiler.rb
libv8-3.11.8.9 ext/libv8/compiler.rb
libv8-3.11.8.8 ext/libv8/compiler.rb
libv8-3.11.8.7 ext/libv8/compiler.rb
libv8-3.11.8.4 ext/libv8/compiler.rb
libv8-freebsd-3.11.8.3 ext/libv8/compiler.rb
libv8-3.11.8.3 ext/libv8/compiler.rb
libv8-3.11.8.1 ext/libv8/compiler.rb
libv8-3.11.8.0 ext/libv8/compiler.rb