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, MakeError

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, #dup, #env, #initialize, #install_prefix, #option_hash, #option_names, #option_set?, #parent, #prepend, #recipe, #remove_build_directory, #set, #source_directory, #to_s

Constructor Details

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

Instance Method Details

#bootstrapObject



47
48
49
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
# File 'lib/build-tool/build-system/autoconf.rb', line 47

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



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/build-tool/build-system/autoconf.rb', line 81

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)


26
27
28
# File 'lib/build-tool/build-system/autoconf.rb', line 26

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

#do_make(target = nil) ⇒ Object



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

def do_make( target = nil )
    rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
    if rc != 0
        raise MakeError, "make #{target || "" } failed with error code #{rc}";
    end
    rc
end

#install(fast) ⇒ Object



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

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

#install_fast_supported?Boolean

Returns:

  • (Boolean)


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

def install_fast_supported?
    false
end

#intitialize(*args) ⇒ Object



13
14
15
16
# File 'lib/build-tool/build-system/autoconf.rb', line 13

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

#make(target = nil) ⇒ Object



109
110
111
# File 'lib/build-tool/build-system/autoconf.rb', line 109

def make( target = nil )
    do_make( target )
end

#nameObject

ATTRIBUTES



21
22
23
# File 'lib/build-tool/build-system/autoconf.rb', line 21

def name
    "autoconf"
end

#option_stringObject



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/build-tool/build-system/autoconf.rb', line 113

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

#reconfigureObject

Configure the module



35
36
37
# File 'lib/build-tool/build-system/autoconf.rb', line 35

def reconfigure()
    configure
end