configure: fix handling build_dir and prefix options

This commit is contained in:
Josh Holtrop 2018-11-29 22:06:36 -05:00
parent 1ecce7e99e
commit 0e27e967d0
3 changed files with 8 additions and 10 deletions

View File

@ -18,8 +18,6 @@ module Rscons
def initialize def initialize
@n_threads = determine_n_threads @n_threads = determine_n_threads
@vars = VarSet.new @vars = VarSet.new
@build_dir = "build"
@prefix = "/usr/local"
end end
# Run the specified operation. # Run the specified operation.
@ -78,6 +76,9 @@ module Rscons
# #
# @return [void] # @return [void]
def configure(options) def configure(options)
# Default options.
options[:build_dir] ||= "build"
options[:prefix] ||= "/usr/local"
cache = Cache.instance cache = Cache.instance
cache.configuration_data = {} cache.configuration_data = {}
if project_name = @script.project_name if project_name = @script.project_name
@ -85,9 +86,10 @@ module Rscons
else else
$stdout.puts "Configuring project..." $stdout.puts "Configuring project..."
end end
Ansi.write($stdout, "Setting build directory... ", :green, @build_dir, :reset, "\n") Ansi.write($stdout, "Setting build directory... ", :green, options[:build_dir], :reset, "\n")
Ansi.write($stdout, "Setting prefix... ", :green, options[:prefix], :reset, "\n")
rv = 0 rv = 0
co = ConfigureOp.new("#{@build_dir}/configure") co = ConfigureOp.new("#{options[:build_dir]}/configure")
begin begin
@script.configure(co) @script.configure(co)
rescue ConfigureOp::ConfigureFailure rescue ConfigureOp::ConfigureFailure

View File

@ -125,10 +125,7 @@ module Rscons
end end
def parse_configure_args(argv) def parse_configure_args(argv)
options = { options = {}
build_dir: "build",
prefix: "/usr/local",
}
OptionParser.new do |opts| OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]" opts.banner = "Usage: #{$0} [options]"

View File

@ -1874,8 +1874,7 @@ EOF
expect(result.stderr).to eq "" expect(result.stderr).to eq ""
expect(result.status).to eq 0 expect(result.status).to eq 0
expect(result.stdout).to match /Configuring configure test\.\.\./ expect(result.stdout).to match /Configuring configure test\.\.\./
#TODO expect(result.stdout).to match /Setting build directory\.\.\. bb/
#expect(result.stdout).to match /Setting build directory\.\.\. bb/
expect(result.stdout).to match /Checking for C compiler\.\.\. gcc/ expect(result.stdout).to match /Checking for C compiler\.\.\. gcc/
expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. g++/ expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. g++/
expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/ expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/