class RBT::Action::SimpleAppdirConfigure
Constants
- BUILD_DIRECTORY
#¶ ↑
BUILD_DIRECTORY
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( i = nil, run_already = true, &block )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb, line 35 def initialize( i = nil, run_already = true, &block ) reset set_commandline_arguments(i) case run_already # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet run_already = false end run if run_already end
Public Instance Methods
do_use_a_build_directory()
click to toggle source
make_use_of_meson()
click to toggle source
padded_esystem(cmd)
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Action#reset
# File lib/rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb, line 55 def reset super() infer_the_namespace # ======================================================================= # # === @cmd # ======================================================================= # @cmd = './configure'.dup # ======================================================================= # # === :use_a_build_directory # ======================================================================= # @internal_hash[:use_a_build_directory] = false end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb, line 181 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)} #{rev}next." action(:extract_what_to, from) to = log_dir?+ remove_archive_from_the_end(File.basename(from))+'/' opne "#{rev}Entering the directory "\ "#{sdir(File.absolute_path(to))} #{rev}next." cd to 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 == _ or entry.start_with?('--down') or entry.start_with?('--builddir') } 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: # ======================================================================= # action(:create_appdir_skeleton, use_this_as_the_target_prefix) # ======================================================================= # # === Handle cmake next # ======================================================================= # 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 opne rev+'No '+sfile('configure')+rev+' file was found, but a file called' opne rev+sfile('autogen.sh')+ "#{rev} 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') do_use_a_build_directory _ = "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}" if use_a_build_directory? padded_esystem _ cd BUILD_DIRECTORY if use_a_build_directory? run_ninja_command run_ninja_install_command return else # ===================================================================== # # Run the cmd via esystem() next: # ===================================================================== # if use_build_directory? mkdir(BUILD_DIRECTORY) unless File.directory?(BUILD_DIRECTORY) cd(BUILD_DIRECTORY) unless return_pwd.include?(BUILD_DIRECTORY) end 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
run_ninja_install_command()
click to toggle source
show_help()
click to toggle source
#¶ ↑
show_help
(help tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb, line 118 def show_help opne "#{rev}These options are currently available:" e e steelblue(' --down # pass one "." to the configure or cmake or meson script') e steelblue(' --builddir # use a build directory') e steelblue(' --use-cmake') e steelblue(' --use-meson') e rev end