# 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 22112 2006-02-22T08:30:11.236459Z pouillar $ 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 < Proxy include Concrete CONFIGURE = /^configure(\.sh)?$/ CONFIGURE_INPUT = /^configure\.(ac|in)$/ def mk_command ( script ) cmd = script.to_s cmd += " --prefix=#@prefix" if @prefix if @flags.is_a? Array @flags = @flags.join(' ') else @flags = @flags.to_s end symtbl_configure_flags = @symtbl[:configure_flags] @flags += ' ' + symtbl_configure_flags unless symtbl_configure_flags.nil? @symtbl[:configure_flags] = @flags cmd + ' ' + @flags end def prologue super @dir = Pathname.new(@dir) if script = self.class.have_configure?(@dir) create(Cmd) do |test| test.name = 'command' test.exit = 0 test.dir = @dir test.command = mk_command(script) test.verbose_print = true test.reject :strategy, :dir end end end 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