| Server IP : 217.160.0.244 / Your IP : 216.73.216.36 Web Server : Apache System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64 User : u100174116 ( 6746176) PHP Version : 8.5.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/ruby/3.3.0/rubygems/ext/cargo_builder/ |
Upload File : |
# frozen_string_literal: true
class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# Converts Ruby link flags into something cargo understands
class LinkFlagConverter
FILTERED_PATTERNS = [
/compress-debug-sections/, # Not supported by all linkers, and not required for Rust
].freeze
def self.convert(arg)
return [] if FILTERED_PATTERNS.any? {|p| p.match?(arg) }
case arg.chomp
when /^-L\s*(.+)$/
["-L", "native=#{$1}"]
when /^--library=(\w+\S+)$/, /^-l\s*(\w+\S+)$/
["-l", $1]
when /^-l\s*([^:\s])+/ # -lfoo, but not -l:libfoo.a
["-l", $1]
when /^-F\s*(.*)$/
["-l", "framework=#{$1}"]
else
["-C", "link-args=#{arg}"]
end
end
end
end