# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved. # License:: LGPL # $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Configure.rb 24394 2006-07-10T07:38:58.276210Z ertai $ module Uttk module Strategies # I run then check whether the configure stage of a compilation process fail. # I used in the _Package_ strategy to handle the configuration stage. class Configure < Strategy include Concrete CONFIGURE = /^configure(\.sh)?$/ CONFIGURE_INPUT = /^configure\.(ac|in)$/ def prologue super @runner = mk_system_runner @dir = @dir.to_path if script = self.class.have_configure?(@dir) flags = @flags.to_ocmd_args + @symtbl[:configure_flags].to_ocmd_args flags << "--prefix=#@prefix" if @prefix @symtbl[:configure_flags] = flags @configure = script.to_ocmd + @flags @configure.dir = @dir end end protected :prologue def run_impl @my_data = @configure.run @runner end protected :run_impl def assertion assert_cmd UM::StreamMatcher, @my_data, :exit => 0, :error => nil, :output => nil pass end protected :assertion def abort_hook @runner.abort @my_data if @runner and defined? @my_data super end protected :abort_hook def epilogue @my_data.clean if defined? @my_data super end protected :epilogue def self.have_configure_input? ( dir=Pathname.new('.') ) res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE_INPUT } (res.nil?) ? nil : dir + res end def self.have_configure? ( dir=Pathname.new('.') ) res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE } (res.nil?) ? nil : dir + res end attribute :dir, 'configure directory', :mandatory attribute :prefix, 'the prefix directory for --prefix' attribute :flags, 'set flags for the configure script' end # class Configure end # module Strategies end # module Uttk