123456789_123456789_123456789_123456789_123456789_

Class: Gem::Ext::CargoBuilder::LinkFlagConverter

Relationships & Source Files
Inherits: Object
Defined in: lib/rubygems/ext/cargo_builder/link_flag_converter.rb

Overview

Converts Ruby link flags into something cargo understands

Class Method Summary

Class Method Details

.convert(arg)

[ GitHub ]

  
# File 'lib/rubygems/ext/cargo_builder/link_flag_converter.rb', line 6

def self.convert(arg)
  case arg.chomp
  when /^-L\s*(.+)$/
    ["-L", "native=#{$1}"]
  when /^--library=(\w\S)$/, /^-l\s*(\w\S)$/
    ["-l", $1]
  when /^-l\s*:lib(\S+).a$/
    ["-l", "static=#{$1}"]
  when /^-l\s*:lib(\S+).(so|dylib|dll)$/
    ["-l", "dylib=#{$1}"]
  when /^-F\s*(.*)$/
    ["-l", "framework=#{$1}"]
  else
    ["-C", "link_arg=#{arg}"]
  end
end