Sha256: cafc51a7a89f03566eb90dc41d3d3dcfdbbfb050cfdd0a1595788f720da5c6f9

Contents?: true

Size: 1.76 KB

Versions: 5

Compression:

Stored size: 1.76 KB

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: Configure.rb 567 2005-04-13 08:00:06Z polrop $


module TTK

  module Strategies

    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 TTK

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/Configure.rb
ttk-0.1.580 lib/ttk/strategies/Configure.rb
ttk-0.2.1 lib/ttk/strategies/Configure.rb
ttk-0.1.579 lib/ttk/strategies/Configure.rb
ttk-0.2.0 lib/ttk/strategies/Configure.rb