require 'mj/tools/subprocess' require 'build-tool/build-system/base' module BuildTool; module BuildSystem # # Custom Build system. # # Uses scripts do to the actual work. # class Custom < Base include MJ::Tools::SubProcess class CustomError < BuildTool::Error; end def initialize( *args ) super( *args ) end # ### ATTRIBUTES # # Check if the module is configured def configured? end def name "custom" end # ### METHODS # # Configure the module def reconfigure() raise NotImplementedError end def configure check_build_directory( true ) execute( "configure.sh" ) end 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 def install( fast ) execute( "install.sh" ) end def install_fast_supported? false end def make( target = nil ) execute( "compile.sh" ) end def option_string arr = [] option_names.each do |var| val = self[var] arr << "-D#{var}='#{val}'" end arr.join(" ") end end # class Custom end; end # module BuildTool::BuildSystem