Sha256: 95d6b165e10dbb4c747c962a53cb97892760dac537e93e07e9403db3d56cd104

Contents?: true

Size: 642 Bytes

Versions: 50

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

module RbSys
  class CargoBuilder
    # Converts Ruby link flags into something cargo understands
    class LinkFlagConverter
      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
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
rb_sys-0.9.29 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.28 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.27 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.26 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.25 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.24 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.23 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.22 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.21 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.20 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.19 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.18 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.17 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.16 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.15 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.14 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.1.14 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.13 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.12 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.11 lib/rb_sys/cargo_builder/link_flag_converter.rb