Sha256: d7291401f5aa15d5f40ac76de247f1dcf2824ec9592b23719fd6587c03b2a630

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.3.1.2 lib/uttk/strategies/Configure.rb
uttk-0.3.6.1 lib/uttk/strategies/Configure.rb
uttk-0.3.5.0 lib/uttk/strategies/Configure.rb