Class: BuildTool::BuildSystem::AutoConf

Inherits:
Base
  • Object
show all
Includes:
MJ::Tools::SubProcess
Defined in:
lib/build-tool/build-system/autoconf.rb

Defined Under Namespace

Classes: AutoConfError

Instance Attribute Summary

Attributes inherited from Base

#defaults, #feature, #module, #out_of_source

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #active?, #after_rebase, #append, #build_directory, #check_build_directory, #check_install_prefix, #dup, #env, #initialize, #install_prefix, #option_hash, #option_names, #option_set?, #parent, #prepare_for_installation, #prepend, #progressbar, #recipe, #remove_build_directory, #remove_source_directory, #set, #source_directory, #to_s

Constructor Details

This class inherits a constructor from BuildTool::BuildSystem::Base

Instance Method Details

#bootstrapObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/build-tool/build-system/autoconf.rb', line 50

def bootstrap
    if File.exist?( "#{source_directory}/configure" )
        return
    end

    logger.trace "Project has to be bootstrapped."
    if File.exist?( "#{source_directory}/Makefile.cvs" )
        rc = self.class.execute "make -f Makefile.cvs", source_directory, env
        if rc != 0
            raise AutoConfError, "'make -f Makefile.cvs' failed with error #{rc}!"
        end
        rc
    elsif File.exist?( "#{source_directory}/autogen.sh" )
        rc = self.class.execute "sh ./autogen.sh", source_directory, env
        if rc != 0
            raise AutoConfError, "'sh ./autogen.sh' failed with error #{rc}!"
        end
        rc
    elsif File.exist?( "#{source_directory}/bootstrap" )
        rc = self.class.execute "sh ./bootstrap", source_directory, env
        if rc != 0
            raise AutoConfError, "'sh ./bootstrap' failed with error #{rc}!"
        end
        rc
    else
        logger.trace "Trying autoconf. May fail!!"
        rc = self.class.execute "autoconf", source_directory, env
        if rc != 0
            raise AutoConfError, "'autoconf' failed with error #{rc}!"
        end
        rc
    end
end

#configureObject



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/build-tool/build-system/autoconf.rb', line 84

def configure
    check_build_directory( true )
    bootstrap
    opt = option_string
    opt += " --prefix=#{install_prefix.to_s}" if install_prefix
    rc = self.class.execute "#{source_directory}/configure #{opt}", build_directory, env
    if rc != 0
        raise AutoConfError, "configure failed with error #{rc}!"
    end
    rc
end

#configured?Boolean

Check if the module is configured

Returns:

  • (Boolean)


29
30
31
# File 'lib/build-tool/build-system/autoconf.rb', line 29

def configured?
    Pathname.new( build_directory ).join( 'Makefile' ).exist?
end

#install(fast) ⇒ Object



42
43
44
# File 'lib/build-tool/build-system/autoconf.rb', line 42

def install( fast )
    make( "install" )
end

#install_fast_supported?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/build-tool/build-system/autoconf.rb', line 46

def install_fast_supported?
    false
end

#intitialize(*args) ⇒ Object



16
17
18
19
# File 'lib/build-tool/build-system/autoconf.rb', line 16

def intitialize( *args )
    super( *args )
    @supported_options << 'libdir'
end

#make(target = nil) ⇒ Object



96
97
98
# File 'lib/build-tool/build-system/autoconf.rb', line 96

def make( target = nil )
    Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
end

#nameObject

ATTRIBUTES



24
25
26
# File 'lib/build-tool/build-system/autoconf.rb', line 24

def name
    "autoconf"
end

#option_stringObject



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/build-tool/build-system/autoconf.rb', line 100

def option_string
    arr = []
    option_names.each do |var|
        val = self[var]
        if val and !val.empty?
            arr << "--#{var}='#{val}'"
        else
            arr << "--#{var}"
        end
    end
    arr.join(" ")
end

#reconfigureObject

Configure the module



38
39
40
# File 'lib/build-tool/build-system/autoconf.rb', line 38

def reconfigure()
    configure
end