diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-01-06 12:23:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-01-06 20:00:53 +0900 |
commit | b94656147bc2048fd183bc0e0d1e5bb3d230a4b1 (patch) | |
tree | 9e267874a79c2ea3bb5d1bb9b75c7d3ad1a715ee /lib/mkmf.rb | |
parent | cd7e14da4ed7d96c4cfffa222f022f335a4e43cd (diff) |
mkmf.rb: Refactor splitting configure_args and remove duplicate code
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7076
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r-- | lib/mkmf.rb | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 0fbc1cc2e5..e4a6fc984f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -89,26 +89,16 @@ module MakeMakefile unless defined? $configure_args $configure_args = {} - args = CONFIG["configure_args"] - if ENV["CONFIGURE_ARGS"] - args << " " << ENV["CONFIGURE_ARGS"] + args = CONFIG["configure_args"].shellsplit + if arg = ENV["CONFIGURE_ARGS"] + args.push(*arg.shellsplit) end - for arg in Shellwords::shellwords(args) + args.delete_if {|a| /\A--(?:top(?:src)?|src|cur)dir(?=\z|=)/ =~ a} + for arg in args.concat(ARGV) arg, val = arg.split('=', 2) next unless arg arg.tr!('_', '-') - if arg.sub!(/^(?!--)/, '--') - val or next - arg.downcase! - end - next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg - $configure_args[arg] = val || true - end - for arg in ARGV - arg, val = arg.split('=', 2) - next unless arg - arg.tr!('_', '-') - if arg.sub!(/^(?!--)/, '--') + if arg.sub!(/\A(?!--)/, '--') val or next arg.downcase! end |