class RBT::Actions::Configure

Constants

REGEX_TO_CAPTURE_THE_PREFIX_FOR_CMAKE_BUILD_TYPES
#

REGEX_TO_CAPTURE_THE_PREFIX_FOR_CMAKE_BUILD_TYPES

#
REGEX_TO_CAPTURE_THE_PREFIX_FOR_CONFIGURE_BUILD_TYPES
#

REGEX_TO_CAPTURE_THE_PREFIX_FOR_CONFIGURE_BUILD_TYPES

#

Public Class Methods

new( i = ARGV, run_already = true ) { || ... } click to toggle source
#

initialize

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 40
def initialize(
    i           = ARGV,
    run_already = true,
    &block
  )
  reset # Must come before set_commandline_arguments().
  set_commandline_arguments(i)
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :be_extra_verbose
    # ===================================================================== #
    when :be_extra_verbose
      @internal_hash[:be_extra_verbose] = true
    end
  end
  run if run_already
end

Public Instance Methods

automatically_try_to_determine_the_real_build_type() click to toggle source
#

automatically_try_to_determine_the_real_build_type

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 224
def automatically_try_to_determine_the_real_build_type
  build_system = RBT.infer_build_system
  case build_system
  # ======================================================================= #
  # === cmake
  # ======================================================================= #
  when 'cmake'
    set_build_type_to_use(:cmake)
  end
end
be_extra_verbose?() click to toggle source
#

be_extra_verbose?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 85
def be_extra_verbose?
  @internal_hash[:be_extra_verbose]
end
build_type_is_cmake?() click to toggle source
#

build_type_is_cmake?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 113
def build_type_is_cmake?
  build_type_to_use? == :cmake
end
build_type_is_configure?() click to toggle source
#

build_type_is_configure?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 106
def build_type_is_configure?
  build_type_to_use? == :configure
end
build_type_to_use?() click to toggle source
#

build_type_to_use?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 92
def build_type_to_use?
  @internal_hash[:build_type_to_use]
end
do_compile_statically( be_verbose = true ) click to toggle source
#

do_compile_statically

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 186
def do_compile_statically(
    be_verbose = true
  )
  if be_verbose
    e "#{rev}Enabling static compilation mode next - at the least trying to."
  end
  ENV['CFLAGS'] = ENV['CFLAGS']+' -static -g' # This works as-is; determined in June 2023.
end
do_run_the_sys_command( i = @internal_hash[:sys_command] ) click to toggle source
#

do_run_the_sys_command

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 212
def do_run_the_sys_command(
    i = @internal_hash[:sys_command] # This is our default here.
  )
  if be_extra_verbose?
    e "#{rev}The current working directory is `#{sdir(return_pwd)}#{rev}`."
  end
  coloured_and_padded_esystem(i) { :dodgerblue }
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
program_version?() click to toggle source
#

program_version?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 205
def program_version?
  @internal_hash[:program_version]
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Action#reset
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 66
def reset
  super()
  # ======================================================================= #
  # === :try_to_use_configure_options
  # ======================================================================= #
  @internal_hash[:try_to_use_configure_options] = true
  # ======================================================================= #
  # === :be_extra_verbose
  # ======================================================================= #
  @internal_hash[:be_extra_verbose] = false
  # ======================================================================= #
  # === :build_type_to_use
  # ======================================================================= #
  set_build_type_to_use(:configure)
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 238
def run
  cwd = return_pwd
  work_on_this_program = File.basename(cwd)
  @internal_hash[:program_name]    = ProgramInformation.program_name(work_on_this_program)
  @internal_hash[:program_version] = ProgramInformation.program_version(work_on_this_program)
  cookbook = RBT.return_cookbook_for(@internal_hash[:program_name])
  automatically_try_to_determine_the_real_build_type
  case build_type_to_use?
  # ======================================================================= #
  # === :configure
  # ======================================================================= #
  when :configure,
       :default
    _ = './configure'.dup
    _ << ' --prefix=/usr/'
  # ======================================================================= #
  # === :cmake
  # ======================================================================= #
  when :cmake
    _ = 'cmake'.dup
    _ << ' -DCMAKE_INSTALL_PREFIX=/usr/'
  else
    ewarn "Unknown build type: #{steelblue(build_type_to_use?)}"
    exit
  end
  if try_to_use_configure_options?
    _ << " #{cookbook.configure_options?}"
    _.rstrip! # We have to do this in case the above returns an empty String.
  end
  # ======================================================================= #
  # Use a build directory in this event.
  # ======================================================================= #
  if cookbook.use_build_directory?
    name_of_the_build_directory = cookbook.name_of_the_build_directory?
    if name_of_the_build_directory.nil?
      name_of_the_build_directory = 'BUILD/'
    end
    mkdir(name_of_the_build_directory)
    cd(name_of_the_build_directory)
    if build_type_is_configure?
      _.prepend('.')
    elsif build_type_is_cmake?
      _ << (' ..')
    end
  end
  @internal_hash[:sys_command] = _
  menu(commandline_arguments?)
  do_run_the_sys_command(@internal_hash[:sys_command])
end
set_build_type_to_use(i) click to toggle source
#

set_build_type_to_use

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 99
def set_build_type_to_use(i)
  @internal_hash[:build_type_to_use] = i.to_sym # Always use Symblls here.
end
try_to_use_configure_options?() click to toggle source
#

try_to_use_configure_options?

#
# File lib/rbt/actions/individual_actions/configure/configure.rb, line 198
def try_to_use_configure_options?
  @internal_hash[:try_to_use_configure_options]
end