Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

add --enable-flags, added support string values of flags #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/curl_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def build_protocols(protocols)
end

def build_flags(flags)
flags.collect { |flag, enabled| enabled ? "--with-#{flag}" : "--without-#{flag}" }
flags.collect { |flag, enabled| enabled ? "--with-#{flag}#{"="+enabled if enabled!=true}" : "--without-#{flag}" }
end

def filter_valid_archs(archs)
Expand Down
16 changes: 16 additions & 0 deletions lib/curl_builder/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ def parse(args)
end
end


flags_defalt = ""
flags.select { |k, value| value }.each do |flag|
flags_defalt += flag[0] + (flag[1].is_a?(String)? ("=" + flag[1].to_s): "") + ","
end
parser.on("--enable-flags A,B=string,C",
Array,
"Enables a list of flags with values",
" Defaults to " + flags_defalt) do |enabled|
enabled.each do |k|
flag = k.split("=")
flags[flag[0]] = flag[1]? flag[1] :true
end
end


parser.on("--sdk-version SDK",
"Use specific SDK version",
" Defaults to #{param(setup[:sdk_version])}") do |sdk|
Expand Down