Class: BuildTool::BuildSystem::Custom

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

Overview

Custom Build system.

Uses scripts do to the actual work.

Defined Under Namespace

Classes: CustomError

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

#initialize(*args) ⇒ Custom

Returns a new instance of Custom.



20
21
22
# File 'lib/build-tool/build-system/custom.rb', line 20

def initialize( *args )
    super( *args )
end

Instance Method Details

#configureObject



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

def configure
    check_build_directory( true )
    execute( "configure.sh" )
end

#configured?Boolean

Check if the module is configured

Returns:

  • (Boolean)


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

def configured?
    Pathname.new( build_directory ).exist?
end

#execute(script) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/build-tool/build-system/custom.rb', line 51

def execute( script )
    path = self.recipe.find_first_config_file( "custom/%s/%s" % [ self.module.name, script.to_s ] )
    if path.nil?
        raise CustomError, "Script configure.sh for %s not found!" % self.module.name
    end
    if !path.executable?
        raise CustomError, "Script %s not executable!" % path.to_s
    end
    command = "%s %s" % [ path.to_s, source_directory ]
    rc = self.module.environment.execute(
        command,
        build_directory,
        {
            'INSTALL_PREFIX' => install_prefix.to_s,
        }.merge(Hash[option_hash]))
    if rc != 0
        raise CustomError, "#{command.to_s} failed with error code #{rc}";
    end
end

#install(fast) ⇒ Object



71
72
73
# File 'lib/build-tool/build-system/custom.rb', line 71

def install( fast )
    execute( "install.sh" )
end

#install_fast_supported?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/build-tool/build-system/custom.rb', line 75

def install_fast_supported?
    false
end

#make(target = nil) ⇒ Object



79
80
81
# File 'lib/build-tool/build-system/custom.rb', line 79

def make( target = nil )
    execute( "compile.sh" )
end

#nameObject



33
34
35
# File 'lib/build-tool/build-system/custom.rb', line 33

def name
    "custom"
end

#option_stringObject



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

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

#reconfigureObject

Configure the module

Raises:

  • (NotImplementedError)


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

def reconfigure()
    raise NotImplementedError
end