diff --git a/lib/rscons.rb b/lib/rscons.rb index 8273e42..d6884a9 100644 --- a/lib/rscons.rb +++ b/lib/rscons.rb @@ -3,6 +3,7 @@ require_relative "rscons/application" require_relative "rscons/build_target" require_relative "rscons/builder" require_relative "rscons/cache" +require_relative "rscons/configure_op" require_relative "rscons/environment" require_relative "rscons/job_set" require_relative "rscons/script" diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index 63af893..bdb97e5 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -76,37 +76,12 @@ module Rscons # # @return [void] def configure + co = ConfigureOp.new("#{@build_dir}/configure") if ccc = @script.check_c_compiler - check_c_compiler(ccc) + co.check_c_compiler(ccc) end end - # Configure: check for a working C compiler. - # - # @param ccc [Array] - # C compiler(s) to check for. - # - # @return [void] - def check_c_compiler(ccc) - if ccc.empty? - # Default C compiler search array. - ccc = %w[gcc clang] - end - cc = ccc.find do |cc| - test_c_compiler(cc) - end - end - - # Test a C compiler. - # - # @param cc [String] - # C compiler to test. - # - # @return [Boolean] - # Whether the C compiler tested successfully. - def test_c_compiler(cc) - end - # Determine the number of threads to use by default. # # @return [Integer] diff --git a/lib/rscons/configure_op.rb b/lib/rscons/configure_op.rb new file mode 100644 index 0000000..89d36a7 --- /dev/null +++ b/lib/rscons/configure_op.rb @@ -0,0 +1,45 @@ +require "fileutils" + +module Rscons + # Class to manage a configure operation. + class ConfigureOp + + # Create a ConfigureOp. + # + # @param work_dir [String] + # Work directory for configure operation. + def initialize(work_dir) + @work_dir = work_dir + FileUtils.mkdir_p(@work_dir) + end + + # Check for a working C compiler. + # + # @param ccc [Array] + # C compiler(s) to check for. + # + # @return [void] + def check_c_compiler(ccc) + if ccc.empty? + # Default C compiler search array. + ccc = %w[gcc clang] + end + cc = ccc.find do |cc| + test_c_compiler(cc) + end + end + + private + + # Test a C compiler. + # + # @param cc [String] + # C compiler to test. + # + # @return [Boolean] + # Whether the C compiler tested successfully. + def test_c_compiler(cc) + end + + end +end