lib/autobuild/packages/autotools.rb in autobuild-1.7.10 vs lib/autobuild/packages/autotools.rb in autobuild-1.7.11.rc1

- old
+ new

@@ -26,33 +26,52 @@ # To override this default behaviour on a per-package basis, use Autotools#use # class Autotools < Configurable attr_accessor :using attr_accessor :configureflags + attr_accessor :aclocal_flags + attr_accessor :autoheader_flags + attr_accessor :autoconf_flags + attr_accessor :automake_flags @builddir = 'build' - + def configurestamp; "#{builddir}/config.status" end def initialize(options) @using = Hash.new @configureflags = [] - + @aclocal_flags = Array.new + @autoheader_flags = Array.new + @autoconf_flags = Array.new + @automake_flags = Array.new + super end - - # Declare that the given target can be used to generate documentation - def with_doc(target = 'doc') - task "#{name}-doc" => configurestamp - doc_task do - progress_start "generating documentation for %s", :done_message => 'generated_documentation for %s' do - Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target, :working_directory => builddir) + + def common_utility_handling(utility, target) + utility.task do + progress_start "generating documentation for %s", :done_message => 'generated documentation for %s' do + if internal_doxygen_mode? + run_doxygen + else + Subprocess.run(self, utility.name, Autobuild.tool(:make), "-j#{parallel_build_level}", target, :working_directory => builddir) + end + yield if block_given? end - yield if block_given? end end + # Declare that the given target can be used to generate documentation + def with_doc(target = 'doc', &block) + common_utility_handling(doc_utility, target, &block) + end + + def with_tests(target = 'test') + common_utility_handling(test_utility, target, &block) + end + # Overrides the default behaviour w.r.t. autotools script generation # # Use it like that: # * to force a generation step (skipping autodetection), do # pkg.use <program> => true @@ -112,11 +131,11 @@ end FileUtils.rm_f configurestamp end - def import + def import(only_local=false) # We force a regen after the first checkout. The issue is that # autotools is less robust than it should, and very often it is # better to generate the build system for the system on which we # must build # @@ -245,11 +264,11 @@ tool_program = if tool_flag.respond_to?(:to_str) tool_flag.to_str else; Autobuild.tool(tool) end - Subprocess.run(self, 'configure', tool_program) + Subprocess.run(self, 'configure', tool_program, *send("#{tool}_flags")) end end end end end @@ -267,10 +286,10 @@ if force_config_status command << "--no-create" end command << "--prefix=#{prefix}" command += Array[*configureflags] - + progress_start "configuring autotools for %s", :done_message => 'configured autotools for %s' do Subprocess.run(self, 'configure', *command) end end end