class RBT::SimpleAppdirConfigure
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true )
click to toggle source
Public Instance Methods
padded_esystem(cmd)
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/simple_appdir_configure/simple_appdir_configure.rb, line 41 def reset super() infer_the_namespace # ======================================================================= # # === @cmd # ======================================================================= # @cmd = './configure'.dup end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/simple_appdir_configure/simple_appdir_configure.rb, line 101 def run menu # ======================================================================= # # Establish the cmd to use early on. # ======================================================================= # cmd = @cmd # ← This is the command that will be used. from = return_pwd # Default. _ = first_non_hyphen_argument? case _ # ======================================================================= # # === :pwd # ======================================================================= # when :pwd _ = return_pwd end _ = _.to_s.dup # Work on a copy here, anyway. unless _.empty? from = _.dup end from = File.basename(from) if File.exist?(from) and File.file?(from) # ===================================================================== # # Extract the archive in this case. # # Usage example: # # # # ===================================================================== # e "#{rev}Extracting the archive #{sdir(from)} next." RBT.extract_what_to(from) from = remove_archive_from_the_end( # Re-define from here. File.basename(from) ) opne "Entering the directory #{sdir(File.absolute_path(from))} next." cd from end if File.exist?(from) and !File.directory?(from) opne swarn('Currently this code only works on already '\ 'extracted directories.') exit end append_these_configure_options = ''.dup commandline_arguments = commandline_arguments? commandline_arguments.reject! {|entry| entry == _ } these_arguments = hyphen_arguments( commandline_arguments ).join(' ') unless these_arguments.rstrip.empty? append_these_configure_options << these_arguments.rstrip end # ======================================================================= # # Obtain the program-name and program-version next: # ======================================================================= # program_name = ProgramInformation.return_short_name(from).delete('-') program_version = ProgramInformation.return_version(from) # ======================================================================= # # === Determine the correct prefix next # # Next we must determine the proper prefix-target for PROGRAMS. # ======================================================================= # use_this_as_the_target_prefix = programs_directory?+ program_name.capitalize+'/'+ program_version+'/' # ======================================================================= # # We will pass this into RBT::CreateAppDirSkeleton next: # ======================================================================= # require 'rbt/create_app_dir_skeleton/create_app_dir_skeleton.rb' RBT.create_appdir_skeleton(use_this_as_the_target_prefix) if File.exist?('CMakeLists.txt') and !File.exist?('configure') and cmd.include?('configure') # ===================================================================== # # In this case there is no GNU configure script; only a cmake file # available, so use that. # ===================================================================== # cmd = 'cmake' # ======================================================================= # # Run the three sys-commands next, starting with "./configure". If # the working directory does NOT include a file called "configure", # but it DOES contain a file called 'autogen.sh' then we will first # invoke autogen before continuing. # ======================================================================= # elsif File.exist?('autogen.sh') and !File.exist?('configure') and cmd.include?('configure') e e 'No '+sfile('configure')+' file was found, but a file called' e sfile('autogen.sh')+' was found. Thus, invoking autogen next.' e padded_esystem 'sh autogen.sh' end cmd = cmd.dup if cmd.frozen? if cmd.include? 'cmake' # ===================================================================== # # Add the proper prefix. # ===================================================================== # cmd << ' -DCMAKE_INSTALL_PREFIX='+use_this_as_the_target_prefix else # ===================================================================== # # This part is valid for both GNU configure as well as meson. # ===================================================================== # cmd << ' --prefix='+use_this_as_the_target_prefix end unless cmd.include? append_these_configure_options cmd << " #{append_these_configure_options}" unless append_these_configure_options.empty? end if File.exist?('meson.build') and !File.exist?('configure') _ = "meson --prefix=#{use_this_as_the_target_prefix}".dup if append_these_configure_options and !append_these_configure_options.empty? _ << " #{append_these_configure_options}" end _ << " BUILD_DIRECTORY/" padded_esystem _ cd 'BUILD_DIRECTORY' run_ninja_command run_ninja_install_command return else padded_esystem cmd if cmd.start_with? 'meson' run_ninja_command run_ninja_install_command else # This clause is valid for GNU configure and cmake. cmd = 'make' padded_esystem(cmd) cmd = 'make install' padded_esystem(cmd) end end end
run_ninja_command()
click to toggle source