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.49 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.48 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.47 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.46 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.45 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.44 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.43 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.42 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.41 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.40 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.39 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.38 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.37 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.36 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.35 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.34 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.33 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.32 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.31 lib/rb_sys/cargo_builder/link_flag_converter.rb
rb_sys-0.9.30 lib/rb_sys/cargo_builder/link_flag_converter.rb