class RBT::Compile

Constants

ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM
#

ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM

If the following constant is set to true, then the RBT project will also attempt to automatically install this given ruby-gem.

That way you can easily batch-update all registered rubygems; they must have a corresponding .yml file that is registered in the respective .yml file at hand, though.

#
ARRAY_CHECK_FOR_BINARY_DUPLICATES_OPTIONS
#

ARRAY_CHECK_FOR_BINARY_DUPLICATES_OPTIONS

This constant shall include regexes that check for the following commandline options:

rbt --check-for-binary-duplicates
rbt --report-binary-duplicates
rbt --report-duplicates
rbt --binary-duplicates
rbt --duplicate-binaries
#
ARRAY_FEEDBACK_CONFIGURE_OPTIONS
#

ARRAY_FEEDBACK_CONFIGURE_OPTIONS

#
ARRAY_FEEDBACK_MAKE_OPTIONS
#

ARRAY_FEEDBACK_MAKE_OPTIONS

#
ARRAY_HELP_ALL_AVAILABLE_PROGRAMS
#

ARRAY_HELP_ALL_AVAILABLE_PROGRAMS

#
ARRAY_HELP_AVAILABLE_PROGRAM_VERSIONS
#

ARRAY_HELP_AVAILABLE_PROGRAM_VERSIONS

#
ARRAY_HELP_CHECK_ALL_TAGS_OPTIONS
#

ARRAY_HELP_CHECK_ALL_TAGS_OPTIONS

#
ARRAY_HELP_CONFIG_OPTIONS
#

ARRAY_HELP_CONFIG_OPTIONS

These options are valid for when the user wishes to feedback the main configuration options.

#
ARRAY_HELP_CREATE_SHELLSCRIPT_OPTIONS
#

ARRAY_HELP_CREATE_SHELLSCRIPT_OPTIONS

#
ARRAY_HELP_DISABLE_AUTOGEN
#

ARRAY_HELP_DISABLE_AUTOGEN

#
ARRAY_HELP_DONT_KEEP_EXTRACTED_OPTIONS
#

ARRAY_HELP_DONT_KEEP_EXTRACTED_OPTIONS

Allowed options for when we wish to keep the extracted archive.

#
ARRAY_HELP_DOWNLOAD_THE_SOURCE_OPTIONS
#

ARRAY_HELP_DOWNLOAD_THE_SOURCE_OPTIONS

All download options are stored here.

#
ARRAY_HELP_DO_COMPILE_IN_A_NON_TRADITIONAL_WAY_OPTIONS
#

ARRAY_HELP_DO_COMPILE_IN_A_NON_TRADITIONAL_WAY_OPTIONS (ntrad tag)

These are the options for when you wish to install in an app-dir like manner.

#
ARRAY_HELP_DO_COMPILE_IN_A_TRADITIONAL_WAY_OPTIONS
#

ARRAY_HELP_DO_COMPILE_IN_A_TRADITIONAL_WAY_OPTIONS (trad tag)

These options are for compilation into the “/usr/” hierarchy, also called the traditional way to compile a program.

#
ARRAY_HELP_DO_NOT_COMPILE_OPTIONS
#

ARRAY_HELP_DO_NOT_COMPILE_OPTIONS

#
#
#
ARRAY_HELP_DO_USE_STOW_OPTIONS
#

ARRAY_HELP_DO_USE_STOW_OPTIONS

#
ARRAY_HELP_ENABLE_STATIC
#

ARRAY_HELP_ENABLE_STATIC (static tag)

These are the options for static compilation mode.

#
ARRAY_HELP_FEEDBACK_ALL_BINARIES_OPTIONS
#

ARRAY_HELP_FEEDBACK_ALL_BINARIES_OPTIONS

Keep track of which binaries a specific program should install.

#
ARRAY_HELP_FEEDBACK_EVERY_CASE_OPTION_OPTIONS
#

ARRAY_HELP_FEEDBACK_EVERY_CASE_OPTION_OPTIONS

#
ARRAY_HELP_FEEDBACK_LAST_COMPILED_OPTIONS
#

ARRAY_HELP_FEEDBACK_LAST_COMPILED_OPTIONS

#
ARRAY_HELP_FEEDBACK_PROGRAM_VERSION_OPTIONS
#

ARRAY_HELP_FEEDBACK_PROGRAM_VERSION_OPTIONS

#
ARRAY_HELP_FEEDBACK_VERSIONS_OPTIONS
#

ARRAY_HELP_FEEDBACK_VERSIONS_OPTIONS

This Array is used to feedback different versions in use.

#
ARRAY_HELP_FIND_ALL_ARCHIVES
#

ARRAY_HELP_FIND_ALL_ARCHIVES

#
ARRAY_HELP_GENERATE_ALL_SLACK_DESC_FILES_OPTIONS
#

ARRAY_HELP_GENERATE_ALL_SLACK_DESC_FILES_OPTIONS

All the registered options for creating slackware .desc files.

#
ARRAY_HELP_GENERATE_HOMEPAGE_OPTIONS
#

ARRAY_HELP_GENERATE_HOMEPAGE_OPTIONS

#
ARRAY_HELP_GENERATE_PDF_TUTORIAL_OPTIONS
#

ARRAY_HELP_GENERATE_PDF_TUTORIAL_OPTIONS

All options that can be used to generate the .pdf tutorial.

#
ARRAY_HELP_GENERATE_SHELL_COMPLETION_OPTIONS
#

ARRAY_HELP_GENERATE_SHELL_COMPLETION_OPTIONS

There are the options for shell-completion.

#
ARRAY_HELP_GENERATE_SLACK_DESC_FILE
#

ARRAY_HELP_GENERATE_SLACK_DESC_FILE

Help entries to generate a slack-desc file.

#
ARRAY_HELP_INCLUDED_OPTIONS
#

ARRAY_HELP_INCLUDED_OPTIONS

#
ARRAY_HELP_KEEP_EXTRACTED_OPTIONS
#

ARRAY_HELP_KEEP_EXTRACTED_OPTIONS

Note that an alias to this is –dont-remove-extracted-archive

#
ARRAY_HELP_LAST_COMPILED_OPTIONS
#

ARRAY_HELP_LAST_COMPILED_OPTIONS

#
ARRAY_HELP_LAST_COMPILED_PROGRAM_OPTIONS
#

ARRAY_HELP_LAST_COMPILED_PROGRAM_OPTIONS

#
ARRAY_HELP_LAST_CONFIGURE_OPTIONS
#

ARRAY_HELP_LAST_CONFIGURE_OPTIONS

#
ARRAY_HELP_LAST_DOWNLOADED_OPTIONS
#

ARRAY_HELP_LAST_DOWNLOADED_OPTIONS

#
ARRAY_HELP_LOG_DIR_OPTIONS
#

ARRAY_HELP_LOG_DIR_OPTIONS

#
ARRAY_HELP_OUTPUT_ALL_URLS_OPTIONS
#

ARRAY_HELP_OUTPUT_ALL_URLS_OPTIONS

#
ARRAY_HELP_PACKAGE_RBT_OPTIONS
#

ARRAY_HELP_PACKAGE_RBT_OPTIONS

All options if one wishes to package up the RBT scripts.

#
ARRAY_HELP_PREFIX_IN_USE
#

ARRAY_HELP_PREFIX_IN_USE

#
ARRAY_HELP_PURGE_ALL_MAN_ENTRIES
#

ARRAY_HELP_PURGE_ALL_MAN_ENTRIES

#
ARRAY_HELP_QUERY_THE_EXISTANCE_OF_A_BINARY_NAME
#

ARRAY_HELP_QUERY_THE_EXISTANCE_OF_A_BINARY_NAME

#
#

This Array collects all options used for when we wish to remove all symlinks in the /Programs hierarchy.

#
#
#
ARRAY_HELP_REPORT_N_PROGRAMS_OPTIONS
#

ARRAY_HELP_REPORT_N_PROGRAMS_OPTIONS

#
ARRAY_HELP_SCAN_SOURCE_ARCHIVE_OPTIONS
#

ARRAY_HELP_SCAN_SOURCE_ARCHIVE_OPTIONS

#
ARRAY_HELP_SHOW_ALL_OPTIONS
#

ARRAY_HELP_SHOW_ALL_OPTIONS

This covers all options that can be obtained via e. g “ry gcc show_all”.

#
ARRAY_HELP_SHOW_HIGHEST_PROGRAMS_OPTIONS
#

ARRAY_HELP_SHOW_HIGHEST_PROGRAMS_OPTIONS

#
ARRAY_HELP_SHOW_LAST_UPDATE_OPTIONS
#

ARRAY_HELP_SHOW_LAST_UPDATE_OPTIONS

#
ARRAY_HELP_SHOW_REGISTERED_KEYS
#

ARRAY_HELP_SHOW_REGISTERED_KEYS

#
ARRAY_HELP_SHOW_WHICH_COLOURS_WILL_BE_USED
#

ARRAY_HELP_SHOW_WHICH_COLOURS_WILL_BE_USED

The constants stored in the Array here can be used to display which colours will be used by the RBT project.

#
ARRAY_HELP_SIMULATION_MODE_OPTIONS
#

ARRAY_HELP_SIMULATION_MODE_OPTIONS

#
ARRAY_HELP_SKIP_EXTRACTING_OPTIONS
#

ARRAY_HELP_SKIP_EXTRACTING_OPTIONS

Options in order to skip extracting the tarball.

#
ARRAY_HELP_TEMP_DIR
#

RBT::ARRAY_HELP_TEMP_DIR

This constant will keep track of the RBT temp directory, e. g. where we will extract archives to.

#
ARRAY_HELP_TOGGLE_DEBUG_VALUE_OPTIONS
#

ARRAY_HELP_TOGGLE_DEBUG_VALUE_OPTIONS

#
ARRAY_HELP_UPDATE_BINARY_NAMES_OPTIONS
#

ARRAY_HELP_UPDATE_BINARY_NAMES_OPTIONS

#
ARRAY_HELP_USE_AUTOGEN
#

ARRAY_HELP_USE_AUTOGEN

All options when we wish to use autogen.

#
ARRAY_HELP_USE_BUILD_DIRECTORY_OPTIONS
#

ARRAY_HELP_USE_BUILD_DIRECTORY_OPTIONS

#
ARRAY_HELP_VIEW_AVAILABLE_LICENSES_OPTIONS
#

ARRAY_HELP_VIEW_AVAILABLE_LICENSES_OPTIONS

#
ARRAY_SHOW_LAST_UPDATED_OPTIONS
#

ARRAY_SHOW_LAST_UPDATED_OPTIONS

#
#

All “symlink all programs” options are stored here.

#
DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
#

DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY

What name will our default build directory have? Useful when we wish to use other build dirs.

The reason the name is so long is because the shorter name “BUILD” sometimes may already be an existing file. The program “brotli” has had this problem - it carried a file called “BUILD” by default, which obviously means that a “cd BUILD/” event will fail lateron.

#
DEFAULT_PROGRAM
#

DEFAULT_PROGRAM

Set the default program here.

#
FILE_AUTOGEN
#

FILE_AUTOGEN

#
NAMESPACE
#

NAMESPACE

#
OPTIONS_NO_COLOURS
#

OPTIONS_NO_COLOURS

Synonyms for colour usage. All these instructions can be used to disable colours.

#
SILENT_REDIRECTION
#

SILENT_REDIRECTION

This can simply be appended.

#
THIS_FILE
#

THIS_FILE

#

Public Class Methods

[](i = 'php') click to toggle source
#

RBT::Compile

#
# File lib/rbt/compile/class_methods.rb, line 148
def self.[](i = 'php')
  self.new(i)
end
compile( this_program = nil, optional_arguments = nil ) click to toggle source
#

RBT::Compile.compile

The first argument should be the name of the program that you wish to compile, such as :htop or 'htop'.

#
# File lib/rbt/compile/class_methods.rb, line 133
def self.compile(
    this_program       = nil,
    optional_arguments = nil
  )
  _ = RBT::Compile.new(this_program, :do_not_run_already)
  # ======================================================================= #
  # Pass any extra arguments into the menu() interface.
  # ======================================================================= #
  _.menu(optional_arguments) if optional_arguments
  _.run
end
display_standard_help_options( exit_now = true ) click to toggle source
#

RBT::Compile.display_standard_help_options

Set the standard help-options only here.

You can view them by issuing this command:

rbt --help
#
# File lib/rbt/compile/help.rb, line 43
def self.display_standard_help_options(
    exit_now = true
  )
  pad_to_most_right = ' ' * 40
  lpad = '  '
  RBT.cliner {
    middle_pad = 44
    e
    RBT::Compile.output_namespace?
    e
    e
    efancy 'These are the available help options for the Compile-Section '\
           'of the RBT scripts:'
    e
    efancy 'The basic command to compile a program is:'
    e
    e RBT.gold('    rbt [NAME_OF_THE_PROGRAM]')
    e RBT.gold('    rbt python')+RBT.orange(' # <- example input; here we '\
      'would try to compile python')
    e
    efancy lpad+'-b      --build-dir=[]                        Set a specific build directory'
    efancy lpad+'-h      --help                                Display this help subsection here'
    efancy '          --permanently_extract_to=[]           permanently extract the '\
           'archives to another directory'
    efancy lpad+'-e      --extract_to=[]                       extract the archives to '\
           'another directory'
    efancy '                                                (--homedir= is an alias to this setting)'
    efancy lpad+'-k      --keep_extracted                      Keep the sourceball extracted '\
           '(normally the extracted'
    efancy '                                                archive is '\
           'removed after compilation)'
    efancy '          --batch-compile=                      Batch-compile some '\
           'programs such as batch compiling'
    e      (' ' * middle_pad)+RBT.royalblue('      rbt --batch-compile=mate')
    efancy '          --dont-use-configure-options          Do not use any configure options '\
           'from the .yml file'
    efancy lpad+'-n      --no-harm                             Run in simulation mode'
    efancy lpad+'-nc     --nocolour / --nocolor                Disable colours'
    efancy '          --use-old-configure-options           Re-use old configure '\
           'options, e. g. from GCC'
    efancy lpad+'-sl     --sleep<number>                       Sleep for <number> seconds before continuing'
    efancy '          --permanently-disable-ccache          Permanently disable ccache, '\
           'via the commandline'
    efancy '          --disable-ccache                      Do not use ccache for the current run'
    efancy lpad+'-S      --no-symlink                          Do not symlink the AppDir that was compiled'
    efancy lpad+'-P      --no-postinstall                      Do not run the postinstall instructions'
    efancy '          --preinstall="sh bootstrap"           Run the specified pre-install action'
    efancy '          --use-gobolinux-symlinkprogram        Use the GoboLinux SymlinkProgram rather than '
    efancy '                                                class RBT::SymlinkProgram, for symlinking'
    efancy '          --use-meson                           Use the meson build system'
    efancy lpad+'-no     --no-extract                          Do not extract tarball again '\
           '(skip extracting the source archive)'
    efancy lpad+'-cmake  --cmake                               Use cmake rather than make'
    efancy lpad+'-clang  --clang                               Use clang rather than the default GCC '\
           'to compile C/C++ programs'
    efancy '          --create-yaml-file-for=subversion     Create a .yml file for this program, '\
           'holding the relevant information'
    efancy '                                                for compiling the program from source'
    efancy '                                                (Note that this requires the clang '\
                                                            'compiler of LLVM being'
    efancy '                                                available, of course.)'
    efancy '          --create-log-directory                Create the log directory.'
    efancy '          --paste-blfs-page                     Fetch and paste remote '\
           'data from the BLFS page of the given program'
    efancy lpad+'-slack  --slack-desc                          Create a Slackware slack-desc file'
    efancy '          --purge-traditional-binaries-of=gnupg Purge binaries of this program'
    efancy '          --valid-sys-tags?                     Show which '+sdir('/System/Tag')+
            sfancy(' entries are valid')
    efancy '          --symlink-headers                     Symlink all .h files into '\
           'the '+sdir('/usr/include/')+sfancy(' hierarchy')
    efancy '          --symlink-all-upcased-programs-to-downcased-variants Create '\
           'symlinks'
    efancy (' ' * (middle_pad-2))+'      for all upcased program entries under '+
           sdir(RBT.programs_dir?)+'.' 
    efancy '          --homedir                             Compile the program into your '\
           'HOME directory such as '+sdir('/home/name/')+sfancy('.')
    efancy lpad+'-ver    --verbose                             Be verbose in the output'
    efancy '          --do-not-use-special-flags            Do not use ENV (environmental '\
           'flags) at all.'
    efancy '          --update-entry                        Update a program, such '\
           'as via '
    e      RBT.royalblue((' ' * middle_pad)+
           '       rbt --update-entry http://ftp.gnome.org/pub/gnome/sources/glib/2.53/glib-2.53.4.tar.xz')
    efancy '          --edit-file=htop                      Open the htop.yml '\
           'cookbook-file, in order to inspect and/or edit it;'
    efancy '                                                the '+simp('$EDITOR')+
           sfancy(' variable can be used to specify which editor is to be used.')
    efancy "          --remove-la-files                     Remove "\
           ".la files of this program (requires the --prefix to include "\
           "#{sdir(::RBT.programs_dir?)})"
    efancy '          --suggest-cookbook-for=glib           Show a possible '\
           'content of glib.yml file'
    efancy lpad+'-v      --version                             Use a specific '\
           'version, such as, for instance: '
    efancy (' ' * middle_pad)+
           RBT.royalblue('       rbt bluefish --version=1.0.7')
    if RBT.is_on_gobolinux?
      # =================================================================== #
      # If we are on gobolinux then we also mention how to create
      # gobolinux-recipes.
      # =================================================================== #
      efancy '   --gobolinux-recipe                            Create a GoboLinux '\
             'recipe. (The "-" can be omitted.'
      efancy pad_to_most_right+'        A usage example follows next.)'
      efancy pad_to_most_right+'        Usage example: '+
             simp('rbt zenity --gobolinux-recipe')
    end
    e
    e 'Some shorter commandline options exist for toplevel methods:'
    e
    efancy '  rbt --download htop # This will download htop into '\
           'the local directory'
    efancy '  rbt --extract htop  # This will extract htop; or download '\
           'it if it does not exist, and then extract it'
    e # Need a spacer before we display the next part.
    e
    eimp 'Also note that these options can be chained together. Abbreviations '\
         'can be used as'
    eimp 'well. The options '+sfancy('noext nocol')+
         simp(' will all work fine, being equal to ')+
         sfancy('--no-extract --nocolor')+simp('.')
    eimp 'Abbreviations allow you to type less, but the longer variants '\
         'work just as well,'
    eimp 'in the event that you wish to be more explicit.'
    e
  }
  exit if exit_now
end
do_not_show_names?() click to toggle source
#

RBT::Compile.do_not_show_names?

#
# File lib/rbt/compile/opn.rb, line 30
def self.do_not_show_names?
  ::RBT.do_not_show_names?
end
e(i = '') click to toggle source
#

RBT::Compile.e

#
# File lib/rbt/compile/class_methods.rb, line 54
def self.e(i = '')
  RBT.e(i)
end
efancy(i = '') click to toggle source
#

RBT::Compile.efancy

#
# File lib/rbt/compile/class_methods.rb, line 26
def self.efancy(i = '')
  e RBT.sfancy(i)
end
eimp(i = '') click to toggle source
#

RBT::Compile.eimp

#
# File lib/rbt/compile/class_methods.rb, line 19
def self.eimp(i = '')
  e RBT.simp(i)
end
is_this_program_included?( i, be_verbose = :default ) click to toggle source
#

RBT::Compile.is_this_program_included?

ry --included?
#
# File lib/rbt/compile/class_methods.rb, line 83
def self.is_this_program_included?(
    i,
    be_verbose = :default
  )
  case be_verbose
  when :default
    be_verbose = true
  when :be_quiet
    be_verbose = false
  end
  if i.is_a? Array
    i.each {|entry| is_this_program_included?(entry, be_verbose) }
  else
    i = i.to_s.dup
    i.delete!('-')
    i.delete!('_')
    # ===================================================================== #
    # Note that RBT.does_include? tries harder to find a program
    # than does RBT.is_this_program_included?.
    # ===================================================================== #
    is_included = RBT.does_include?(i)
    if is_included
      if be_verbose
        RBT::Compile.opnn
        e "The program `#{Colours.simp(i)}` is included."
      end
      @is_included = true
    else
      if be_verbose
        RBT::Compile.opnn
        e "The program `#{Colours.simp(i)}` is #{swarn('not')} included."
      end
      @is_included = false
    end
  end
end
new( compile_these_programs = ARGV, run_already = true ) { || ... } click to toggle source
#

initialize

The first argument to this method, called `compile_these_programs`, should be the name of the program (or programs) that you wish to compile.

So, for example, “htop” could be passed as the first argument to the method. You can also pass in an Array here, and this class will then attempt to batch-compile these programs.

#
# File lib/rbt/compile/initialize.rb, line 24
def initialize(
    compile_these_programs = ARGV, # <- This should usually be an Array of programs that is to be compiled.
    run_already            = true
  )
  register_sigint
  reset
  time_snapshot # Store the first snapshot, which is the start-mark.
  set_original_input(compile_these_programs)
  # ======================================================================= #
  # Handle symbols given as first argument next.
  # ======================================================================= #
  case compile_these_programs
  when :do_not_run_yet,
       :do_not_yet_run,
       :dont_run_yet
    run_already = false
    compile_these_programs = []
  end
  compile_these_programs = [compile_these_programs].flatten.compact
  compile_these_programs = obtain_and_set_commandline_arguments_from(
    compile_these_programs
  )
  if compile_these_programs.is_a?(Array) and
    (compile_these_programs.size > 1) and # <- More than one entry.
    (!RBT.includes_this_program?(compile_these_programs[1]))
    # ===================================================================== #
    # Push entries into the commandline then, if it is not an
    # original program.
    # ===================================================================== #
    these_programs = compile_these_programs[1 .. -1]
    append_to_the_commandline(these_programs)
    compile_these_programs = compile_these_programs.first
  end
  # ======================================================================= #
  # Handle blocks passed to this method next:
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # Handle Symbols first:
    # ===================================================================== #
    if yielded.is_a? Symbol
      case yielded
       # =================================================================== #
      # === :do_not_run_yet
      # =================================================================== #
      when :do_not_run_yet,
           :do_not_run
        run_already = false
      # =================================================================== #
      # === :do_not_check_whether_the_program_exists
      # =================================================================== #
      when :do_not_check_whether_the_program_exists
        do_not_check_whether_the_program_exists # <- This method exists, so use it too.
      end
    # ===================================================================== #
    # Next handle Hashes:
    # ===================================================================== #
    elsif yielded.is_a? Hash
      # =================================================================== #
      # === :prefix
      #
      # Handle prefix-related keys first.
      # =================================================================== #
      if yielded.has_key? :prefix
        set_user_prefix(yielded.delete(:prefix)) # <- Set the new prefix via a method call.
      # =================================================================== #
      # === :use_this_prefix
      # =================================================================== #
      elsif yielded.has_key? :use_this_prefix
        set_user_prefix(yielded.delete(:use_this_prefix))
      # =================================================================== #
      # === :use_this_as_prefix
      # =================================================================== #
      elsif yielded.has_key? :use_this_as_prefix
        set_user_prefix(yielded.delete(:use_this_as_prefix))
      end
      # =================================================================== #
      # === :symlink_after_compilation_has_finished
      # =================================================================== #
      if yielded.has_key? :symlink_after_compilation_has_finished
        value = yielded.delete(:symlink_after_compilation_has_finished)
        if value == false
          set_do_not_symlink(:be_verbose) # Disable symlinking after compilation.
        end
      end
      # =================================================================== #
      # === :run_already
      # =================================================================== #
      if yielded.has_key? :run_already
        case yielded[:run_already]
        when :do_not_run_yet
          run_already = false
        end
      end
      # =================================================================== #
      # Add commandline_arguments if the key is :commandline_arguments
      #
      # Such a Hash may have a key like this:
      #
      #   {:commandline_arguments=>["--dont-use-colours", "ntrad"]}
      
      # =================================================================== #
      if yielded.has_key? :commandline_arguments
        append_to_the_commandline(yielded.delete(:commandline_arguments))
      end
    else
      append_to_the_commandline(yielded)
    end
  end
  set_compile_these_programs(
    compile_these_programs
  )
  # ======================================================================= #
  # Handle special symbols passed to run_already next:
  # ======================================================================= #
  case run_already
  when :dont_run_yet,
       :do_not_run_yet,
       :do_not_run_already
    run_already = false
  end
  run if run_already
end
opnn( i = { namespace: NAMESPACE, use_colours: RBT.use_colours? } ) click to toggle source
#

RBT::Compile.opnn

Use this method when you wish to output the RBT::Compile namespace to the user.

#
# File lib/rbt/compile/opn.rb, line 69
def self.opnn(
    i = {
      namespace:   NAMESPACE,
      use_colours: RBT.use_colours?
    }
  )
  if i.is_a? Hash
    unless i.has_key? :use_colours
      i.update(use_colours: RBT.use_colours?)
    end
  end
  if RBT.show_the_classname?
    ::RBT.opnn(i) # Delegate to the module_method here.
  # else # else we will not use Opn at all.
  end
end
program_is_included?() click to toggle source
#

Compile.program_is_included?

#
# File lib/rbt/compile/class_methods.rb, line 123
def self.program_is_included?
  @is_included
end
sdir(i = '') click to toggle source
#

RBT::Compile.sdir

#
# File lib/rbt/compile/class_methods.rb, line 40
def self.sdir(i = '')
  RBT.sdir(i)
end
sfancy(i = '') click to toggle source
#

RBT::Compile.sfancy

#
# File lib/rbt/compile/class_methods.rb, line 33
def self.sfancy(i = '')
  RBT.sfancy(i)
end
show_the_classname?() click to toggle source
#

RBT::Compile.show_the_classname?

#
# File lib/rbt/compile/opn.rb, line 37
def self.show_the_classname?
  ::RBT.show_the_classname?
end
simp(i = '') click to toggle source
#

RBT::Compile.simp

#
# File lib/rbt/compile/class_methods.rb, line 47
def self.simp(i = '')
  RBT.simp(i)
end
the_program_is_included() click to toggle source
#

Compile.the_program_is_included

#
# File lib/rbt/compile/class_methods.rb, line 66
def self.the_program_is_included
  @is_included = true
end
use_colours?() click to toggle source
#

RBT::Compile.use_colours?

#
# File lib/rbt/compile/colours.rb, line 97
def self.use_colours?
  config?.use_colours.to_s
end

Public Instance Methods

a_problem_has_occurred() click to toggle source
#

a_problem_has_occurred

This method simply denotes that a problem has occurred. It is not more specific than that.

#
# File lib/rbt/compile/problems_and_errors.rb, line 414
def a_problem_has_occurred
  @internal_hash[:problem] = true
end
a_problem_has_occurred?()
a_program_has_been_initialized?() click to toggle source
#

a_program_has_been_initialized?

#
# File lib/rbt/compile/misc.rb, line 2092
def a_program_has_been_initialized?
  !main_dataset?.nil?
end
action_install_only_headers( from_this_directory = extract_to?+program_name?+'/' ) click to toggle source
#

action_install_only_headers

This method handles the actual copying of all headers. It must be called at the proper time.

#
# File lib/rbt/compile/headers.rb, line 69
def action_install_only_headers(
    from_this_directory = extract_to?+program_name?+'/'
  )
  from_this_directory = from_this_directory.to_s.dup
  from_this_directory << '/' unless from_this_directory.end_with? '/'
  _ = ''.dup
  all_headers = Dir["#{from_this_directory}*.h"]
  _ = all_headers.join(',')[0..3] unless all_headers.empty?
  opnn; e "Now copying all found headers from '{sdir(from_this_directory)}"\
          " to #{sdir('/usr/include/')}:"
  copy_recursively(all_headers, '/usr/include/', true)
  do_not_continue_after_configure_step
  do_not_continue_after_make_step
  be_silent
end
add_default_dataset_to_the_internal_hash() click to toggle source
#

add_default_dataset_to_the_internal_hash

The variables in use in this method here can, for the most part, be modified via the commandline. In other words, the user can change these variables and thus toggle the behaviour of RBT::Compile.

That is one reason why many of these variables are set to nil initially, so we can easily find out which values have been modified on the commandline, and which one has not.

#
# File lib/rbt/compile/reset.rb, line 69
def add_default_dataset_to_the_internal_hash
  # ======================================================================= #
  # === Keeping track of the commandline arguments
  #
  # @commandline_arguments are set on startup only once, so they can not
  # be put inside the method initialize_default_values().
  # ======================================================================= #
  @internal_hash[:commandline_arguments] = []
  # ======================================================================= #
  # Whether we will use special configure options or not. By default
  # we will not, hence why we initialize the next setting to nil.
  # ======================================================================= #
  @internal_hash[:configure_options] = nil
  # ======================================================================= #
  # Specify which compiler is to be used. By default we will use GCC,
  # but clang may also be an option. It will be stored as a lowercased
  # Symbol, though, so :gcc would refer to GCC.
  # ======================================================================= #
  @internal_hash[:compiler_to_use] = :gcc
  # ======================================================================= #
  # Default value is nil for the next variable. If true then we will
  # NOT extract.
  # ======================================================================= #
  @internal_hash[:skip_extracting] = nil
  # ======================================================================= #
  # The next entry point allows us to pass options/parameters to the
  # "make" binariy.
  # ======================================================================= #
  @internal_hash[:parameters_to_make] = nil
  # ======================================================================= #
  # Use another program version than the default one:
  # ======================================================================= #
  @internal_hash[:use_this_specific_program_version] = nil
  # ======================================================================= #
  # Determine which build system is to be used. By default it will
  # be nil.
  # ======================================================================= #
  @internal_hash[:use_this_build_system] = nil
  # ======================================================================= #
  # The next variable can be used to allow the user to determine another
  # directory for where we will extract archives into. Initially set
  # to nil in order to allow distinction to the default extractable
  # directory that is to be used.
  # ======================================================================= #
  @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = nil
  @internal_hash[:postinstallation] = nil
  # ======================================================================= #
  # The next variable will keep track of class SymlinkProgram. We
  # need to be able to modify its behaviour at "runtime".
  # ======================================================================= #
  set_symlink_program(nil)
  # ======================================================================= #
  # The next variable has to be kept for if we actually do want to
  # check whether a program is included or not. Normally we should
  # check, but there may be situations where you may build up your
  # own functionality - so we need to provide an option that can be
  # toggled by the user. This is why the next variable exists, and
  # is kept at true.
  # ======================================================================= #
  @internal_hash[:honour_check_to_ensure_that_the_program_exists] = true
  # ======================================================================= #
  # The next variable can be used to determine whether we will compile
  # a particular program or whether we will not.
  # ======================================================================= #
  @internal_hash[:shall_we_compile_the_program] = true
  @internal_hash[:last_compiled_program] = nil  # Define it once at least.
  # ======================================================================= #
  # Must initialize the build directory to a nil value next. It may
  # be set to a non-nil value lateron.
  # ======================================================================= #
  @internal_hash[:use_build_directory] = nil
  # ======================================================================= #
  # The next variable, false on startup, tells RBT::Compile to retain
  # all environment variables. Sometimes we may want to NOT use the
  # environment variables, which is why this flag exists.
  # ======================================================================= #
  @internal_hash[:do_not_use_special_flags] = false
  # ======================================================================= #
  # Use a default build directory. There is another entry that determines
  # whether we will use any build directory at all or not, so it is safe
  # to assign to the variable here - the entry called
  # @internal_hash[:use_build_directory].
  # ======================================================================= #
  @internal_hash[:name_for_the_build_directory] = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
  # ======================================================================= #
  # Determine whether we are on GoboLinux or whether we are not.
  # ======================================================================= #
  @internal_hash[:is_on_gobolinux] = RBT.are_we_on_gobolinux?
  # ======================================================================= #
  # Next, how often we invoked traditional or non-traditional compilation.
  # ======================================================================= #
  @internal_hash[:counter_called_traditional_or_non_traditional_compilation] = 0
  # ======================================================================= #
  # Determine whether we will run the configure script or whether we
  # will not.
  # ======================================================================= #
  @internal_hash[:run_configure_script] = nil
  # ======================================================================= #
  # Whether we are allowed to use special ENV flags. By default we are
  # allowed to use special flags, hence why the variable is set to false.
  # ======================================================================= #
  @internal_hash[:do_not_use_special_environment_flags] = false
  # ======================================================================= #
  # Next, determine whether we will make use of GoboLinux's SymlinkProgram.
  # This will be automatically changed if we are on GoboLinux. For other
  # systems we will prefer to use SymlinkProgram from RBT itself.
  # ======================================================================= #
  @internal_hash[:use_gobolinux_symlinkprogram] = false
  # ======================================================================= #
  # Determine whether we will run postinstallation steps.
  # ======================================================================= #
  @internal_hash[:run_postinstall_actions] = true
  # ======================================================================= #
  # The next variable is an empty Array by default. Must be defined
  # outside other methods such as initialize_default_values().
  # ======================================================================= #
  @internal_hash[:compile_these_programs] = []
  @internal_hash[:we_tried_to_compile_this_program_n_times] = 0
  set_user_prefix(nil) # <- Purposely defined here, outside of other methods.
  @internal_hash[:colourize_parser] = RBT::ColourizeParser.new
  @internal_hash[:make_use_of_cookbook_aliases] = true
  # ======================================================================= #
  # Determine whether we shall time the compilation or whether we shall
  # not.
  # ======================================================================= #
  @internal_hash[:time_compilation] = YAML.load_file(FILE_TIME_COMPILATION)
  if @internal_hash[:time_compilation]
    @internal_hash[:array_time_compilation] = []
  end
  # ======================================================================= #
  # Use autoconf or not - by default we will not.
  # ======================================================================= #
  @internal_hash[:use_autoconf] = nil
  # ======================================================================= #
  # Determine whether we will try to use any declared configure options
  # from the cookbook-yaml file. This is true by default. The reason
  # why the following variable is set to nil initially is so that we
  # can distinguish the situation from when the user did specifically
  # want to disable this functionality, from the commandline.
  # ======================================================================= #
  @internal_hash[:try_to_use_configure_options] = nil
  # ======================================================================= #
  # By default we will extract the archive.
  # ======================================================================= #
  @internal_hash[:extract_the_archive] = true
  # ======================================================================= #
  # The keep-extracted setting will lateron be sanitized. The default
  # value will be nil.
  # ======================================================================= #
  @internal_hash[:keep_the_extracted_archive] = nil
  # ======================================================================= #
  # The next variable must be defined here. A value of nil specifies
  # that this has not been set via the commandline yet. A value of
  # nil here essentially means a default to false - aka we will not
  # try to compile a program in a static manner.
  # ======================================================================= #
  @internal_hash[:build_static] = nil
  # ======================================================================= #
  # By default we will not strip the binaries. The configuration
  # setting can change this value though.
  # ======================================================================= #
  @internal_hash[:strip_binaries] = false
  # ======================================================================= #
  # The configuration setting can change the above default false-value.
  # ======================================================================= #
  if config?
    @internal_hash[:strip_binaries] = config?.use_strip
  end
  # ======================================================================= #
  # The next flag determines whether we will delete .la files or whether
  # we will keep them.
  # ======================================================================= #
  @internal_hash[:keep_la_files] = nil
  # ======================================================================= #
  # Default value for use_autogen will be nil. The user is able to
  # override this from the commandline, which is why we will set
  # this variable to nil.
  # ======================================================================= #
  @internal_hash[:use_autogen] = nil
  # ======================================================================= #
  # The next variable, if true, instructs the class to check whether the
  # given input argument(s) do exist as a regular local file. If false
  # this check is skipped.
  # ======================================================================= #
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = true
  # ======================================================================= #
  # Next, determine whether to use the internal sed-wrapper. No
  # longer true by default since as of February 2018, but perhaps
  # we may re-enable it at some later moment in time.
  # ======================================================================= #
  @internal_hash[:use_the_internal_sed_wrapper] = false
  # ======================================================================= #
  # Whether to apply a sed-operation. Will be nil by default. If the
  # user passes in some special option here, then we know that we
  # have to use this value to overrule any other value for sed.
  # ======================================================================= #
  @internal_hash[:sed] = nil
  @internal_hash[:symlink_headers] = nil
  @internal_hash[:symlink_glib_schema] = nil
  # ======================================================================= #
  # Determine whether we will symlink the content of lib/ into
  # /usr/lib/. This setting is only honoured if we compile in an
  # appdir-like fashion.
  # ======================================================================= #
  @internal_hash[:symlink_into_usr_lib_dir] = false
  # ======================================================================= #
  # Only install the .h header files, if this variable is set to true.
  # ======================================================================= #
  @internal_hash[:install_only_the_headers] = false
  # ======================================================================= #
  # Whether to time the compilation procedure or not:
  # ======================================================================= #
  @internal_hash[:time_compilation] = true
  # ======================================================================= #
  # Whether we will exit when we reach the "make install" stage.
  # ======================================================================= #
  @internal_hash[:exit_before_make_install] = false
  # ======================================================================= #
  # Whether we will exit when we reach the "make" stage.
  # ======================================================================= #
  @internal_hash[:exit_before_make] = false
  # ======================================================================= #
  # === Show the infobox
  #
  # Next determine whether we will show the infobox or not. This has
  # to be in the method here so that we do not re-set it for each
  # program that is to be compiled/installed.
  # ======================================================================= #
  @internal_hash[:show_the_infobox] = true
  # ======================================================================= #
  # If the next variable is set to true, we will exit after we have
  # extracted the archive. We will first initialize it to nil, though,
  # in order to distinguish between the default value and user-supplied
  # values.
  # ======================================================================= #
  @internal_hash[:extract_only] = nil
  # ======================================================================= #
  # The use_ccache entry has to be persistent.
  # ======================================================================= #
  @internal_hash[:use_ccache] = RBT.configuration?.use_ccache
  # ======================================================================= #
  # Determine whether we will make use of porg.
  # ======================================================================= #
  @internal_hash[:use_porg] = configuration?.use_porg
  # ======================================================================= #
  # Whether we will run in simulation-mode or not. Simulation-mode means
  # that we will not make any real lasting changes. This thus allows a
  # user to predict (and show a summary) what would happen if a
  # program would be installed/compiled.
  # ======================================================================= #
  @internal_hash[:run_simulation] = false
  set_name_for_the_build_directory # Set a default name for the build directory.
  # ======================================================================= #
  # The next variable is a bit unclear - it used to exist to allow for
  # easy redirection, but may no longer be that important. We may have to
  # re-evaluate this at a later time (written at 12.04.2019).
  # ======================================================================= #
  @original_stdout = nil
end
add_package_user( name = compile_which_program? ) click to toggle source
#

add_package_user

This allows you to add a package-user.

Usage example:

ry htop add_package_user
#
# File lib/rbt/compile/misc.rb, line 2623
def add_package_user(
    name = compile_which_program?
  )
  _ = '/Users/Packages/'
  cmd_to_run = 'useradd -m -d '+_+name.capitalize+' '+name
  create_directory _ unless File.directory? _
  opne "Adding a new user called `#{simp(name)}`:"
  custom_system cmd_to_run
end
add_this_global_flag(i)
all_available_programs?() click to toggle source
#

all_available_programs?

To invoke and test this:

ry htop all_available_programs?
#
# File lib/rbt/compile/misc.rb, line 3093
def all_available_programs?
  e
  opne 'These programs are available:'
  e
  RBT.feedback_available_programs
end
all_configure_options?() click to toggle source
#

all_configure_options?

Use this method to show all configure options for a given program.

This means all options available through “./configure –help”.

Invocation example:

ry htop allconfigureoptions?
#
# File lib/rbt/compile/configure.rb, line 60
def all_configure_options?
  _ = extract_to? # TEMP_DIR+File.basename(compile_this_program?)
  # ======================================================================= #
  # The target may be empty though. Rescue this case.
  # ======================================================================= #
  _ = rbt_log_directory? if _.empty?
  opne 'Will extract to '+sdir(_)+'. In the event that you need '\
       'to know '
  opne 'where the extracted archive resides.'
  opne "All configure options for "\
       "#{simp(compile_this_program?)} will be shown next, "\
       "before exiting."
  set_extract_to(_)
  consider_extracting_this_program(
    program_path?
  )
  _ = rbt_log_directory?+program_name_and_version?
  opne "We will next cd (change directory) into `#{sdir(_)}`."
  cd _, :be_quiet # Now we should be in the proper directory.
  e
  RBT::BeautifyConfigureHelpOutput.new # Delegate to this class next.
  e
  exit_program
end
an_error_has_occurred() click to toggle source
#

an_error_has_occurred

This is a setter-method.

#
# File lib/rbt/compile/problems_and_errors.rb, line 124
def an_error_has_occurred
  we_can_not_continue_and_we_will_not_run_make_install
  @internal_hash[:an_error_has_occurred] = true
  the_program_has_failed_to_install
end
an_error_has_occurred?() click to toggle source
#

an_error_has_occurred?

Query-method over as to whether an error has occurred.

#
# File lib/rbt/compile/problems_and_errors.rb, line 74
def an_error_has_occurred?
  @internal_hash[:an_error_has_occurred]
end
appdir_prefix?( i = compile_which_program?, use_this_program_version = :default ) click to toggle source
#

appdir_prefix? (appdir prefix)

This method will return the (assumed) AppDir prefix for a given program at hand.

The program version must be set before calling this method. If the program_version? has not been defined properly then the method here may return an incorrect result.

This method MUST be guaranteed to return a trailing '/' character.

#
# File lib/rbt/compile/prefix.rb, line 154
def appdir_prefix?(
    i                        = compile_which_program?,
    use_this_program_version = :default
  )
  if cookbook_dataset?.nil?
    # ===================================================================== #
    # We do the next method primarily so that we can find
    # a proper program version.
    # ===================================================================== #
    initialize_cookbook_dataset_for(i)
  end
  case use_this_program_version
  when :default
    use_this_program_version = program_version?
  end
  # ======================================================================= #
  # We need a safeguard next, as the program version may be nil.
  # ======================================================================= #
  if use_this_program_version.nil?
    use_this_program_version = cookbook_dataset_program_version?
  end
  result = rds(
    programs_directory?.to_s+
    i.to_s.capitalize.to_s+'/'+
    use_this_program_version+'/'
  )
  # ======================================================================= #
  # === Handle GoboLinux next
  # ======================================================================= #
  if is_on_gobolinux?
    # ===================================================================== #
    # If we are on GoboLinux, then we have to honour the other
    # variant called program_compile_name? instead.
    # ===================================================================== #
    result = rds(
      programs_directory?.to_s+
      program_compile_name?.to_s+'/'+
      use_this_program_version.to_s+'/'
    )
  end
  result
end
append_disable_static_to_the_configure_options() click to toggle source
#

append_disable_static_to_the_configure_options

This method is somewhat similar to the method called append_enable_shared_to_the_configure_options in that it will also modify the configure options; but it will add “–disable-static” to the configure options.

#
# File lib/rbt/compile/configure.rb, line 298
def append_disable_static_to_the_configure_options
  append_this_to_the_configure_options(:disable_static)
end
append_enable_shared_to_the_configure_options() click to toggle source
#

append_enable_shared_to_the_configure_options

This method will simply add –enable-shared onto the configure options.

This can then be used by GNU configure sripts or meson builds or even cmake builds (though the latter may use another format, so keep this in mind for the time being; the primary use cases are for GNU configure scripts and meson builds).

#
# File lib/rbt/compile/configure.rb, line 352
def append_enable_shared_to_the_configure_options
  append_this_to_the_configure_options(:enable_shared)
end
append_make_option(i)
Alias for: append_make_options
append_make_options(i) click to toggle source
#

append_make_options

This will append parameters issued to “make”. It will also start with a ' ', always.

#
# File lib/rbt/compile/make.rb, line 161
def append_make_options(i)
  @make.append_make_options(i)
  append_this = i.to_s.dup
  if make_options?
    joined_make_options = make_options?
    if joined_make_options.respond_to? :join
      joined_make_options = joined_make_options.join(' ').strip
    end
    unless append_this.include? joined_make_options
      append_this.prepend(joined_make_options.dup)
    end
  end
  # ======================================================================= #
  # Prepend a ' ' for some spacing.
  # ======================================================================= #
  unless append_this.empty?
    append_this.prepend(' ') unless append_this.start_with? ' '
    set_make_options(append_this)
  end
end
append_parameters_to_make(i)
Alias for: append_make_options
append_these_options_to_the_commandline(i) click to toggle source
#

append_these_options_to_the_commandline

Simply append to the commandline options through this method here.

#
# File lib/rbt/compile/commandline.rb, line 78
def append_these_options_to_the_commandline(i)
  # ======================================================================= #
  # First check whether the input is a Hash:
  # ======================================================================= #
  if i.is_a? Hash
    if i.has_key? :commandline_arguments
      i = i.delete(:commandline_arguments)
    end
  end
  @internal_hash[:commandline_arguments] << i
  @internal_hash[:commandline_arguments].flatten!
end
Also aliased as: append_to_the_commandline
append_this_to_full_configure_command(i = ' build') click to toggle source
#

append_this_to_full_configure_command

#
# File lib/rbt/compile/misc.rb, line 1627
def append_this_to_full_configure_command(i = ' build')
  unless i.end_with? ' '
    i = i.dup if i.frozen?
    i << ' ' # Properly pad it here.
  end
  i.squeeze!(' ')
  @internal_hash[:full_configure_command] << i
end
append_this_to_the_configure_options( i = :enable_bootstrap ) click to toggle source
#

append_this_to_the_configure_options

#
# File lib/rbt/compile/configure.rb, line 256
def append_this_to_the_configure_options(
    i = :enable_bootstrap
  )
  # ======================================================================= #
  # The following case-when menu could be replaced with generic code
  # that turns the Symbol-input into the equivalent String e. g.
  # --disable-something or --enable-something. However had, for the
  # time being (Dec 2018) I will leave it as it is.
  # ======================================================================= #
  case i
  when :disable_static
    i = ' --disable-static'
  when :enable_shared
    i = ' --enable-shared'
  when :enable_bootstrap
    i = ' --enable-bootstrap'
  end
  _ = @internal_hash[:configure_options]
  _ = ''.dup if _.nil?
  unless i.start_with? ' '
    i = i.dup if i.frozen?
    i.prepend(' ')
  end
  _ << i
  @internal_hash[:configure_options] = _
end
append_to_the_commandline(i)
apply_patch?() click to toggle source
#

apply_patch?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 329
def apply_patch?
  cookbook_dataset?.apply_patch?
end
apply_sed_operation_on(sed_line) click to toggle source
#

apply_sed_operation_on

This method will either use class SedWrapper, or it will use the sed-binary.

#
# File lib/rbt/compile/sed.rb, line 163
def apply_sed_operation_on(sed_line)
  if sed_line.is_a? Array
    sed_line.each {|entry|
      apply_sed_operation_on(entry)
    }
  else
    if sed_binary_is_available?
      esystem(sed_line)
    else
      if use_the_internal_sed_wrapper?
        # ================================================================= #
        # In this case, use the SedWrapper as a fallback.
        # ================================================================= #
        SedWrapper.new(sed_line)
      else
        # ================================================================= #
        # Else we will default to the system-sed.
        # ================================================================= #
        opnn; e 'We can not use the sed line '+sfancy(sed_line)+' because '\
                'sed is not available'
        opnn; e ', and no commandline option has been passed to allow '\
                'us to use the sed wrapper.'
      end
    end
  end
end
Also aliased as: run_this_sed_instruction
archive?()
Alias for: archive_type?
archive_type?() click to toggle source
#

archive_type?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 286
def archive_type?
  if cookbook_dataset?
    cookbook_dataset?.archive_type?
  end
end
Also aliased as: archive?, cookbooks_archive_type?
array_sys_command_string?() click to toggle source
#

array_sys_command_string?

The array is fed in line by line.

#
# File lib/rbt/compile/compile.rb, line 194
def array_sys_command_string?
  @internal_hash[:array_sys_command_string]
end
Also aliased as: sys_command_string?
assemble_full_path()
Alias for: update_program_path
assemble_program_path() click to toggle source
#

assemble_program_path

#
# File lib/rbt/compile/cookbook_dataset.rb, line 656
def assemble_program_path
  cookbook_dataset?.assemble_program_path
end
assign_to_the_main_dataset(i) click to toggle source
#

assign_to_the_main_dataset

This method should be used when we wish to assign to the main dataset at hand. The expected input should be class ::RBT::Cookbooks::Cookbook. If it is not then this will cause an argument error.

#
# File lib/rbt/compile/compile.rb, line 241
def assign_to_the_main_dataset(i)
  unless i.is_a? ::RBT::Cookbooks::Cookbook
    raise ArgumentError,
          'The method assign_to_the_main_dataset() expects input as '\
          'class RBT::Cookbooks::Cookbook'
  end
  set_on_ihash(:yaml_dataset, i)
end
assume_default_archive_type() click to toggle source
#

assume_default_archive_type

#
# File lib/rbt/compile/cookbook_dataset.rb, line 728
def assume_default_archive_type
  cookbook_dataset?.assume_default_archive_type
end
attach_program_name_and_program_version() click to toggle source
#

attach_program_name_and_program_version

#
# File lib/rbt/compile/cookbook_dataset.rb, line 649
def attach_program_name_and_program_version
  cookbook_dataset?.attach_program_name_and_program_version
end
autofix?()
Alias for: try_to_autofix?
automatically_create_package?() click to toggle source
#

automatically_create_package?

#
# File lib/rbt/compile/misc.rb, line 1499
def automatically_create_package?
  RBT.automatically_create_package?
end
automatically_infer_program_name_and_program_version_from_this_input( i, optional_arguments = nil ) click to toggle source
#

automatically_infer_program_name_and_program_version_from_this_input

This method will try to automatically set the program_name and @program_version variables.

#
# File lib/rbt/compile/misc.rb, line 464
def automatically_infer_program_name_and_program_version_from_this_input(
    i,
    optional_arguments = nil
  )
  if compile_which_program?.nil?
    set_program_name(
      ProgramInformation.return_program_real_name(i)
    )
  end
  if program_version?.nil?
    set_program_version(
      ProgramInformation.return_program_version(i)
    )
  end
  case optional_arguments
  when :overwrite_old_values_should_they_exist
    set_program_name ProgramInformation.return_program_real_name(i)
    set_program_version ProgramInformation.return_program_version(i)
  end
  @program_name_and_program_version = compile_which_program?+'-'+program_version?
end
autoswitch_python?() click to toggle source
#

autoswitch_python?

This query-method determines whether we will autoswitch the python version or not.

#
# File lib/rbt/compile/obtain.rb, line 17
def autoswitch_python?
  config?.autoswitch_python
end
backup_program( i = compile_which_program? ) click to toggle source
#

backup_program

Backup an existingp rogram under the /Programs/ hierarchy.

#
# File lib/rbt/compile/misc.rb, line 2411
def backup_program(
    i = compile_which_program?
  )
  require 'rbt/utility_scripts/backup_program.rb'
  RBT::BackupProgram.new(i)
end
base_dir?() click to toggle source
#

base_dir?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 621
def base_dir?
  cookbook_dataset?.base_dir?.to_s
end
batch_compile_the_programs( i = compile_these_programs? ) click to toggle source
#

batch_compile_the_programs (compile tag, main tag, run tag)

This method is the general entry-point in order to batch-compile the programs.

The logic for this task will be handled internally on a per-program basis.

The argument to this method should be an Array which holds the programs that we wish to compile. This is normally set elsewhere in class RBT::Compile.

#
# File lib/rbt/compile/batch_compile_the_programs.rb, line 24
def batch_compile_the_programs(
    i = compile_these_programs?
  )
  i.each {|this_program|
    do_compile_this_program(this_program)
  }
end
batch_download_all_source_archives() click to toggle source
#

batch_download_all_source_archives

For this method we have to delegate towards class Cookbooks::DownloadAllSourceArchives.

#
# File lib/rbt/compile/upload_and_download.rb, line 275
def batch_download_all_source_archives
  require 'rbt/toplevel_methods/download_all_source_archives.rb'
  RBT.download_all_source_archives
end
be_completely_quiet() click to toggle source
#

be_completely_quiet

#
# File lib/rbt/compile/misc.rb, line 2457
def be_completely_quiet
  @original_stdout = $stdout
  # $stdout = StringIO.new # This is the redirection.
  $stdout = File.open(IO::NULL, 'w') # This one works better, according to drbrain.
end
binaries?()
Alias for: cookbooks_binaries?
binary?( i = compile_which_program? ) click to toggle source
#

binary?

Wrapper towards answering the question of binary pointing.

#
# File lib/rbt/compile/misc.rb, line 2766
def binary?(
    i = compile_which_program?
  )
  i = i.first if i.is_a? Array
  i = i.downcase
  opne "Checking for a binary name called `#{simp(i)}` next:"
  RBT::Cookbooks::RegisteredBinaries.search_for_this_program(i)
end
build_static?() click to toggle source
#

build_static?

We have to first check the build_static entry of the cookbook dataset, before we query the value of the @internal_hash.

#
# File lib/rbt/compile/static.rb, line 37
def build_static?
  _ = cookbook_dataset_build_static?
  unless @internal_hash[:build_static].nil?
    _ = @internal_hash[:build_static]
  end
  _
end
Also aliased as: do_we_compile_statically?
build_system?()
can_not_continue(be_verbose = false)
Alias for: we_can_not_continue
can_we_continue?() click to toggle source
#

can_we_continue?

#
# File lib/rbt/compile/misc.rb, line 2342
def can_we_continue?
  @internal_hash[:can_we_continue]
end
cd_to_the_build_directory() click to toggle source
#

cd_to_the_build_directory

#
# File lib/rbt/compile/build_directory.rb, line 20
def cd_to_the_build_directory
  cd @internal_hash[:build_directory].path?
end
cd_to_the_configure_base_directory( be_verbose_or_be_quiet = :be_quiet ) click to toggle source
#

cd_to_the_configure_base_directory

This method can be used to cd into the configure base directory.

It can report what it is doing to, in the verbose variant.

#
# File lib/rbt/compile/misc.rb, line 1318
def cd_to_the_configure_base_directory(
    be_verbose_or_be_quiet = :be_quiet
  )
  target = @internal_hash[:configure_base_directory].dup
  case be_verbose_or_be_quiet
  when :be_quiet
    cd target, :be_quiet
  else
    opnn; cd target, :be_verbose
  end
end
cd_to_the_configure_base_directory_to_be_used( be_verbose_or_be_quiet = :be_quiet )
cflags?() click to toggle source
#

cflags?

Just a convenience wrapper over the CFLAGS environment variable. A getter method, which will tell us the CFLAGS in use of the environment.

#
# File lib/rbt/compile/cflags.rb, line 67
def cflags?
  ENV['CFLAGS'].to_s.dup
end
Also aliased as: default_cflags?
chained_programs?() click to toggle source
#

chained_programs?

A simpler wrapper to obtain an Array of all chained programs, the keys.

#
# File lib/rbt/compile/show_and_report.rb, line 89
def chained_programs?
  RBT.chained_programs?.keys
end
change_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title] )
check_against_menu( i = commandline_arguments? )
Alias for: menu
check_all_tags_under_programs_directory() click to toggle source
#

check_all_tags_under_programs_directory

Use this method to check for all entries in the PROGRAMS_DIRECTORY, whether they also have an entry in /System/Tags.

To invoke this method, try:

ry --check-all-tags
#
# File lib/rbt/compile/tags.rb, line 86
def check_all_tags_under_programs_directory
  entries = Dir["#{programs_directory?}*"].map {|entry|
    entry << '/Current/'
  }.sort
  entries.each {|entry|
    # ===================================================================== #
    # A particular entry may look like this:
    #   /Programs/Zip/Current/
    # ===================================================================== #
    # Must check whether the directory exists.
    # ===================================================================== #
    if Dir.exist? entry
      splitted = entry.split('/') # <- e. g. "/Programs/Zip/Current/"
      program_name = splitted[2]
      # program_name = ProgramInformation.return_program_name(program_name).downcase
      program_name.downcase!
      dataset = instantiate_a_new_cookbook_for(program_name)
      symlink_into_tags(entry, dataset)
    end
  }
  opnn; e 'All done now.'
end
check_for_available_versions( for_this_program = program? ) click to toggle source
#

check_for_available_versions

Use this method if you wish to check for available program versions.

Usage examples:

ry bluefish available_versions
ry gcc available_versions
#
# File lib/rbt/compile/version.rb, line 166
def check_for_available_versions(
    for_this_program = program?
  )
  require 'rbt/utility_scripts/check_for_available_versions.rb'
  cfav = RBT::Cookbooks::CheckForAvailableVersions.new(
    for_this_program, :do_not_run_yet
  )
  cfav.be_verbose
  cfav.run
end
check_for_binary_duplicates_in_this_directory( i = Dir.pwd ) click to toggle source
#

check_for_binary_duplicates_in_this_directory

This method can be used to check for binary duplicates, aka binaries that exist more than once on the given system, in the given (passed) directory.

#
# File lib/rbt/compile/misc.rb, line 1583
def check_for_binary_duplicates_in_this_directory(
    i = Dir.pwd
  )
  require 'rbt/utility_scripts/check_for_duplicate_binaries.rb'
  RBT::CheckForDuplicateBinaries.new(Dir.pwd)
end
check_for_common_errors() click to toggle source
#

check_for_common_errors

This mehod can be used to check (and handle) errors that we have encountered.

#
# File lib/rbt/compile/problems_and_errors.rb, line 440
def check_for_common_errors
  _ = errors?
  if _.is_a? Array
    _.each {|entry|
      case entry
      # =================================================================== #
      # === Python syntax error: Invalid Syntax
      # =================================================================== #
      when :python_syntax_error_invalid_syntax
        opnerror 'This InvalidSyntax error is often related to the different'
        opnerror 'syntax that python2 and python3 use.'
        # ================================================================= #
        # Consider autoswitching the python-version next:
        # ================================================================= #
        if is_on_roebe?
          if autoswitch_python?
            opne "The configuration file "\
                 "#{slateblue('autoswitch_python.yml')}"\
                 " has been set to true."
            opne "We will consider switching python "\
                 "next (to #{slateblue('python')})."
            result_of_enabling_python2 = enable_python2
            if result_of_enabling_python2 == true
              clear_errors
              do_compile_this_program(
                compile_which_program?
              )
            end
          else
            # ============================================================= #
            # In this case, notify the user that autoswitching could
            # be enabled. This clause here is entered when autoswitching
            # has been disabled.
            # ============================================================= #
            opne 'Do note that you could set the autoswitch-python '\
                 'variable to true.'
            opne "This could be done by modifying the content "\
                 "of the file #{slateblue('autoswitch_python.yml')}."
            opne 'Having autoswitch-python enabled may, however had, '\
                 'also lead to problems sometimes, so'
            opne 'make sure that you really want to enable this '\
                 'functionality, prior to changing that file.'
          end
        end
      # =================================================================== #
      # === A general make-related error
      # =================================================================== #
      when :make_encountered_some_error
        # ================================================================= #
        # This error type is too generic for now - but perhaps in the
        # future we may also handle it somehow, or give the user
        # more information about it.
        # ================================================================= #
      else
        # ================================================================= #
        # For now this "debugging" part only occurs on roebe-systems.
        # ================================================================= #
        if is_on_roebe?
          stderr "Unregistered error: #{slateblue(entry)}"\
                 " (class: #{lightblue(entry.class.to_s)})"
        end
      end
    }
  end
end
check_for_common_problems() click to toggle source
#

check_for_common_problems (problems tag, problem tag)

This method will check for some problems and offer ways to resolve these issues. For this to work, the particular problem at hand has to be registered in the following case/when menu.

This method is for checking problems - but for the time being (Nov 2018) we will also check for common errors within this method. This is perhaps not ideal, but simplifies the code for now. In the future this may have to be changed (or the method may have to be renamed).

#
# File lib/rbt/compile/problems_and_errors.rb, line 150
def check_for_common_problems
  _ = problems?
  if _
    # ===================================================================== #
    # We will only handle registered Symbols next.
    # ===================================================================== #
    if _.is_a? Symbol
      case _ # case tag
      # =================================================================== #
      # === Libtool could not find the library
      # =================================================================== #
      when :libtool_could_not_find_the_library
        if is_on_roebe?
          unless @internal_hash[:invalid_libtool_archive].nil?
            line = @internal_hash[:invalid_libtool_archive]
            try_to_autocorrect_this_erroneous_libtool_entry(line)
          end
        end
      # =================================================================== #
      # === Encountered an invalid libtool archive
      # =================================================================== #
      when :encountered_an_invalid_libtool_archive
        if is_on_roebe?
          unless @internal_hash[:invalid_libtool_archive].nil?
            line = @internal_hash[:invalid_libtool_archive]
            try_to_autocorrect_this_erroneous_libtool_entry(line)
          end
        end
      # =================================================================== #
      # === Libtool can not install to another prefix
      # =================================================================== #
      when :libtool_can_not_install_to_another_prefix
        opne 'Libtool apparently can not install to another prefix.'
        opne 'The main reason for this is usually that the configure script'
        opne 'was run from a directory before, but with another --prefix.'
        opne 'Try to run "make clean" in the base directory or remove the'
        opne 'extracted archive, in order to try to fix this problem.'
        if is_on_roebe?
          opne 'Removing the extracted archive next.'
          remove_the_extracted_archive
        end
      # =================================================================== #
      # === missing_header_ladspa
      # =================================================================== #
      when :missing_header_ladspa
        opne 'The header ladspa.h is missing. This is part of the '\
             'ladspa-sdk package.'
        opne 'The remote URL should be at: '+
              sfancy(return_url_for(:ladspa))
        e
        e 'This program can probably be installed via:'
        e
        e "  #{sfancy('rbt ladspa')}"
        e
      # =================================================================== #
      # === Incomplete configure error via cmake
      #
      # This entry point is for cmake-related errors that are not further
      # specified - in other words, generic cmake-related errors.
      # =================================================================== #
      when :incomplete_configure_error_via_cmake
        do_skip_postinstall_actions
        opne "Something went wrong via `#{powderblue('cmake')}`."
      # =================================================================== #
      # === The totem playlist was not found
      # =================================================================== #
      when :totem_playlist_was_not_found
        opne 'The totem playlist was not found. You can try '\
             'to compile it:'
        e
        opne sfancy('  rbt totem-playlist')
        e
      # =================================================================== #
      # === Missing C .h (header) file
      # =================================================================== #
      when :missing_c_header_file
        opne swarn('An important C .h file is missing - the compilation can '\
             'not proceed.')
        # ================================================================= #
        # The next line was added on 22.08.2018. I wanted to make sure to
        # easily look at the error for programs that have failed, like
        # this program here.
        # ================================================================= #
        do_not_remove_extracted_archive
        which_h_file = sys_command_string?.select {|inner_line|
          inner_line.include?('fatal error:') and inner_line.include?('No such file or directory')
        }
        use_this_regex = /fatal error. (.+\.h):/
        which_h_file.first =~ use_this_regex
        this_file = $1.to_s.dup
        case this_file
        # ================================================================= #
        # === xf86Resources.h
        # ================================================================= #
        when 'xf86Resources.h'
          opne "The file #{sfile(this_file)} belongs to the very old package"
          opne 'xf86-video-amd-2.7.7.7.tar.xz. This has not been updated since'
          opne '2008 so things will most likely no longer compile.'
        end
      # =================================================================== #
      # === Python import error: an undefined symbol
      #
      # Note that this is a problem, not necessarily an error.
      # =================================================================== #
      when :python_import_error_undefined_symbol
        opne 'A python '+swarn('ImportError')+' has happened, about '\
             'a missing/undefined Symbol.'
        if sys_command_string?.any? {|inner_line|
            inner_line.include? 'lib/gobject-introspection'
          }
          opne 'The problem appears to be somehow related to gobject-introspection.'
          opne 'This error may appear when different python versions or '
          opne 'different library locations are used at the same time.'
        end
      # =================================================================== #
      # === Docbook failed to load a network entity
      #
      # This entry point is related to docbook.
      # =================================================================== #
      when :docbook_failed_to_load_a_network_entity
        opne 'Docbook failed to load a (remote) network entity.'
        opne 'In theory, this could be resolved by installing the docbook'
        opne 'stack, but this is not trivial. Have a look at the LFS'
        opne 'page for now:'
        e '  '+sfancy(::RBT.return_blfs_entry_for('docbook'))
      # =================================================================== #
      # === No configure file
      # =================================================================== #
      when :no_configure_file
        opnn; _ = 'No '+sfancy('configure')+' file was found.'
      # =================================================================== #
      # === Jam is missing
      # =================================================================== #
      when :jam_is_missing
        do_skip_postinstall_actions
        notify_the_user_that_this_program_is_missing(:jam)
      # =================================================================== #
      # === Meson could not be found
      # =================================================================== #
      when :meson_could_not_be_found
        do_skip_postinstall_actions
        notify_the_user_that_this_program_is_missing(:meson) {
          e orange(
              'Note that this will require a recent python 3.x '\
              'version on your host system.'
            )
          e orange(
              'Additionally, you may need the build tool called '\
              'ninja:'
            )
          e
          e '  '+sfancy('rbt ninja')
          e
        }
      end
    elsif _.is_a? Array
      _ = problem?
      first = _.first
      last  = _.last
      last  = last.first if last.is_a? Array
      case first # case tag
      # =================================================================== #
      # === python_import_error_missing_module
      # =================================================================== #
      when :python_import_error_missing_module
        opne "The python module `#{sfancy(last)}` is missing."
        case last
        # ================================================================= #
        # === libxml2
        # ================================================================= #
        when 'libxml2','libxml'
          opne 'You may be able to resolve this problem, by '\
               'compiling libxml2:'
          e
          opne "  #{sfancy('rbt libxml2')}"
          e
        end
      end
    end
  end
end
check_for_common_problems_and_common_errors() click to toggle source
#

check_for_common_problems_and_common_errors

#
# File lib/rbt/compile/problems_and_errors.rb, line 133
def check_for_common_problems_and_common_errors
  check_for_common_problems
  check_for_common_errors
end
check_for_early_commandline_arguments(i) click to toggle source
#

check_for_early_commandline_arguments

Check for compound-input here. But only for some input - for now we only respond to “update-entry”, “–remove-global-flag” and “–add-global-flag”.

#
# File lib/rbt/compile/commandline.rb, line 30
def check_for_early_commandline_arguments(i)
  if i.is_a? Array
    i = i.join(' ').strip
  end
  case i # case tag
  # ======================================================================= #
  # === --add_global_flag
  # ======================================================================= #
  when /^-?-?add(-|_)?global(-|_)?flag (-?-?.+)$/
    add_this_global_flag($3)
  # ======================================================================= #
  # === --remove_global_flag
  # ======================================================================= #
  when /^-?-?remove(-|_)?global(-|_)?flag (-?-?.+)$/
    remove_this_global_flag($3)
  # ======================================================================= #
  # === --update-entry
  # ======================================================================= #
  when /^-?-?update-?entry (http.+)$/
    update_this_entry($1.to_s.dup)
    exit_program
  end
end
check_for_inclusion() click to toggle source
#

check_for_inclusion

We will check the source directory for program-inclusion.

To invoke this method, try something like this:

ry htop --check_for_inclusion
#
# File lib/rbt/compile/misc.rb, line 2941
def check_for_inclusion
  RBT::Cookbooks::CheckForInclusion.new # bl $RUBY_COOKBOOKS/lib/cookbooks/check_for_inclusion.rb
end
check_for_latest() click to toggle source
#

check_for_latest

Method-Wrapper over class LocalCheckForLatest.

Invocation example:

ry --checkforlatest
#
# File lib/rbt/compile/misc.rb, line 2783
def check_for_latest
  RBT::Cookbooks::LocalCheckForLatest.new # bl $RUBY_COOKBOOKS/lib/cookbooks/local_check_for_latest.rb
end
check_for_problems_again()
check_for_sed_action() click to toggle source
#

check_for_sed_action (sed tag)

Some programs have a sed-entry. We thus need a method to handle these sed entries.

As of August 2017, we will delegate towards class RBT::SedWrapper to deal with sed-related editing. However had, since as of February 2018, we will use system-sed (the binary called “sed”), if it is available. The reason as to why is because my sed-wrapper is incomplete and buggy.

Perhaps one day class SedWrapper may work reliably, but for the time being, and as new default, we will not use the SedWrapper by default.

#
# File lib/rbt/compile/sed.rb, line 29
def check_for_sed_action
  _ = sed? # Note that this ought to be an Array.
  if _ and !_.empty?
    if use_the_internal_sed_wrapper?
      unless _.empty?
        notify_the_user_that_we_will_use_sed_from_the_pwd
        _.each {|sed_line| # Must be an Array.
          opnn; e 'Next applying the following sed-operation:'
          apply_sed_operation_on(sed_line)
        }
      end
    else
      # ===================================================================== #
      # Else we will delegate towards class ApplySedOperations.
      # ===================================================================== #
      RBT::ApplySedOperations.new(_)
    end
  end
end
check_whether_the_given_input_is_a_file_and_does_exist?() click to toggle source
#

check_whether_the_given_input_is_a_file_and_does_exist?

#
# File lib/rbt/compile/misc.rb, line 2007
def check_whether_the_given_input_is_a_file_and_does_exist?
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist]
end
chop_off_revision_number() click to toggle source
#

chop_off_revision_number

#
# File lib/rbt/compile/cookbook_dataset.rb, line 691
def chop_off_revision_number
  cookbook_dataset?.chop_off_revision_number
end
clear_commandline_arguments()
clear_commandline_options() click to toggle source
#

clear_commandline_options

#
# File lib/rbt/compile/commandline.rb, line 94
def clear_commandline_options
  @internal_hash[:commandline_arguments] = []
end
Also aliased as: clear_commandline_arguments
clear_configure_options() click to toggle source
#

clear_configure_options

#
# File lib/rbt/compile/misc.rb, line 3246
def clear_configure_options
  @internal_hash[:configure_options] = nil
  cookbook_dataset?.clear
end
clear_env( be_verbose = true ) click to toggle source
#

clear_env

This method will clear ENV. This may sometimes be necessary to start from a clean state.

#
# File lib/rbt/compile/env.rb, line 44
def clear_env(
    be_verbose = true
  )
  if be_verbose
    opnn; e "Clearing (resetting) the environment variable of "\
            "ruby via #{slateblue('ENV.clear()')}."
  end
  ENV.clear
end
clear_env_variables_but_ensure_the_path_variable_works() click to toggle source
#

clear_env_variables_but_ensure_the_path_variable_works

#
# File lib/rbt/compile/env.rb, line 14
def clear_env_variables_but_ensure_the_path_variable_works
  old_path = query_path?
  clear_env
  unless old_path.empty?
    # ===================================================================== #
    # Set a new PATH here, as otherwise compilation would fail.
    # ===================================================================== #
    opnn; e "Note that this will lead to compile-time failures because "\
            "#{orange('$PATH')}"
    opnn; e 'would not be set. We will use the old path entry '\
            'there as a consequence:'
    opnn; e sfancy("  #{old_path}")
    set_path(old_path)
  end
end
clear_errors() click to toggle source
#

clear_errors

#
# File lib/rbt/compile/problems_and_errors.rb, line 430
def clear_errors
  RBT.clear_errors
end
clear_global_flags() click to toggle source
#

clear_global_flags

Clear the global files in use that may be stored in the file global_flags.yml.

#
# File lib/rbt/compile/misc.rb, line 2696
def clear_global_flags
  _ = RBT.file_global_flags
  if File.exist?(_) and !File.empty?(_)
    zero_this_global_flag_file(_)
  end
  if is_on_roebe? # And on my home system as well.
    _ = ROEBE_FILE_GLOBAL_FLAGS
    zero_this_global_flag_file(_)
  end
end
clear_old_configure_options() click to toggle source
#

clear_old_configure_options

#
# File lib/rbt/compile/cookbook_dataset.rb, line 114
def clear_old_configure_options
  set_configure_options('')
end
clear_problems() click to toggle source
#

clear_problems

Reset the problems, so that we don't have any problems.

#
# File lib/rbt/compile/problems_and_errors.rb, line 370
def clear_problems
  problem_is :no_problem
end
cmake_exists?() click to toggle source
#

cmake_exists?

#
# File lib/rbt/compile/cmake.rb, line 14
def cmake_exists?
  result = `cmake #{ERROR_LINE}`
  !result.include?('cmake: command not found')
end
Also aliased as: is_cmake_available?
cmake_file?()
Alias for: cmake_file_exists?
cmake_file_exists?() click to toggle source
#

cmake_file?

#
# File lib/rbt/compile/cmake.rb, line 51
def cmake_file_exists?
  File.exist? 'CMakeLists.txt'
end
Also aliased as: cmake_file?
colourize_parser?() click to toggle source
#

colourize_parser?

#
# File lib/rbt/compile/system.rb, line 127
def colourize_parser?
  @internal_hash[:colourize_parser]
end
commandline()
commandline?()
commandline_args?()
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/rbt/compile/commandline.rb, line 16
def commandline_arguments?
  @internal_hash[:commandline_arguments]
end
commandline_options?()
compile_all_games() click to toggle source
#

compile_all_games

This method can be used to compile all registered games.

#
# File lib/rbt/compile/misc.rb, line 3280
def compile_all_games
  compile_all_programs_that_belong_to_this_tag(:game)
end
compile_all_kde5_plasma_components() click to toggle source
#

compile_all_kde5_plasma_components

Invocation example:

ry --compile-all-kde5-plasma-components
#
# File lib/rbt/compile/kde.rb, line 83
def compile_all_kde5_plasma_components
  _ = return_kde5_plasma
  opne 'We will next compile all '+
       lightgreen(_.size.to_s)+
       ' KDE5 plasma-components:'
  set_compile_these_programs(_)
end
compile_all_lxqt_components() click to toggle source
#

compile_all_lxqt_components

This entry point allows us to compile all LxQT components, e. g. for the lxqt-desktop.

To compile all LXQT components, try this on the commandline:

ry --compile-lxqt
#
# File lib/rbt/compile/lxqt.rb, line 20
def compile_all_lxqt_components
  return_lxqt_components.each {|this_component|
    do_compile_this_program(this_component)
  }
end
compile_all_of_xfce() click to toggle source
#

compile_all_of_xfce

#
# File lib/rbt/compile/xfce.rb, line 14
def compile_all_of_xfce
  do_compile_these_programs(
    return_xfce_components
  )
end
compile_all_programs( shall_we_exit = true ) click to toggle source
#

compile_all_programs

This method is a direct approach to compile every program that we have registered, in our database.

This method accepts one argument, which decides whether we will quit afterwards or whether we will not.

Invocation example:

ry --compile_all_programs
#
# File lib/rbt/compile/misc.rb, line 1423
def compile_all_programs(
    shall_we_exit = true
  )
  case shall_we_exit
  when :do_exit_afterwards
    shall_we_exit = true
  end
  _ = return_available_programs.shuffle # We shuffle for more "randomness".
  n_programs = _.size.to_s
  clear_commandline_options
  opnn; e sfancy('Compiling all available programs next (by a brute'\
          'force approach - we found ')+
          simp(n_programs)+sfancy(' programs):')
  compile_every_program(_)
  exit_program if shall_we_exit
end
compile_all_programs_that_belong_to_this_tag(i) click to toggle source
#

compile_all_programs_that_belong_to_this_tag

Invocation examples:

rbt --compile-this-tag=gnome
rbt --compile-this-tag=kde
rbt --compile-this-tag=kde5
rbt --compile-this-tag=game
#
# File lib/rbt/compile/misc.rb, line 3262
def compile_all_programs_that_belong_to_this_tag(i)
  # ======================================================================= #
  # (1) first obtain all programs that belong to a particular tag
  # ======================================================================= #
  these_programs = RBT.return_array_of_this_tag(i)
  # ======================================================================= #
  # (2) then set to the main array
  # ======================================================================= #
  set_compile_these_programs(
    these_programs
  )
end
compile_as_appdir( optional_command_given = nil, be_verbose = true )
compile_every_program( i = compile_these_programs? )
compile_into_the_home_directory() click to toggle source
#

compile_into_the_home_directory

#
# File lib/rbt/compile/prefix.rb, line 77
def compile_into_the_home_directory
  set_user_prefix('$HOME')
end
compile_into_the_home_directory_as_appdir() click to toggle source
#

compile_into_the_home_directory_as_appdir

This method will enable compilation into the user's home directory, via AppDir style.

Invocation example:

rbt xwd --homedir
#
# File lib/rbt/compile/prefix.rb, line 221
def compile_into_the_home_directory_as_appdir
  set_user_prefix('$HOME'+static_appdir_prefix?)
end
compile_kde_apps() click to toggle source
#

compile_kde_apps

#
# File lib/rbt/compile/kde.rb, line 53
def compile_kde_apps
  set_compile_these_programs(
    return_kde5_applications
  )
end
compile_mate_desktop_components_into_one_standalone_directory() click to toggle source
#

compile_mate_desktop_components_into_one_standalone_directory

To invoke this method from the commandline, do:

ry --mate-desktop-into-standalone-dir
#
# File lib/rbt/compile/mate_desktop.rb, line 84
def compile_mate_desktop_components_into_one_standalone_directory
  _ = return_mate_desktop_components
  # ======================================================================= #
  # We currently (Oct 2018) will use a hardcoded path. This may change
  # at a later point in the future.
  # ======================================================================= #
  use_this_prefix = "#{programs_dir?}Mate/1.20/"
  set_use_this_prefix(use_this_prefix)
  batch_compile_the_programs(_)
end
compile_mouse_and_keyboard_xorg_server_components() click to toggle source
#

compile_mouse_and_keyboard_xorg_server_components

To compile the entries in this method, issue:

ry --compile-mouse-and-keyboard
#
# File lib/rbt/compile/xorg.rb, line 19
def compile_mouse_and_keyboard_xorg_server_components
  array_components = %w(
    xf86-input-evdev
    xf86-input-joystick
    xf86-input-libinput
    xf86-input-mtrack
    xf86-input-synaptics
    xf86-input-vmmouse
    xf86-input-wacom
  )
  opnn; e "Next compiling `#{royalblue(array_components.size.to_s)}` programs:"
  array_components.each {|this_component|
    do_compile_this_program(this_component)
  }
end
compile_post_xorg_server_components() click to toggle source
#

compile_post_xorg_server_components

Invocation example for this method:

ry --post-xorg-server
#
# File lib/rbt/compile/xorg.rb, line 43
def compile_post_xorg_server_components
  _ = report_post_xorg_server_components
  opnn; e "Next compiling `#{royalblue(_.size.to_s)}` programs:"
  _.each {|this_program|
    do_compile_this_program(this_program)
  }
end
compile_the_main_program_including_the_dependencies() click to toggle source
#

compile_the_main_program_including_the_dependencies

#
# File lib/rbt/compile/misc.rb, line 2110
def compile_the_main_program_including_the_dependencies
  ensure_that_the_main_dataset_exists
  compile_these_programs?.prepend(
    required_deps_on?
  )
  compile_these_programs?.flatten!
end
compile_these_programs?()
compile_these_tags(i) click to toggle source
#

compile_these_tags

Invocation example:

rbt --tag_compile=science
#
# File lib/rbt/compile/tags.rb, line 20
def compile_these_tags(i)
  opnn; e "We will next find all programs that have the "\
          "tag `#{sfancy(i)}`."
  _ = ::RBT.return_array_of_this_tag(i) # This depends on ScanForTags.
  set_compile_these_programs(_)
end
compile_this_program( this_program )
compile_this_program?() click to toggle source
#

compile_this_program

Query which program we are about to (want to) compile next.

#
# File lib/rbt/compile/compile.rb, line 203
def compile_this_program?
  @internal_hash[:compile_this_program]
end
compile_which_program?()
compile_which_programs?() click to toggle source
#

compile_which_programs?

#
# File lib/rbt/compile/misc.rb, line 2121
def compile_which_programs?
  @internal_hash[:compile_these_programs]
end
Also aliased as: compile_these_programs?
compile_xfce_components_into_one_standalone_directory() click to toggle source
#

compile_xfce_components_into_one_standalone_directory

To invoke this method from the commandline, do:

ry --xfce-into-standalone-dir
#
# File lib/rbt/compile/xfce.rb, line 28
def compile_xfce_components_into_one_standalone_directory
  _ = return_xfce_components
  # ======================================================================= #
  # We currently (Oct 2018) will use a hardcoded path. This may change
  # at a later point in the future.
  # ======================================================================= #
  use_this_prefix = programs_dir?+'Xfce/4.12/'
  set_use_this_prefix(
    use_this_prefix
  )
  batch_compile_the_programs(_)
end
compiled_n_times?()
compiled_programs?() click to toggle source
#

compiled_programs?

This will grab the full dataset of compiled_programs.yml

#
# File lib/rbt/compile/misc.rb, line 3157
def compiled_programs?
  _ = RBT.file_compiled_programs
  if File.exist? _
    return YAML.load_file(_)
  else
    opne "The file at #{sfile(_)} does not exist."
  end
end
compiler_to_use?() click to toggle source
#

compiler_to_use?

#
# File lib/rbt/compile/misc.rb, line 454
def compiler_to_use?
  @internal_hash[:compiler_to_use]
end
config?()
Alias for: configuration?
configuration?() click to toggle source
#

configuration?

#
# File lib/rbt/compile/misc.rb, line 3071
def configuration?
  RBT.configuration?
end
Also aliased as: config?
configure_base_dir?()
configure_base_directory?() click to toggle source
#

configure_base_directory?

This should always have a trailing '/' character IF it is defined. class Cookbook will make sure of that.

#
# File lib/rbt/compile/configure.rb, line 240
def configure_base_directory?
  @internal_hash[:configure_base_directory]
end
configure_base_directory_to_use?()
configure_command?()
configure_has_a_higher_priority_than_meson?() click to toggle source
#

configure_has_a_higher_priority_than_meson?

This method will return true if “configure” has a higher priority than “meson”. A yaml file keeps track of these priorities.

#
# File lib/rbt/compile/misc.rb, line 833
def configure_has_a_higher_priority_than_meson?
  ::RBT.configure_has_a_higher_priority_than_meson?
end
configure_options?() click to toggle source
#

configure_options?

This method will retrieve the configure options. We default to using the configure-options stored in the cookbook dataset, but we can overrule this on the commandline (when we store it onto the @internal_hash).

#
# File lib/rbt/compile/configure.rb, line 33
def configure_options?
  _ = cookbook_dataset_configure_options?
  if @internal_hash[:configure_options]
    _ = @internal_hash[:configure_options]
  end
  _
end
configure_script?()
configure_script_exists?() click to toggle source
#

configure_script_exists?

#
# File lib/rbt/compile/misc.rb, line 503
def configure_script_exists?
  File.exist?('configure')
end
Also aliased as: configure_script?
consider_applying_a_patch() click to toggle source
#

consider_applying_a_patch

Check whether we should apply a patch_set or not.

This should happen before we make use of preinstall, and after displaying an optional start message.

#
# File lib/rbt/compile/misc.rb, line 979
def consider_applying_a_patch
  apply_patch = apply_patch?
  if apply_patch
    patchset = apply_patch
    patchset = [patchset] unless patchset.is_a? Array
    patchset.flatten.each {|this_patchset|
      cliner {
        opne simp('Trying to ')+
             orange('apply a patch')+
             simp(' next:')+
             simp(' (in ')+
             sdir(configure_base_directory?)+
             simp(')')
        opne "  #{this_patchset}"
      }
      # =================================================================== #
      # (1) Download the patch unless it exists locally.
      # =================================================================== #
      unless File.exist? File.basename(this_patchset)
        do_download_this_program(this_patchset)
      end
      this_command = "patch -Np1 -i #{File.basename(this_patchset)}"
      opne "Running this command next (from directory "\
           "#{sdir(return_pwd)}): #{sfancy(this_command)}"
      # =================================================================== #
      # (2) Run the patchset.
      # =================================================================== #
      custom_system(this_command) # Delegate to Kernel#system.
    }
  end
end
consider_changing_the_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title] ) click to toggle source
#

consider_changing_the_tab_title (shell tag)

Use this method to change the title of a tab in a Terminal like Bash.

#
# File lib/rbt/compile/tab.rb, line 39
def consider_changing_the_tab_title(
    i                             = return_program_name_then_hyphen_then_the_program_version,
    shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title]
  )
  case shall_we_rename_the_tab_title
  when :do_rename
    shall_we_rename_the_tab_title = true
  end
  # ======================================================================= #
  # First check whether we ought to rename the tab title or not.
  # ======================================================================= #
  if shall_we_rename_the_tab_title
    case i
    when :default
      # This is the current hardcoded default. May change at a later time.
      i = return_program_name_then_hyphen_then_the_program_version
    when :clear
      i = '.'
    end
    # ===================================================================== #
    # Query whether Roebe is available or not.
    # ===================================================================== #
    if Object.const_defined?(:Roebe) and
       rename_tab_title? # Only use it if the user enabled this.
      if Roebe.respond_to? :rename_konsole_title_to
        Roebe.rename_konsole_title_to(i, :be_quiet)
      else
        e "The namespace #{sfancy('Roebe')} does not respond to the method"
        e 'rename_konsole_title_to()'
        e 'Either the functionality is missing - or something has not'
        e 'been properly required. Either way, we can not rename the'
        e 'konsole tab for now.'
      end
    end
  end unless i.empty?
end
consider_comparing_the_installed_libraries_versus_the_assumed_libraries() click to toggle source
#

consider_comparing_the_installed_libraries_versus_the_assumed_libraries

This method will try to compare the installed libraries in an AppDir with the ones that are registered in the various cookbook .yml files.

This will happen ONLY if we are on roebe; and ONLY if we use an AppDir approach.

#
# File lib/rbt/compile/misc.rb, line 1283
def consider_comparing_the_installed_libraries_versus_the_assumed_libraries
  if is_on_roebe? and is_an_appdir_installation? and
    has_been_installed_successfully?
    assumed_libraries = RBT.infer_these_libraries_will_be_installed_by(
      compile_which_program?
    )
    if assumed_libraries
      libraries?.each {|this_already_registered_library|
        # ================================================================= #
        # The variable this_already_registered_library may be something
        # like 'libgmodule-2.0.so'.
        # ================================================================= #
        if assumed_libraries.any? {|entry|
            entry.include? this_already_registered_library
          }
        else
          opnn; e 'The library '+
                  orange(this_already_registered_library)+
                  ' is not registered.'
          opnn; e 'Consider '+crimson('updating')+' it (file: '+
                  sfile(compile_which_program?+'.yml')+
                  ').'
        end
      }
    end
  end
end
consider_creating_and_populating_the_pkgconfig_directory() click to toggle source
#

consider_creating_and_populating_the_pkgconfig_directory

#
# File lib/rbt/compile/misc.rb, line 3026
def consider_creating_and_populating_the_pkgconfig_directory
  if uses_an_appdir_prefix?
    CreateAndPopulatePkgconfigDirectory.new(appdir_prefix?)
  end
end
consider_creating_appdir_skeleton( i = return_proper_prefix ) click to toggle source
#

consider_creating_appdir_skeleton

This method will create an AppDir skeleton, by delegating towards class RBT::CreateProgram.

We will only do so if the prefix includes the AppDir base directory though. By default, that base directory would hold the value of the $PROGRAMS environment variable - at the least on my system, this defaults to /Programs/. You can change this value if you modify a yaml file though. That yaml file is called “programs_dir.yml” and resides in the yaml/configuration/ subdirectory of the RBT project.

The method accepts one argument, which is either the program name, or alternatively the full name to the program in question.

Normally, the program name will be defined in the yaml data object, but since you can also overrule this setting in the yaml file, we need an argument here to allow this too.

#
# File lib/rbt/compile/create_program.rb, line 34
def consider_creating_appdir_skeleton(
    i = return_proper_prefix
  )
  # ======================================================================= #
  # Check for an AppDir prefix next:
  # ======================================================================= #
  i = i.to_s.dup
  if i.include? programs_dir?
    unless i =~ /\d+/
      i << program_version?
    end
    i << '/' unless i.end_with? '/'
    # ===================================================================== #
    # Next, delegate towards class RBT::CreateProgram.
    # ===================================================================== #
    _ = RBT::CreateProgram.new(i, :dont_run_yet) {{
      use_colours: use_colours?,
      use_opn:     use_opn?
    }}
    _.run_simulation = run_simulation?
    # _.set_base_directory = programs_directory? # <-- I think this is no longer needed.
    _.run
  end
end
consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install() click to toggle source
#

consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install

#
# File lib/rbt/compile/misc.rb, line 60
def consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install
  consider_creating_appdir_skeleton
  consider_running_autoconf_then_run_configure_then_make_then_make_install
end
consider_creating_the_build_directory()
consider_displaying_the_start_message() click to toggle source
#

consider_displaying_the_start_message

#
# File lib/rbt/compile/misc.rb, line 643
def consider_displaying_the_start_message
  _ = cookbook_dataset?.optional_start_message
  if _
    unless _.empty? 
      opne sfancy(_)
    end
  end
end
consider_enabling_python2( shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?) ) click to toggle source
#

consider_enabling_python2

This may ensure that we will use python 2.x, primarily due to the meson build system. Right now it only works on roebe-systems though.

It can also be enabled from the commandline, such as by issuing the following command:

rbt --enable-python2
#
# File lib/rbt/compile/python.rb, line 148
def consider_enabling_python2(
    shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?)
  )
  if shall_we_enable_python_2
    # ======================================================================= #
    # Try to use python version 3 here.
    # ======================================================================= #
    if File.directory?(programs_directory?+'Python/')
      availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry|
        File.directory? entry
      }.select {|entries_with_numbers|
        entries_with_numbers =~ /\d+/
      }.select {|entries_that_might_be_python_version_two|
        entries_that_might_be_python_version_two.include? 'Python/2'
      }
      unless availabe_python_versions.empty?
        use_this_python_version = availabe_python_versions.first
        unless RBT.const_defined? :ToCurrent
          require 'rbt/utility_scripts/to_current.rb'
        end
        RBT::ToCurrent.new(use_this_python_version)
        return true # Determine that it was a success.
      end
    end
  end
  false
end
Also aliased as: do_use_python2
consider_enabling_python3( shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?) ) click to toggle source
#

consider_enabling_python3

This may ensure that we will use python 3.x, primarily due to the meson build system. Right now it only works on roebe-systems though.

It can also be enabled from the commandline, such as by issuing the following command:

rbt --enable-python3
#
# File lib/rbt/compile/python.rb, line 193
def consider_enabling_python3(
    shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?)
  )
  if shall_we_enable_python_3
    # ======================================================================= #
    # Try to use python version 3 here.
    # ======================================================================= #
    if File.directory?(programs_directory?+'Python/')
      availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry|
        File.directory? entry
      }.select {|entries_with_numbers|
        entries_with_numbers =~ /\d+/
      }.select {|entries_that_might_be_python_version_three|
        entries_that_might_be_python_version_three.include? 'Python/3'
      }
      unless availabe_python_versions.empty?
        use_this_python_version = availabe_python_versions.first
        unless RBT.const_defined? :ToCurrent
          require 'rbt/utility_scripts/to_current.rb'
        end
        RBT::ToCurrent.new(use_this_python_version)
        return true # Determine that it was a success.
      end
    end
  end
  false
end
Also aliased as: do_use_python3
consider_extracting_this_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
consider_handling_build_directory() click to toggle source
#

consider_handling_build_directory

This method can create a build directory, that is, a directory which will keep other generated files and directories inside of it.

#
# File lib/rbt/compile/build_directory.rb, line 30
def consider_handling_build_directory
  if use_build_directory?
    # ===================================================================== #
    # First determine the path we ought to use for the build directory.
    #
    # This has to be a correct path since we depend on it for the
    # change_directory action lateron. Note that if the name for the
    # build directory begins with a '/' then it will be used as the
    # full build directory instead - in this case we assume that the
    # user knew what he wanted to do.
    # ===================================================================== #
    if name_for_the_build_directory?.start_with? '/'
      use_this_as_path_to_the_build_directory =
        name_for_the_build_directory?.dup
    else
      use_this_as_path_to_the_build_directory = 
        @internal_hash[:configure_base_directory]+
        name_for_the_build_directory?
    end
    # ===================================================================== #
    # Delegate towards class BuildDirectory next:
    # ===================================================================== #
    build_directory = BuildDirectory.new(
      path_to_build_directory: use_this_as_path_to_the_build_directory.dup
    )
    # ===================================================================== #
    # Next assign it onto the @internal_hash variable:
    # ===================================================================== #
    @internal_hash[:build_directory] = build_directory
    build_directory.silently_make_sure_that_the_build_directory_exists
    opnn; build_directory.cd :be_verbose # cd into that directory.
  end
end
consider_invoking_autoconf()
consider_making_use_of_cookbook_aliases() click to toggle source
#

consider_making_use_of_cookbook_aliases

#
# File lib/rbt/compile/misc.rb, line 2303
def consider_making_use_of_cookbook_aliases
  unless make_use_of_cookbook_aliases? == :user_disabled_this_setting_via_the_commandline
    @internal_hash[:make_use_of_cookbook_aliases] = true
  end
end
consider_modifying_postinstall( i = program_version? )
consider_modifying_postinstall_with_this_prefix( i = program_version? ) click to toggle source
#

consider_modifying_postinstall_with_this_prefix

This method can be used to modify all prefix-targets in the postinstall Array.

We will only modify the program_version normally here.

#
# File lib/rbt/compile/misc.rb, line 1338
def consider_modifying_postinstall_with_this_prefix(
    i = program_version?
  )
  return unless i
  unless i.start_with? '/'
    i = i.dup if i.frozen?
    i.prepend('/') # A bit hackish as a workaround but this works.
  end
  # ======================================================================= #
  # The regex is also stored here:
  #
  #   https://rubular.com/r/U7J9cbbqUBPI
  #
  # ======================================================================= #
  regex_to_use = /\/(\d{1,2}\.?\d{1,2}\.?\d{0,2})/
  set_postinstallation(
    cookbook_dataset_postinstallation?.map {|line|
      # =================================================================== #
      # We must use .gsub!() here rather than .sub!() because the
      # full line may be like this:
      #
      #   ln -s /Programs/Gtk+/3.24.1/include/gtk-2.0 /Programs/Gtk+/3.24.1/include/gtk
      #
      # =================================================================== #
      line.gsub!(regex_to_use, i)
      line
    }
  )
end
consider_performing_postinstallation_actions() click to toggle source
#

consider_performing_postinstallation_actions (postinstall tag, post tag)

Postinstall actions are optional - they are done after the “make install” step has finished.

This method here handles postinstall-related actions, like starting a service after compilation has finished, or removing a directory after installation - these sorts of actions.

A song may also be played if the configuration option tells us to do so. (This may give us an audio-cue that compilation has finished. I no longer make use of this, but if others want to, here we go)

We make use of RBT::SymlinkProgram to symlink the AppDir properly, in the event that we compile into AppDirs.

Since as of February 2019, a separate class handles these postinstallation steps.

As a summary and an overview, these are valid postinstall actions:

- Running cleanup actions
- Renaming a shell (optional)
- Playing a song (when the configuration option told us to do so)
- Symlinking files after installation
- Copying several files to another location
- Deleting any .la files if the user specified so (this is
  now the default; RBT::Compile will always try to remove
  .la files under an AppDir prefix, unless the user has
  specified otherwise)
#
# File lib/rbt/compile/postinstallation_step.rb, line 129
def consider_performing_postinstallation_actions
  # ======================================================================= #
  # Only run these actions if we actually do run postinstall actions:
  # ======================================================================= #
  if run_postinstall_actions? and can_we_continue?
    # ===================================================================== #
    # Next delegate towards class RBT::PostinstallationStep.
    # ===================================================================== #
    RBT::PostinstallationStep.new(
      return_hash_for_the_postinstallation_step
    )
  end
end
Also aliased as: do_postinstall_actions
consider_removing_empty_subdirectories() click to toggle source
#

consider_removing_empty_subdirectories

We will remove empty subdirectories but only from AppDir-like prefixes.

#
# File lib/rbt/compile/misc.rb, line 1925
def consider_removing_empty_subdirectories
  if uses_an_appdir_prefix?
    prefix = prefix?.to_s # <- This will be like "/Programs/Gcide/0.52/".
    subdirectories = Dir[prefix+'*'].select {|entry|
      File.directory?(entry) and Dir.empty?(entry)
    }
    remove_directories(
      subdirectories
    )
    consider_removing_the_current_symlink_if_the_directory_is_empty
    consider_removing_the_settings_directory_if_it_is_empty
    consider_removing_the_empty_versioned_directory
    consider_removing_the_empty_base_directory_of_the_program
  end
end
consider_removing_extracted_archive( where = :build_anew )
consider_removing_the_empty_base_directory_of_the_program() click to toggle source
#

consider_removing_the_empty_base_directory_of_the_program

#
# File lib/rbt/compile/misc.rb, line 1944
def consider_removing_the_empty_base_directory_of_the_program
  if uses_an_appdir_prefix? and !is_a_gem_file?
    target = rds(
      programs_dir?+program_name?.capitalize.delete('-_')+'/'
    )
    if File.directory?(target) and
       Dir.empty?(target)
      opne 'Removing the empty directory at `'+sdir(target)+'` next.'
      remove_this_directory(target)
    end
  end
end
consider_removing_the_empty_versioned_directory() click to toggle source
#

consider_removing_the_empty_versioned_directory

#
# File lib/rbt/compile/misc.rb, line 1977
def consider_removing_the_empty_versioned_directory
  if uses_an_appdir_prefix?
    prefix = prefix?.to_s
    if File.directory?(prefix) and
      Dir.empty?(prefix)
      remove_this_directory(prefix)
    end
  end
end
consider_removing_the_extracted_archive( where = :build_anew )
consider_removing_the_extracted_directory( where = :build_anew )
consider_removing_the_settings_directory_if_it_is_empty() click to toggle source
#

consider_removing_the_settings_directory_if_it_is_empty

This method will attempt to remove the /Settings subdirectory, if it is empty.

#
# File lib/rbt/compile/misc.rb, line 1963
def consider_removing_the_settings_directory_if_it_is_empty
  if uses_an_appdir_prefix?
    prefix = prefix?.to_s
    settings_directory = File.dirname(prefix)+'/Settings'
    if File.directory?(settings_directory) and
       Dir.empty?(settings_directory)
      remove_this_directory(settings_directory)
    end
  end
end
consider_renaming_the_kde_konsole_tab( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title] )
consider_reporting_the_cflags_we_will_use() click to toggle source
#

consider_reporting_the_cflags_we_will_use

Notify the user which CFLAGS he is using.

#
# File lib/rbt/compile/cflags.rb, line 76
def consider_reporting_the_cflags_we_will_use
  _ = cflags?
  unless _.empty?
    opne "The CFLAGS in use are: #{simp(_)}"
  end
end
consider_reporting_the_time_it_took_to_compile_this_program() click to toggle source
#

consider_reporting_the_time_it_took_to_compile_this_program

#
# File lib/rbt/compile/time.rb, line 97
def consider_reporting_the_time_it_took_to_compile_this_program
  if time_the_compilation? and no_error_has_occurred?
    program_name = compile_which_program?.to_s # Keep a reference.
    _ = @internal_hash[:array_time_compilation]
    # ===================================================================== #
    # We need the start-time and the end-time, in order to calculate
    # the difference.
    # ===================================================================== #
    start_time = @internal_hash[:array_time_compilation][-2]
    end_time   = @internal_hash[:array_time_compilation][-1]
    # ===================================================================== #
    # We must next check that both end time and start time exist, as
    # otherwise we would run into an error.
    # ===================================================================== #
    if start_time and end_time
      duration   = (end_time - start_time)
      rounded_duration = duration.round(3)
      in_minutes = (rounded_duration.to_f / 60.0).round(2)
      if has_to_be_compiled?
        compiling_or_installing = 'Compiling'
      else
        compiling_or_installing = 'Installing'
      end
      # ===================================================================== #
      # Notify the user how long it took to compile/install the given
      # program at hand.
      # ===================================================================== #
      opne "#{compiling_or_installing} the program `"\
           "#{olivedrab(program_name)}"\
           "` took #{sfancy(rounded_duration.to_s)} seconds "\
           "(aka #{sfancy(in_minutes)} minutes)."
      # ===================================================================== #
      # Also store this now into a file.
      # ===================================================================== #
      _ = RBT.file_storing_the_time_it_took_to_compile_programs
      if File.exist? _
        dataset = YAML.load_file(_)
      else
        dataset = {} # Use a Hash format.
      end
      dataset[program_name] = rounded_duration
      opne 'Also storing this information into the file'
      opne "  #{sfile(_)}"
      write_what_into(YAML.dump(dataset), _)
    else
      opne 'Can not store the time as the variable tracking the time'
      opne 'is incorrect. It will be displayed next, to aid in debugging:'
      e
      pp @internal_hash[:array_time_compilation][-1]
      e
    end
  end
end
consider_running_autoconf_then_run_configure_then_make_then_make_install() click to toggle source
#

consider_running_autoconf_then_run_configure_then_make_then_make_install

#
# File lib/rbt/compile/misc.rb, line 51
def consider_running_autoconf_then_run_configure_then_make_then_make_install
  consider_running_the_pre_configure_steps
  decide_whether_to_invoke_the_autoconf_command
  run_configure_then_make_then_make_install
end
consider_running_cleanup_actions()
consider_running_ldconfig()
consider_running_premake_instructions( array = cookbook_dataset_pre_make_commands? )
consider_running_the_installation_steps_if_they_have_been_defined() click to toggle source
#

consider_running_the_installation_steps_if_they_have_been_defined

This method is especially necessary for rubygem related custom installation steps (aka the file “rubygems.yml”).

#
# File lib/rbt/compile/misc.rb, line 732
def consider_running_the_installation_steps_if_they_have_been_defined
  unless cookbook_installation_steps?.empty?
    _ = cookbook_installation_steps?
    _.each {|this_step|
      case this_step
      # =================================================================== #
      # On top of this case-when menu we should put entries that only
      # require a simple esystem() run.
      # =================================================================== #
      # =================================================================== #
      # === Python-based installations
      #
      # We can do /^python setup.py/ here and then pass it into
      # esystem() - but the problem is that a user may not have
      # a "python" binary installed. So this simplistic assumption
      # is not great. This is why we will use run_python_installation()
      # since as of 17.02.2019.
      # =================================================================== #
      when /^python setup.py/
        run_python_installation(this_step)
      # =================================================================== #
      # === ./Build install
      # =================================================================== #
      when './Build install',
           'perl Build.PL' # === perl Build.PL
        esystem this_step
      # =================================================================== #
      # === perl Makefile.PL
      # =================================================================== #
      when /^perl(_|-| )?Makefile.PL$/
        esystem this_step
      # =================================================================== #
      # === make
      # =================================================================== #
      when /^make(_|-| )?install$/
        run_make_install_command
      # =================================================================== #
      # === make
      # =================================================================== #
      when 'make'
        run_make_command
      # =================================================================== #
      # === copy_ruby
      # =================================================================== #
      when /copy(_|-)?ruby/
        copy_ruby
      # =================================================================== #
      # === ruby setup.rb setup
      #
      # We handle config, setup and install next:
      # =================================================================== #
      when /^ruby setup.rb (.+)/
        case $1.to_s.dup
        when 'config'
          ruby_setup_config
        when 'setup'
          ruby_setup_setup
        when 'install'
          ruby_setup_install
        end
      else # else notify the user
        opne 'The installation step '+sfancy(this_step)+' is not yet registered.'
        opne 'This should be changed.'
      end
    }
    delete_file 'setup.rb', :be_quiet
    delete_file 'InstalledFiles', :be_quiet
    delete_file '.config', :be_quiet
    exit # <- This may change at a later time, but for now we keep it this way.
  end
end
consider_running_the_pre_configure_steps() click to toggle source
#

consider_running_the_pre_configure_steps

#
# File lib/rbt/compile/configure.rb, line 16
def consider_running_the_pre_configure_steps
  _ = pre_configure_steps?
  unless _.empty?
    _.each {|entry|
      esystem entry
    }
  end
end
consider_sanitizing_the_program_path() click to toggle source
#

consider_sanitizing_the_program_path

This method will only be used when @internal_hash has been set.

#
# File lib/rbt/compile/misc.rb, line 559
def consider_sanitizing_the_program_path
  if @internal_hash[:use_this_specific_program_version]
    # ===================================================================== #
    # The above variable is nil by default, so if it has another value
    # we can use this.
    # ===================================================================== #
    splitted    = @internal_hash[:use_this_specific_program_version].split('/')
    last        = splitted.last # <- This will hold the new program version.
    old_value   = cookbook_dataset_program_path?.dup
    old_version = ProgramInformation.return_version(old_value)
    set_cookbook_dataset_program_version(
      last
    )
    old_value.sub!(/#{old_version}/, last)
    set_cookbook_dataset_program(
      remove_extension(
        File.basename(old_value)
      )
    )
    set_cookbook_dataset_program_path(old_value)
  end
end
consider_showing_the_infobox() click to toggle source
#

consider_showing_the_infobox

#
# File lib/rbt/compile/infobox.rb, line 18
def consider_showing_the_infobox
  if show_infobox?
    show_infobox(
      cookbook_dataset_with_extended_configure_options?
    )
  end
end
consider_storing_a_snapshot() click to toggle source
#

consider_storing_a_snapshot

This method may store the compilation time into an Array.

#
# File lib/rbt/compile/time.rb, line 156
def consider_storing_a_snapshot
  if @internal_hash[:time_compilation]
    @internal_hash[:array_time_compilation] << Time.now
  end
end
consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy() click to toggle source
#

consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy

Invoke this method if we wish to symlink the schema files into the /usr/ hierarchy.

#
# File lib/rbt/compile/symlink.rb, line 56
def consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy
  if uses_appdir_prefix? and
     use_glib_schema? and
    !an_error_has_occurred?
    # ===================================================================== #
    # Delegate towards class SymlinGlibSchema eventually:
    # ===================================================================== #
    symlink_glib_schema
  end
end
consider_symlinking_pkgconfig_files()
consider_symlinking_the_pkgconfig_files() click to toggle source
#

consider_symlinking_the_pkgconfig_files

If the cookbook has symlinking_pkgconfig_files set to true, and if the program is compiled, as AppDir, then we will symlink .pc files into /usr/lib/pkgconfig/, if the latter one exists.

#
# File lib/rbt/compile/symlink.rb, line 204
def consider_symlinking_the_pkgconfig_files
  target_dir = '/usr/lib/pkgconfig/'
  if symlink_pkgconfig_files? and
     is_appdir_compilation_style? and
     File.directory?(target_dir) and
     !do_not_symlink?
    appdir_target_with_pc_files = "#{return_appdir_prefix}lib/pkgconfig/"
    # ===================================================================== #
    # Delegate towards class SymlinkPkgconfigFiles next.
    # ===================================================================== #
    SymlinkPkgconfigFiles.new(appdir_target_with_pc_files)
  end
end
consider_to_run_ldconfig() click to toggle source
#

consider_to_run_ldconfig (ldconfig tag)

Run 'ldconfig' here in this method.

Check whether we are allowed to invoke this method before calling it however.

#
# File lib/rbt/compile/ldconfig.rb, line 54
def consider_to_run_ldconfig
  if continue_after_make_step? # Makes only sense if we are past the make-step.
    # ===================================================================== #
    # ruby and python add-ons normally do not require ldconfig,
    # so we don't have to invoke it.
    # ===================================================================== #
    if tags?.include?('ruby') or
       tags?.include?('python')
      do_not_run_ldconfig
    end
    # ===================================================================== #
    # Only run it if the config-file tells us to do so and only for
    # those programs that have to be compiled.
    #
    # class RBT::Compile will, however had, NOT run ldconfig when the
    # program has failed to install - that is specifically if an
    # error has occurred.
    # ===================================================================== #
    if run_ldconfig? and
       has_to_be_compiled? and
       can_we_continue? and
      !a_problem_has_occurred? and # Also check for no problem.
      !an_error_has_occurred?
      # =================================================================== #
      # Build up the command to run next.
      # =================================================================== #
      cmd_to_run = 'ldconfig'.dup
      # =================================================================== #
      # We could be verbose, but it is not that useful, so uncomment it.
      # cmd_to_run << ' -v'
      # =================================================================== #
      # Since as of July 2011, we will be quieter and ignore whether
      # ldconfig exists or not.
      # =================================================================== #
      cmd_to_run << ' 2>&1'
      # =================================================================== #
      # Check for superuser privilege next. ldconfig requires the
      # superuser.
      # =================================================================== #
      if is_superuser?
        opne "Now running `#{sfancy(cmd_to_run)}`." # We output the ldconfig command variant here.
        system cmd_to_run
      else
        opne "You are not the superuser so we will not "\
             "try to run `#{sfancy(cmd_to_run)}`."
      end
    end
  end
end
Also aliased as: consider_running_ldconfig
consider_uploading_binaries( upload_binaries = upload_binaries? ) click to toggle source
#

consider_uploading_binaries

This method can be used to upload some binaries.

Invocation example:

ry htop uploadbinaries
#
# File lib/rbt/compile/upload_and_download.rb, line 179
def consider_uploading_binaries(
    upload_binaries = upload_binaries?
  )
  if upload_binaries
    opnn; e 'We will next upload any files found in the bin/ subdirectory.'
    _ = "#{dataset?.prefix}bin/"
    files = Dir["#{_}*"]
    if files.empty?
      opnn; e "No files were found in #{sdir(_)}."
    else
      upload_to(
        files, :default, 'bin'
      )
    end
  end
end
consider_using_maximum_speed_for_compilation() click to toggle source
#

consider_using_maximum_speed_for_compilation

This method also has to check whether we will compile the given program at all or whether we will not.

#
# File lib/rbt/compile/misc.rb, line 3347
def consider_using_maximum_speed_for_compilation
  if use_maximum_speed_for_compilation? and
     the_program_has_to_be_compiled?
    opne "The configuration file "\
         "#{sfile('use_maximum_speed_for_compilation.yml')}"\
         " specified"
    opne 'that maximum speed should be used for for compilation.'
    opne "This means to pass the #{orange('-j')} option "\
         "to the program #{slateblue('make')},"
    opne 'with the number of processors this computer has.'
    speed_up_the_compilation
  end
end
consider_using_this_file_for_the_configure_options_that_are_to_be_used(this_file) click to toggle source
#

consider_using_this_file_for_the_configure_options_that_are_to_be_used

#
# File lib/rbt/compile/misc.rb, line 3228
def consider_using_this_file_for_the_configure_options_that_are_to_be_used(this_file)
  if File.exist? this_file
    opnn; e 'Making use of the file '+sfile(this_file)+' for configure-options.'
    dataset = File.read(this_file).strip
    opnn; e 'The options are:'
    e
    e sfancy("  #{dataset}")
    e
    clear_configure_options
    @internal_hash[:configure_options] = dataset
  else
    opnn; no_file_exists_at(this_file)
  end
end
considering_running_make_command_via_system()
Alias for: run_make_command
considering_running_make_install_command_via_system()
considering_setting_any_special_environment_variable( be_verbose = true ) click to toggle source
#

considering_setting_any_special_environment_variable

This is the method that will be used to determine whether we have to set any special environment variable.

#
# File lib/rbt/compile/env.rb, line 125
def considering_setting_any_special_environment_variable(
    be_verbose = true
  )
  _ = set_env_variables?
  if _ and !extract_only? # If we only extract something, then we don't need to do the rest.
    if be_verbose
      opnn; e "Making use of these #{aliceblue('special environment variables')}:"
    end
    set_these_env_variables(
      _, :do_set_these_variables, :be_verbose
    )
  end
end
continue_after_make_step?() click to toggle source
#

continue_after_make_step?

#
# File lib/rbt/compile/make.rb, line 239
def continue_after_make_step?
  @internal_hash[:continue_after_make_step]
end
convert_to_non_traditional(i = program?) click to toggle source
#

convert_to_non_traditional

Use this method to convert a program to non-traditional (Gobolinux style) again.

#
# File lib/rbt/compile/misc.rb, line 2402
def convert_to_non_traditional(i = program?)
  RBT::ConvertToNonTraditional.new(i)
end
convert_to_traditional( i = compile_which_program? ) click to toggle source
#

convert_to_traditional

Convert to traditional format via this method here.

Invoke this by doing something like:

ry php ctotrad
#
# File lib/rbt/compile/misc.rb, line 2657
def convert_to_traditional(
    i = compile_which_program?
  )
  RBT::ConvertToTraditional.new(i) # bl ConvertToTraditional
end
cookbook_build_system?()
cookbook_dataset?() click to toggle source
#

cookbook_dataset? (dataset tag)

Keep this query method on top of this file here, ideally.

This method can be used whenever we wish to query the main data structure of the target program at hand.

The dataset variable will typically be an instance of class RBT::Cookbooks::Cookbook.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 52
def cookbook_dataset?
  @internal_hash[:yaml_dataset]
end
cookbook_dataset_build_static?() click to toggle source
#

cookbook_dataset_build_static?

#
# File lib/rbt/compile/static.rb, line 64
def cookbook_dataset_build_static?
  cookbook_dataset?.build_static?
end
cookbook_dataset_configure_base_dir?()
cookbook_dataset_configure_base_directory?() click to toggle source
#

cookbook_dataset_configure_base_directory?

We ask the cookbook-dataset object for the configure base directory.

Most programs will NOT have such a setting.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 340
def cookbook_dataset_configure_base_directory?
  cookbook_dataset?.configure_base_directory?
end
cookbook_dataset_configure_command?() click to toggle source
#

cookbook_dataset_configure_command?

Most programs may use GNU autoconfigure, and thus “configure”, but a few programs such as openssl, require another program name, such as “/config”. This method here will query whether the given program needs such a name. If this is the case then this will be used as name rather than the alternative name “configure”.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 459
def cookbook_dataset_configure_command?
  cookbook_dataset?.configure_command
end
Also aliased as: configure_command?
cookbook_dataset_configure_options?()
cookbook_dataset_has_to_be_compiled?()
cookbook_dataset_headers?() click to toggle source
#

cookbook_dataset_headers?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 476
def cookbook_dataset_headers?
  cookbook_dataset?.headers?
end
Also aliased as: headers?
cookbook_dataset_keep_extracted?() click to toggle source
#

cookbook_dataset_keep_extracted?

This method simply wraps over the cookbook_dataset keep_extracted value.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 748
def cookbook_dataset_keep_extracted?
  cookbook_dataset?.keep_extracted?
end
Also aliased as: dataset_keep_extracted?
cookbook_dataset_libraries?() click to toggle source
#

cookbook_dataset_libraries?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 404
def cookbook_dataset_libraries?
  cookbook_dataset?.libraries?
end
Also aliased as: libraries?
cookbook_dataset_make_command?() click to toggle source
#

cookbook_dataset_make_command?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 367
def cookbook_dataset_make_command?
  cookbook_dataset?.use_which_make_command?
end
cookbook_dataset_make_options?()
cookbook_dataset_meson_configure_options?() click to toggle source
#

cookbook_dataset_meson_configure_options?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 185
def cookbook_dataset_meson_configure_options?
  cookbook_dataset?.meson_configure_options?
end
Also aliased as: meson_configure_options?
cookbook_dataset_parameters_to_make?() click to toggle source
#

cookbook_dataset_parameters_to_make?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 147
def cookbook_dataset_parameters_to_make?
  cookbook_dataset?.parameters_to_make?
end
cookbook_dataset_path?()
cookbook_dataset_postinstall?() click to toggle source
#

cookbook_dataset_postinstall?

Query from the cookbook-yaml file at hand whether we will run a postinstall-step or not.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 360
def cookbook_dataset_postinstall?
  cookbook_dataset?.postinstall?
end
cookbook_dataset_postinstallation?()
cookbook_dataset_pre_make_commands?() click to toggle source
#

cookbook_dataset_pre_make_commands?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 374
def cookbook_dataset_pre_make_commands?
  cookbook_dataset?.pre_make_commands?
end
cookbook_dataset_prefix?() click to toggle source
#

cookbook_dataset_prefix?

This method name may be a slight misnomer, since class Prefix may handle the prefix here.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 252
def cookbook_dataset_prefix?
  if cookbook_dataset?
    cookbook_dataset?.prefix?
  else
    nil
  end
end
cookbook_dataset_preinstall?() click to toggle source
#

cookbook_dataset_preinstall?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 381
def cookbook_dataset_preinstall?
  cookbook_dataset?.preinstall?
end
Also aliased as: preinstall?
cookbook_dataset_program_has_to_be_compiled?() click to toggle source
#

cookbook_dataset_program_has_to_be_compiled?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 208
def cookbook_dataset_program_has_to_be_compiled?
  cookbooks_dataset? and cookbooks_dataset?.has_to_be_compiled?
end
cookbook_dataset_program_name?()
cookbook_dataset_program_path?() click to toggle source
#

cookbook_dataset_program_path?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 135
def cookbook_dataset_program_path?
  if cookbook_dataset?
    cookbook_dataset?.program_path
  end
end
cookbook_dataset_real_program_name?()
cookbook_dataset_run_configure?() click to toggle source
#

cookbook_dataset_run_configure?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 539
def cookbook_dataset_run_configure?
  cookbook_dataset?.run_configure?
end
cookbook_dataset_run_configure_script?()
cookbook_dataset_run_make?() click to toggle source
#

cookbook_dataset_run_make?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 14
def cookbook_dataset_run_make?
  cookbook_dataset?.run_make?
end
cookbook_dataset_set_configure_command(i) click to toggle source
#

cookbook_dataset_set_configure_command

#
# File lib/rbt/compile/cookbook_dataset.rb, line 442
def cookbook_dataset_set_configure_command(i)
  case i
  when :meson
    i = i.to_s
  end
  cookbook_dataset?.set_configure_command(i)
end
Also aliased as: set_configure_command
cookbook_dataset_set_this_archive(i) click to toggle source
#

cookbook_dataset_set_this_archive

#
# File lib/rbt/compile/cookbook_dataset.rb, line 684
def cookbook_dataset_set_this_archive(i)
  cookbook_dataset?.set_this_archive(i)
end
cookbook_dataset_short_name?() click to toggle source
#

cookbook_dataset_short_name?

#
# File lib/rbt/compile/misc.rb, line 2190
def cookbook_dataset_short_name?
  cookbook_dataset?.short_name?.to_s
end
Also aliased as: short_name?
cookbook_dataset_use_autogen?() click to toggle source
#

cookbook_dataset_use_autogen?

Query-method over as to the cookbook-dataset has an entry called use_autogen set to true.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 414
def cookbook_dataset_use_autogen?
  cookbook_dataset?.use_autogen?
end
cookbook_dataset_use_build_directory?() click to toggle source
#

cookbook_dataset_use_build_directory?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 714
def cookbook_dataset_use_build_directory?
  cookbook_dataset?.use_build_directory?
end
cookbook_dataset_use_glib_schema?() click to toggle source
#

cookbook_dataset_use_glib_schema?

Whether our dataset uses glib install schema for some .xml files.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 614
def cookbook_dataset_use_glib_schema?
  cookbook_dataset?.use_glib_schema
end
Also aliased as: use_glib_schema?
cookbook_dataset_use_this_build_system?() click to toggle source
#

cookbook_dataset_use_this_build_system?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 199
def cookbook_dataset_use_this_build_system?
  cookbook_dataset?.use_which_build_system?
end
cookbook_dataset_with_extended_configure_options?() click to toggle source
#

cookbook_dataset_with_extended_configure_options?

This method will have most of the cookbooks-dataset, but will also honour the configure_options should they exist.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 167
def cookbook_dataset_with_extended_configure_options?
  _ = cookbook_dataset?.dup
  if @internal_hash[:configure_options]
    _.append_this_to_the_configure_options(
      @internal_hash[:configure_options]
    )
  end
  if @internal_hash[:parameters_to_make]
    _.set_parameters_to_make(
      @internal_hash[:parameters_to_make]
    )
  end
  _
end
cookbook_installation_steps?() click to toggle source
#

cookbook_installation_steps?

The installation-steps contain the instructions in how to install a given program at hand.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 157
def cookbook_installation_steps?
  cookbook_dataset?.installation_steps?
end
Also aliased as: installation_steps?
cookbook_prefix?()
cookbook_program_path?()
cookbooks_archive_type?()
Alias for: archive_type?
cookbooks_binaries?() click to toggle source
#

cookbooks_binaries?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 598
def cookbooks_binaries?
  cookbooks_dataset?.binaries?
end
Also aliased as: binaries?
cookbooks_dataset?()
Alias for: cookbook_dataset?
cookbooks_dataset_configure_options?() click to toggle source
#

cookbooks_dataset_configure_options?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 128
def cookbooks_dataset_configure_options?
  cookbooks_dataset?.configure_options?
end
cookbooks_dataset_extracted_towards?() click to toggle source
#

cookbooks_dataset_extracted_towards?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 506
def cookbooks_dataset_extracted_towards?
  cookbooks_dataset? and cookbooks_dataset?.extracted_towards?
end
cookbooks_dataset_use_glib_schema?() click to toggle source
#

cookbooks_dataset_use_glib_schema?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 605
def cookbooks_dataset_use_glib_schema?
  cookbook_dataset?.use_glib_schema?
end
cookbooks_prefix?()
cookbooks_program_name?()
cookbooks_program_path?()
cookbookset_dataset_use_which_build_system?()
copy_headers_from(i) click to toggle source
#

copy_headers_from

This method will copy the registered headers from the given program at hand.

The first argument to this method is the path to the header files.

Invocation examples:

ry glibc --copy-headers-from=/usr/include
ry glibc --copy-headers-to-pwd
#
# File lib/rbt/compile/misc.rb, line 1550
def copy_headers_from(i)
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  to = return_pwd 
  headers = headers?
  unless headers.empty?
    headers.each {|this_header|
      from = "#{i}#{this_header}"
      if this_header.include? '/'
        # ================================================================= #
        # In this case we must create such a subdirectory.
        # ================================================================= #
        dirname = File.dirname(this_header)
        unless File.directory? File.dirname(dirname)
          mkdir(dirname)
        end
      end
      e 'Now trying to copy `'+sfile(from)+'` to `'+
        sfile(to+this_header)+'`.'
      copy_file(from, to+this_header)
    }
  end
end
copy_ruby() click to toggle source
#

copy_ruby

#
# File lib/rbt/compile/ruby.rb, line 78
def copy_ruby
  begin
    require 'roebe/toplevel_methods/setup.rb'
    Roebe.copy_setup_file_to_pwd
  rescue LoadError
    opnn; e 'The method Roebe.copy_setup_file_to_pwd() is not available.'
    opnn; e "Please install the #{slateblue('roebe')} project:"
    e
    e '  gem install roebe'
    e
  end
end
copy_these_archives( i = :kde5_plasma ) click to toggle source
#

copy_these_archives

This method will copy the selected applications into the current working directory.

To invoke this method from the commandline, try:

rbt --copy-archives=kde5_plasma
#
# File lib/rbt/compile/misc.rb, line 1718
def copy_these_archives(
    i = :kde5_plasma
  )
  if i.is_a? String
    i = i.split(',') if i.include? ','
  end
  case i
  when :kde5_plasma, 'kde5_plasma'
    i = return_kde_plasma_components
  end
  i = [i].flatten.compact.reject {|entry| entry.strip.empty? }.map {|entry|
    try_to_find_an_alias_to_this_input_unless_the_program_exists(entry)
  }
  if i.empty?
    opne 'Please provide at the least one argument - the '\
         'directory that is to be copied.'
  else
    opne "Now copying #{i.size.to_s} entries into the local "\
         "working directory:"
    i.each {|this_program|
      target_directory = source_dir?+this_program.downcase+'/'
      if File.directory? target_directory
        copy_directory(target_directory, :be_verbose)
      else
        opne "No directory exists at `#{sdir(target_directory)}`."
      end
    }
  end
end
create_a_new_cookbook_instance(i)
create_a_slackdesc_file_for_this_program(i) click to toggle source
#

create_a_slackdesc_file_for_this_program

#
# File lib/rbt/compile/misc.rb, line 710
def create_a_slackdesc_file_for_this_program(i)
  require 'rbt/linux/slackware/generate_slack_desc_file.rb'
  RBT::Linux::Slackware::GenerateSlackDescFile.new(i)
end
create_app_skeleton( i = return_proper_prefix )
create_appdir_skeleton( i = return_proper_prefix )
create_dependencies_file( create_where = rbt_log_directory? ) click to toggle source
#

create_dependencies_file

This method will create a Gobolinux dependencies file.

To invoke it, do something like:

ry htop create_dependencies_file
#
# File lib/rbt/compile/gobolinux.rb, line 244
def create_dependencies_file(
    create_where = rbt_log_directory?
  )
  _ = RBT::Linux::Gobolinux::CreateDependenciesFile.new(
        create_where, 
        required_deps_on?,
        :dont_run_yet
      )
  _.allow_creation_of_resources
  _.run # Finally, run.
end
create_description_file(create_where) click to toggle source
#

create_description_file

Creates a Description file, for use in Gobolinux systems.

#
# File lib/rbt/compile/misc.rb, line 2864
def create_description_file(create_where)
  if create_where.include? programs_directory?
    create_where = create_where.delete('-')
  end
  file_location = create_where+'Resources/Description'
  remove_file(file_location) if File.exist? file_location # Remove it if it already exists.
  append_what_into(
    dataset?.description?,
    file_location
  )
end
create_ebuild_recipe( dataset_to_use = cookbook_dataset? ) click to toggle source
========================================================================= #
=== create_ebuild_recipe

Use this to create an ebuild file.

This is done by the specialized class CreateBuild.

If you want to test this method, do something such as this here:

  ry htop ebuild

========================================================================= #
# File lib/rbt/compile/linux/gentoo.rb, line 33
def create_ebuild_recipe(
    dataset_to_use = cookbook_dataset?
  )
  RBT::Cookbooks::CreateEbuild.new(dataset_to_use)
end
create_gobolinux_recipe_for(i = compile_which_program?)
create_program_skeleton( i = return_proper_prefix )
create_shell_scripts() click to toggle source
#

create_shell_scripts (bash tag bashrc tag)

This method will convert the yaml dataset to bash scripts, so that the bash shell can make use this information as well.

To invoke this method, do something such as this:

ry --bash

To get the array content do this (after sourcing the file):

echo ${programs[*]}
#

cat /System/Settings/bash_programs_rc

#

cd /System/Settings/

#
# File lib/rbt/compile/shell.rb, line 50
def create_shell_scripts
  RBT::CreateBashScripts.new # bl $RBT/create_bash_scripts.rb
end
Also aliased as: to_bash
create_shellscript( program = compile_which_program?, save_into_a_file = true, display_result = false ) click to toggle source
#

create_shellscript (shell tag, script tag)

This is a wrapper over the class GenerateShellscript.

It will return a string, which contains all the information to create a specific shell script.

The first argument to this method is the name of the program in question.

To invoke this method, do:

ry htop create_shellscript
ry php cshell
#
# File lib/rbt/compile/shell.rb, line 70
def create_shellscript(
    program          = compile_which_program?,
    save_into_a_file = true,
    display_result   = false
  )
  _ = GenerateShellscript.new(
    program,
    save_into_a_file,
    display_result
  )
  return _.string?
end
create_slackware_description_file( i = compile_which_program? )
create_standalone_yaml_file() click to toggle source
#

create_standalone_yaml_file

This will create standalone yaml files.

Usage example:

ry htop --csyf
#
# File lib/rbt/compile/misc.rb, line 2597
def create_standalone_yaml_file
  cliner {
    opne 'Dumping all available recipes next.'
  }
  store_here = RBT.configuration?.recipes_directory
  all_programs.each { |my_program|
    e sfancy("This program is: `")+simp(my_program)+sfancy('`.')
    update_dataset(my_program)
    _ = RBT::Cookbooks::CreateRecipe.new(my_program, :do_not_run_yet)
    _.store_where(store_here)
    _.run
  }
  cliner {
    opne sfancy('Finished dumping all Recipes into ')+sdir(store_here)
    opne "#{N}There were: #{sfancy(all_programs.size.to_s)} of them.#{N}"
  }
end
create_yaml_file_for_this_program( i = compile_which_program? ) click to toggle source
#

create_yaml_file_for_this_program

#
# File lib/rbt/compile/misc.rb, line 295
def create_yaml_file_for_this_program(
    i = compile_which_program?
  )
  require 'rbt/utility_scripts/expand_cookbooks.rb'
  e
  opnn; RBT.expand_this_cookbook(i)
  e
end
Also aliased as: expand_this_cookbook
custom_system(i)
data?()
Alias for: cookbook_dataset?
dataset()
Alias for: cookbook_dataset?
dataset?()
Alias for: cookbook_dataset?
dataset_keep_extracted?()
dataset_object?()
Alias for: cookbook_dataset?
dataset_prefix?()
dataset_program_name?()
dataset_program_name_and_program_version?() click to toggle source
#

dataset_program_name_and_program_version?

This method will always return the program name and the associated program version, such as:

"htop-2.0.2"
#
# File lib/rbt/compile/cookbook_dataset.rb, line 279
def dataset_program_name_and_program_version?
  cookbook_dataset?.program_name?
end
Also aliased as: cookbooks_program_name?
dataset_program_short_name?() click to toggle source
#

dataset_program_short_name?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 215
def dataset_program_short_name?
  cookbook_dataset?.short_name?
end
decide_whether_to_invoke_autoconf_command()
decide_whether_to_invoke_autogen() click to toggle source
#

decide_whether_to_invoke_autogen

Invoke autogen.sh if specified so, and only if the file autogen.sh actually exists.

There may be some situations where it does not make sense to invoke autogen, such as when the build type specifically tells us to use meson.

#
# File lib/rbt/compile/autogen.rb, line 26
def decide_whether_to_invoke_autogen
  _ = FILE_AUTOGEN
  if use_autogen?
    if uses_the_meson_build_system?
      opne crimson('The value for autogen is set to ')+
           royalblue('true')+crimson(', meaning "do use autogen".')
      opne crimson('The .yml file specifies to use the meson-build system, though.')
      opne crimson('Autogen is only useful for GNU configure based system, so')
      opne crimson('autogen is set to false for this run - thus, not making '\
                   'use of autogen.')
      e
      opne crimson('If you need autogen, consider changing the information in the')
      opne crimson('.yml file ')+sfile("#{compile_which_program?}.yml")
      e
      opne 'Do note that this behaviour may be changed at a later time.'
      disable_autogen
    end
    if use_autogen? and File.exist?(_)
      do_use_autogen # This is the do-action that invokes autogen.sh
    end
  end
end
decide_whether_to_invoke_the_autoconf_command() click to toggle source
#

decide_whether_to_invoke_the_autoconf_command

Whether to run “autoconf” or whether we will not. Only very few programs will need this.

Note that the invocation of autoconf must happen AFTER the pre-installation step, and after checking whether sed must be used or not. Afterwards, we can then check whether we will use a build directory, and whether we must use another prefix.

A program that may require this is “bridgeutils”.

Invocation example:

ry bridgeutils
#
# File lib/rbt/compile/autoconf.rb, line 31
def decide_whether_to_invoke_the_autoconf_command
  if use_autoconf?
    cmd = 'autoconf' # 2>&1'
    cliner { 
      opnn; e "Doing `#{teal(cmd)}` in directory #{sdir_return_pwd}"
      opnn; e 'using this command next:'
      opnn; e sfancy("  #{cmd}")
    }
    `#{cmd}`
  end
end
default_cflags?()
Alias for: cflags?
default_download_then_exit(i = :default) click to toggle source
#

default_download_then_exit

#
# File lib/rbt/compile/upload_and_download.rb, line 245
def default_download_then_exit(i = :default)
  download_program(:def, true, i) # Download here. Overrule settings.
  exit_program # Then exit.
end
default_extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
delete_libtool_files?() click to toggle source
#

delete_libtool_files?

Query whether we will delete .la files or whether we will not. If we will not, then any installed .la files will be removed.

Note that this will ONLY be honoured if compilation was a success AND we use an AppDir path as prefix - so .la files that are installed under /usr/lib/ will not be removed, ever.

#
# File lib/rbt/compile/libtool.rb, line 23
def delete_libtool_files?
  if @internal_hash[:keep_la_files]
    !@internal_hash[:keep_la_files]
  else
    RBT.configuration?.delete_libtool_files
  end
end
depends_on_cmake?() click to toggle source
#

depends_on_cmake?

#
# File lib/rbt/compile/cmake.rb, line 34
def depends_on_cmake?
  RBT.depends_on_cmake?(required_deps_on?)
end
Also aliased as: program_uses_cmake?
depends_on_ninja?() click to toggle source
#

depends_on_ninja?

#
# File lib/rbt/compile/meson_and_ninja.rb, line 63
def depends_on_ninja?
  ::RBT.depends_on_ninja?(required_deps_on?)
end
depends_on_python?() click to toggle source
#

depends_on_python?

Whether python is registered as a dependency.

#
# File lib/rbt/compile/python.rb, line 127
def depends_on_python?
  RBT.depends_on_python?(required_deps_on?)
end
depends_on_waf?() click to toggle source
#

depends_on_waf?

#
# File lib/rbt/compile/python.rb, line 134
def depends_on_waf?
  ::RBT.depends_on_waf?
end
deregistering_from_the_status_file() click to toggle source
#

deregistering_from_the_status_file

De-register the program that we are currently compiling from the status file again.

#
# File lib/rbt/compile/register.rb, line 91
def deregistering_from_the_status_file
  into = RBT.file_status
  dataset = {}
  if File.exist? into
    dataset.merge!(YAML.load_file(into))
  end
  if dataset.has_key? 'currently_compiling_these_programs'
    _ = dataset['currently_compiling_these_programs']
    if _.include? compile_which_program?
      dataset['currently_compiling_these_programs'] = dataset['currently_compiling_these_programs'].reject {|line|
        line == compile_which_program?
      }
      what = YAML.dump(dataset)
      write_what_into(what, into)
    end
  end
end
determine_cookbook_dataset_for_this_program( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
determine_prefix_from_the_cookbook_dataset()
determine_program_full_name() click to toggle source
#

determine_program_full_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 707
def determine_program_full_name
  cookbook_dataset?.determine_program_full_name
end
determine_the_configure_base_directory_to_use() click to toggle source
#

determine_the_configure_base_directory_to_use

This method can be used to determine the full path to the configure base directory to be used.

#
# File lib/rbt/compile/misc.rb, line 2171
def determine_the_configure_base_directory_to_use
  target = extract_to_this_dir?.dup+
           yaml_dataset?.program_name_and_program_version?+
           '/'+
           cookbook_dataset_configure_base_directory?.to_s
  set_configure_base_directory(target)
end
determine_the_dataset_for_this_program( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
determine_the_program_path() click to toggle source
#

determine_the_program_path

#
# File lib/rbt/compile/misc.rb, line 699
def determine_the_program_path
  value = source_directory?+
          yaml_dataset?.program_short_name?.downcase.delete('-')+'/'+
          yaml_dataset?.program_name_and_program_version?+
          yaml_dataset?.archive_type?
  set_program_path(value)
end
determine_which_compiler_will_be_used() click to toggle source
#

determine_which_compiler_will_be_used

This method currently will only check if the clang-compiler is used.

#
# File lib/rbt/compile/misc.rb, line 1373
def determine_which_compiler_will_be_used
  case use_which_compiler?
  when 'clang'
    do_use_clang_compiler(:be_quiet)
  end
end
did_we_encounter_an_error?()
dir?()
disable_autogen( be_verbose = true ) click to toggle source
#

disable_autogen

#
# File lib/rbt/compile/autogen.rb, line 110
def disable_autogen(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not make use of autogen.'
  end
  @internal_hash[:use_autogen] = false # Enable the use of autogen in our dataset here.
end
disable_ccache() click to toggle source
#

disable_ccache

Use this method to temporarily disable ccache, that is - for the current run. If you do not want to use ccache at all, simply set the content of the corresponding .yml file to false.

#
# File lib/rbt/compile/ccache.rb, line 27
def disable_ccache
  @internal_hash[:use_ccache] = false
end
disable_colours( be_verbose = true ) click to toggle source
#

disable_colours (colours tag)

Disable colours with this method. This will not be permanent, it will be valid only for the running instance (this object). If you want to permanently disable colours, use:

rbt_config --disable-colours

To use this specific method here, do something like this:

ry htop disablecolours

Remember that you can chain together instructions, so:

ry htop disablecolours ntrad

Would compile in an appdir-like fashion, without using any colours.

#
# File lib/rbt/compile/colours.rb, line 120
def disable_colours(
    be_verbose = true
  )
  RBT.disable_colours  # <- Defined in rbt/colours/colours.rb
  @use_colours = false # This one is defined in base.rb
  if be_verbose
    opne 'We will not use any colours.'
  end
end
Also aliased as: no_colours
disable_internal_sed() click to toggle source
#

disable_internal_sed

#
# File lib/rbt/compile/sed.rb, line 90
def disable_internal_sed
  @internal_hash[:use_the_internal_sed_wrapper] = false
end
disable_logging( be_verbose = true ) click to toggle source
#

disable_logging

We no longer log here.

#
# File lib/rbt/compile/misc.rb, line 2638
def disable_logging(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not log.'
  end
  @internal_hash[:may_we_log] = false
end
disable_md5sum_calculation() click to toggle source
#

disable_md5sum_calculation

This method here can be used to disable the md5sum calculation altogether.

Invocation example:

ry htop --no-md5sum
#
# File lib/rbt/compile/misc.rb, line 2237
def disable_md5sum_calculation
  opne 'We will not calculate the md5sum of an archive. This '\
       'should speed up'
  opne 'things a little bit, in particular for very large files.'
  RBT::Cookbooks::Cookbook.disable_md5sum_calculation # Cookbooks::Cookbook must provide this method.
end
disable_opn() click to toggle source
#

disable_opn

Use this method to stop reporting any program names.

To trigger this, try one of these usage examples:

ry php noopn
ry htop nonames
#
# File lib/rbt/compile/opn.rb, line 57
def disable_opn
  e 'We will not use Opn (class name output)'
  RBT.do_not_show_the_classname
  @internal_hash[:use_opn] = false
end
disable_porg() click to toggle source
#

disable_porg

Disable porg via this method.

#
# File lib/rbt/compile/porg.rb, line 50
def disable_porg
  @internal_hash[:use_porg] = config?.use_porg = false
end
disable_static_compilation( be_verbose = :be_verbose ) click to toggle source
#

disable_static_compilation

Use this method to disable static compilation.

#
# File lib/rbt/compile/static.rb, line 73
def disable_static_compilation(
    be_verbose = :be_verbose
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  when :do_not_be_verbose
    be_verbose = false
  end
  if be_verbose
    opne 'Disabling static compilation.'
  end
  @internal_hash[:build_static] = false
end
disable_stow() click to toggle source
#

disable_stow

#
# File lib/rbt/compile/misc.rb, line 3053
def disable_stow
  configuration?.use_stow = false
  opne 'Disabling stow next.'
  configuration?.save
end
disallow_changing_the_cookbook_dataset() click to toggle source
#

disallow_changing_the_cookbook_dataset

#
# File lib/rbt/compile/cookbook_dataset.rb, line 192
def disallow_changing_the_cookbook_dataset
  cookbook_dataset?.freeze
end
display_postinstall_dataset() click to toggle source
#

display_postinstall_dataset

This method will display the postinstall actions that will be done for the given program at hand.

Invocation examples:

ry perl p?
ry docbookxsl --display_postinstall
ry libraw1394 --postinstallation_steps?
ry bash --postinstallation_steps?
#
# File lib/rbt/compile/postinstallation_step.rb, line 43
def display_postinstall_dataset
  result = cookbook_dataset_postinstall?
  unless result.empty?
    opne "The postinstall instructions for `#{royalblue(program?)}` are:"
    result = [result].flatten.compact # <- We need an Array past this point.
    result.each {|entry|
      e
      e "  #{yellowgreen(entry)}" # Display with a slight padding.
      e
    }
    opne 'Also assigning the above result to the xorg buffer.'
    set_xorg_buffer(result.join(N))
  end
end
display_standard_help_options( exit_now = true ) click to toggle source
#

display_standard_help_options (help tag)

#
# File lib/rbt/compile/help.rb, line 175
def display_standard_help_options(
    exit_now = true
  )
  RBT::Compile.display_standard_help_options(exit_now)
end
do_binary_upload_of_this_file(this_file) click to toggle source
#

do_binary_upload_of_this_file

#
# File lib/rbt/compile/ftp.rb, line 53
def do_binary_upload_of_this_file(this_file)
  _ = this_file
  if File.exist? _
    FtpParadise.upload_this_binary_file(_, :be_verbose)
  else
    e "No file at `#{sfile(_)}` exists."
  end
end
do_check_for_binary_duplicates() click to toggle source
#

do_check_for_binary_duplicates

If you wish to check for binary-duplicates under /usr/bin/, then this method may be helpful to you.

#
# File lib/rbt/compile/misc.rb, line 233
def do_check_for_binary_duplicates
  target_dir = :default
  # ======================================================================= #
  # The next line of code handles the situation when we are in the
  # directory /usr/sbin/, and when we are on a roebe-system (aka at home).
  # ======================================================================= #
  if is_on_roebe? and (return_pwd == '/usr/sbin/')
    target_dir = '/usr/sbin/'
  end
  array = RBT.array_binary_duplicates(:default, target_dir)
  if array.empty?
    target_dir = '/usr/bin/' if target_dir == :default
    opne "No duplicates appear to exist under the "\
         "#{sdir(target_dir)} hierarchy."
  else
    opne 'The following duplicates were found:'
    e
    array.each {|entry|
      e "  #{sfile(entry.ljust(40))}"
    }
  end
end
do_compile_all_available_local_version( i = compile_which_program? )
do_compile_all_available_local_version_of_this_program( i = compile_which_program? ) click to toggle source
#

do_compile_all_available_local_version_of_this_program

Invocation example:

ry libsigc++ --compile-all-available-local-versions
#
# File lib/rbt/compile/version.rb, line 127
def do_compile_all_available_local_version_of_this_program(
    i = compile_which_program?
  )
  opne 'Checking for the locally available '\
       'versions of the program '+sfancy(i)+' next.'
  target_directory = source_dir?+i.downcase+'/'
  e
  opne "We will check at the directory `#{sdir(target_directory)}`."
  e
  matches = Dir[target_directory+'*']
  if matches.empty?
    opne 'No result was found at the directory `'+sdir(target_directory)+'`.'
    opne 'This usually indicates that the '\
         'directory does not exist - or is empty.'
  else
    matches.each {|entry|
      opne 'Working on the entry `'+sfancy(entry)+'` next.'
      entry = remove_archive_at_the_end(entry)
      basename = File.basename(entry)
      program_name    = ProgramInformation.return_program_name(basename)
      program_version = ProgramInformation.return_version(basename)
      reset
      set_compile_this_program(program_name)
      initialize_dataset_for_this_program(program_name)
      set_program_version(program_version)
      do_compile_this_program(program_name) { :do_not_initialize_the_dataset }
    }
  end
end
do_compile_all_of_mate() click to toggle source
#

do_compile_all_of_mate

#
# File lib/rbt/compile/compile.rb, line 182
def do_compile_all_of_mate
  i = RBT.returned_chained_programs_of_the_mate_desktop
  opne "We will compile all #{sfancy(i.size.to_s)} programs "\
       "of the mate-desktop."
  set_compile_these_programs(i)
end
do_compile_in_a_non_traditional_way( optional_command_given = nil, be_verbose = true ) click to toggle source
#

do_compile_in_a_non_traditional_way

We enable Gobolinux-style compilation here, as in AppDir-like compilation.

#
# File lib/rbt/compile/prefix.rb, line 244
def do_compile_in_a_non_traditional_way(
    optional_command_given = nil,
    be_verbose             = true
  )
  if can_we_continue?
    @internal_hash[:counter_called_traditional_or_non_traditional_compilation] += 1
    case optional_command_given
    when :be_silent,
         :be_quiet
      be_verbose = false
    end
    case be_verbose
    when :be_silent,
         :be_quiet
      be_verbose = false
    end
    if be_verbose
      opne 'Overruling any potential traditional setting.'
    end
    set_use_this_prefix :use_ntrad_prefix_at_a_later_time
  end
end
do_compile_in_a_traditional_way( be_verbose = true ) click to toggle source
#

do_compile_in_a_traditional_way

Use this method when you want to use '/usr/' as the main prefix of compilation.

#
# File lib/rbt/compile/prefix.rb, line 32
def do_compile_in_a_traditional_way(
    be_verbose = true
  )
  if can_we_continue?
    @internal_hash[:we_tried_to_compile_this_program_n_times] += 1
    if be_verbose
      opne 'Using a "'+sfancy(:traditional)+'" strategy for compilation '\
           '(which means prefix '+sdir('/usr/')+').'
    end
    set_user_prefix '/usr/' # Specify a user-prefix here.
  end
end
do_compile_in_both_traditional_and_non_traditional_manner() click to toggle source
#

do_compile_in_both_traditional_and_non_traditional_manner

This method combines both main strategies for compilation - first, into the /usr/ prefix, and then into the appdir prefix.

#
# File lib/rbt/compile/prefix.rb, line 205
def do_compile_in_both_traditional_and_non_traditional_manner
  opne 'We will first compile in the traditional way, and then after that'
  opne 'we will compile in the non-traditional (appdir) way.'
  do_compile_in_a_traditional_way # First, compile in a traditional way.
  @internal_hash[:extra_compilation] = true
end
do_compile_these_programs( i = compile_these_programs? )
do_compile_this_program( this_program ) { || ... } click to toggle source
#

do_compile_this_program

This method can be used to compile a given program.

#
# File lib/rbt/compile/do_compile_this_program.rb, line 19
  def do_compile_this_program(
      this_program
    )
    if this_program.respond_to?(:end_with?) and
       this_program.end_with?('.la') and
      !File.exist?(this_program)
      do_not_try_to_autofix
      opnn; e "Trying to autocorrect the libtool entry at "\
              "#{royalblue(this_program)}"
      try_to_autocorrect_this_erroneous_libtool_entry(
        this_program
      )
      return # And "exit" here.
    end
    if block_given?
      yielded = yield
    else
      yielded = nil
    end
    if yielded and yielded == :do_not_initialize_the_dataset
    else
      initialize_default_values # <- Reset relevant variables here.
    end
    target_file = log_dir?+'is_on_gobolinux.md'
    if File.exist?(target_file) and
      !File.empty?(target_file)
      # ===================================================================== #
      # The above file must have been set on a GoboLinux system, when the
      # user did a rbt --auto before (or created the file manually).
      # ===================================================================== #
      enable_is_on_gobolinux
    end
    # ======================================================================= #
    # Handle the * argument. We will show to the user what programs
    # exist that start with this name.
    #
    # To trigger this method, do:
    #   ry a*
    #   ry e*
    # ======================================================================= #
    if this_program.respond_to?(:include) and
       this_program.include?('*')
      verbose_find_all_keys_starting_with(this_program)
      exit_program
    end
    # ======================================================================= #
    # Next, ensure that if the cookbooks file at hand is using any special
    # environment variable, that this will also be used. For example,
    # the program called "htop" will use these LDFLAGS: -ltinfow,
    # so this has to be enabled.
    # ======================================================================= #
    considering_setting_any_special_environment_variable
    # ======================================================================= #
    # Query for the use and availability of ccache.
    # ======================================================================= #
    if use_ccache? and !is_ccache_available?
      notify_the_user_that_ccache_is_not_available
    end
    # ======================================================================= #
    # The next variable will keep track of the tab-title that is to be used
    # for the KDE konsole tab title.
    # ======================================================================= #
    use_this_as_tab_title = :default
    # ======================================================================= #
    # Set a default program path to be used.
    #
    # Note that by default we will check whether the given input is a
    # file and does exist - but sometimes this is unwanted, so a flag
    # exists to control the behaviour. The following code does ensure
    # precisely that.
    # ======================================================================= #
    if check_whether_the_given_input_is_a_file_and_does_exist? and
       does_this_file_exist_and_is_it_a_file?(this_program)# This may be the case when the user supplied a path.
      # ===================================================================== #
      # In this case, we do not have to do as much checking, since we
      # will just try to compile the given program at hand, using
      # automatic inference.
      # However had, it may still be beneficial to determine whether
      # the program is registered. If it is then we can try to make
      # use of the dataset for the program, and then just change certain
      # parts of that program.
      # ===================================================================== #
      inferred_program_name = ProgramInformation.return_short_name(this_program)
      if RBT.is_this_program_included?(inferred_program_name)
        set_compile_this_program(
          File.basename(inferred_program_name)
        )
        if may_we_initialize_a_new_cookbook_dataset?
          initialize_cookbook_dataset_for(inferred_program_name)
        end
        do_show_the_infobox
        this_program = File.absolute_path(this_program)
        cookbook_dataset?.set_program_path(this_program)
      else
        do_not_show_the_infobox
      end
      set_program_path(this_program)
      set_program_name(program_path?)
      # ===================================================================== #
      # We must also re-write the program version:
      # ===================================================================== #
      set_program_version(
        ProgramInformation.return_version(
          File.basename(program_path?)
        )
      )
      use_this_as_tab_title = remove_archive_at_the_end(
        File.basename(this_program)
      )
    else # Else we must check for inclusion in the dataset.
      this_program = this_program.to_s unless this_program.is_a? String
      # ===================================================================== #
      # === Register the program for compilation
      #
      # Next, we have to register the name of the program somewhere,
      # which is to be done through a method-call. But first we will
      # try to sanitize it a little bit, if it includes at the least
      # one '/' character.
      # ===================================================================== #
      this_program = File.basename(this_program) if this_program.include? '/'
      this_program = set_compile_this_program(this_program)
      # ===================================================================== #
      # First, we make a re-write action if the cookbooks does not
      # include the given input at hand.
      # ===================================================================== #
      is_the_program_included = cookbooks_include_this_program? this_program
      unless is_the_program_included
        # =================================================================== #
        # We have to do another check, this time including the abbreviations.
        # =================================================================== #
        is_the_program_included = cookbooks_include_this_program?(
          this_program, :with_abbreviations
        )
        if is_the_program_included
          abbreviation_points_to = abbreviations?[this_program]
          unless abbreviation_points_to == this_program
            this_program = return_possible_abbreviation_to_this_input(this_program)
            set_program_name(this_program)
            set_compile_this_program(this_program)
          end
        # =================================================================== #
        # Query whether this is a registered binary name.
        # =================================================================== #
        elsif is_this_a_registered_binary_name?(this_program)
          belongs_to_this_package = RBT.all_binaries?[this_program]
          opnn; e 'This ('+orange(this_program)+') appears to be a registered '\
                  'binary name, belonging to the package `'+
                  sfancy(belongs_to_this_package)+'`.'
          set_program_name(belongs_to_this_package)
          set_compile_this_program(belongs_to_this_package)
          ensure_that_the_program_exists(belongs_to_this_package)
          this_program = belongs_to_this_package
        else
          ensure_that_the_program_exists(this_program)
        end
      end
      # ===================================================================== #
      # cd into the main log directory:
      # ===================================================================== #
      cd rbt_log_directory?, :be_quiet
      # ===================================================================== #
      # Determine whether the program is included or not:
      # ===================================================================== #
      if cookbooks_include_this_program?(this_program) and can_we_continue?
        # =================================================================== #
        # Ok, the program is included.
        # =================================================================== #
        yaml_dataset = load_yaml_dataset_for_this_program(
          this_program, :return_flat_datastructure
        )
        # =================================================================== #
        # Now that we have a dataset, we need to set (assign) it at once,
        # so that the subsequent method-calls work on a sane dataset.
        # =================================================================== #
        assign_to_the_main_dataset(
          yaml_dataset
        )
        # =================================================================== #
        # === Download the program if it does not yet exist locally
        #
        # Download the program if it does not exist here. This functionality
        # must come before we try to extract the program.
        #
        # Obtain the program path first, though.
        # =================================================================== #
        program_path = program_path?
        if program_path.nil?
          # ================================================================= #
          # This is a safeguard - but it is also the default, actually. The
          # cookbook-dataset is much more likely to contain the local "URL"
          # to the program at hand.
          # ================================================================= #
          program_path = cookbook_dataset_program_path?
        end
        unless File.exist? program_path
          download_program
          unicode_middle_cliner # Looks better with cliner, I think.
        end
        # =================================================================== #
        # Sometimes we must re-write the program path, e. g. if we take
        # another program version. The following method does that for us.
        # =================================================================== #
        consider_sanitizing_the_program_path
        # =================================================================== #
        # === Honour the "do_not_download" settings if it exists.
        # =================================================================== #
        do_not_download if cookbook_dataset?.do_not_download?
        # =================================================================== #
        # Also reset the compiled n-times counter next.
        # =================================================================== #
        reset_compiled_n_times_counter
        # =================================================================== #
        # Additionally, we must re-evaluate the user_prefix? variable.
        # For example, "ntrad scumm" should contain the new AppDir prefix.
        # =================================================================== #
        if user_prefix? and is_an_abbreviation?
          # ================================================================= #
          # If it was defined, we will assume that the user wanted to
          # use another prefix. This presently (Oct 2018) will not work
          # for all prefixes, so we may have to fix this completely at
          # a later time - for now it shall suffice.
          # ================================================================= #
          if user_prefix?.to_s.delete('/') == programs_directory?.delete('/')
            do_run_via_nontraditional_way # <- This should correctly re-set the prefix.
          end
        end
        determine_the_configure_base_directory_to_use
        # =================================================================== #
        # We must sync some settings onto the dataset-object next. These
        # entries will be listed next:
        #
        #   (1) user prefix if it exists
        #
        # =================================================================== #
        if user_prefix?
          # ================================================================= #
          # We must check for the user_prefix early.
          # ================================================================= #
          use_this_prefix = user_prefix?
          case use_this_prefix
          when :use_ntrad_prefix_at_a_later_time
            _ = yaml_dataset.program_name? # <- This combines short_name+'-'+program_version
            use_this_prefix = Prefix.new(_) { :ntrad }
            set_user_prefix(use_this_prefix)
          end
          yaml_dataset.set_prefix(use_this_prefix.to_s)
          # ================================================================= #
          # And sync it onto regular prefix setting too:
          # ================================================================= #
          @internal_hash[:prefix].set_prefix(user_prefix?.to_s)
        else
          # ================================================================= #
          # And sync from the yaml_dataset back to the common prefix.
          # ================================================================= #
          @internal_hash[:prefix].set_prefix(yaml_dataset.prefix?)
        end
        # =================================================================== #
        # Determine the program_path variable next.
        # =================================================================== #
        determine_the_program_path
        # =================================================================== #
        # Append the archive type next - but consider using a glob first.
        # =================================================================== #
        glob = Dir["#{program_path?}*"]
        unless glob.empty?
          first_result = glob.first
          set_program_path first_result
        end
        if File.exist? program_path?
          this_program = program_path?
        end
      end
    end
    # ======================================================================= #
    # Next we will have to check again whether there is a proper archive
    # at the specified source-dir location. If there is not a proper
    # archive AND if the program_path? does NOT point to a valid archive,
    # then we will attempt to guess an archive type, if there are locally
    # available files such as foobar-1.0.tar.xz.
    # ======================================================================= #
    if archive_type? and
       archive_type?.empty? and
       program_path? and
      !program_path?.empty? and
      !is_an_archive?(program_path?)
      all_possible_archives = return_all_archives_from_this_directory(
        File.dirname(program_path?)
      )
      unless all_possible_archives.empty?
        first_entry = all_possible_archives.first # Not ideal, but this should suffice for now.
        set_archive_type(first_entry)
        update_program_full_name
        # =================================================================== #
        # And we must re-build the full path too.
        # =================================================================== #
        assemble_full_path
        set_program_path(cookbook_dataset_program_path?)
      end
    end
    we_can_not_continue if an_error_has_occurred?
    return unless can_we_continue?
    # ======================================================================= #
    # Notify the user which program will be compiled/installed next:
    # ======================================================================= #
    opnn; e "The program `#{sfancy(compile_which_program?)}` "\
            "will be compiled/installed next."
    # ======================================================================= #
    # First, check whether we have to extract the archive at hand. We do
    # not have to extract .gem files, since "gem" does this for us.
    # ======================================================================= #
    skip_extracting_if_it_is_a_gem_file
    # ======================================================================= #
    # === (1) Consider changing the tab title:
    #
    # Changing the name of the tab title should happen only after the
    # program name was set. The method will check whether we will actually
    # do any tab-change action or not. Note that when we refer to "tab",
    # we really mean KDE konsole tabs primarily.
    # ======================================================================= #
    consider_changing_the_tab_title(use_this_as_tab_title)
    # ======================================================================= #
    # === (2) Set the CFLAGS next. This should come before we extract
    # the program. We will also honour the build_static variable.
    #
    # We will do this only for programs that have to be compiled, though.
    # ======================================================================= #
    if has_to_be_compiled?
      if build_static?
        # =================================================================== #
        # Honour static compilation settings in the ymal file.
        # =================================================================== #
        opnn; e 'The yaml file specifies that this program is to '\
                'be compiled statically.'
        opnn; e "Thus, we will use these CFLAGS: "\
                "#{lightblue(default_cflags?)}"
        # =================================================================== #
        # We also have to scan the configure command string. If that string
        # contains an instruction such as "--disable-static", then we will
        # get rid of it, and notify the user. The reason is that, quite
        # obviously, we can not have conflicting options passed.
        # Note that this may be changed at a later time in the future, if
        # we decide that only user-supplied options to RBT may change this
        # behaviour. For now, we simply add a way to check the logic on
        # it, which is an improvement over the old code which did not
        # do any logic-checking at all whatsoever.
        # =================================================================== #
        _ = configure_options?
        if _.include? '--disable-static'
          opnn; e 'The configure option to '+sfancy(compile_which_program?)+
                  ' is using the option called '+simp('--disable-static')+'.'
          opnn; e 'As this '+steelblue('would contradict')+
                  ' with our goal to enable static '\
                  'compilation,'
          opnn; e 'this option was replaced with --enable-static, from '\
                  'the configure command string.'
          cookbook_dataset?.configure_options = configure_options?.sub(
            /-?-?disable-?static/, '--enable-static'
          )
        end
        set_cflags(:build_static)
      end
    end
    # ======================================================================= #
    # In the past, we did set the default extract-directory via
    # extract_to_default_directory, before invoking
    # set_extract_to_this_directory() - but we no longer do so since
    # as of December 2018.
    # ======================================================================= #
    # (3) Extract the program if it exists:
    # ======================================================================= #
    if extract_the_archive?
      if program_path?.nil?
        opnn; ewarn 'The program path is nil. Some error must have happened.'
        opnn; ewarn "We did try to compile the program: "\
                    "#{orange(compile_which_program?)}"
        opnn; ewarn 'We thus exit now.'
        exit
      else
        # =================================================================== #
        # === Extract the archive if it exists                  (extract tag)
        #
        # Extract the program next.
        # =================================================================== #
        extract_this_program_if_it_exists(program_path?)
        unless File.exist? program_path?
          opnn; e "No archive exists at `#{sfile(program_path?)}`."
          opnn; e 'As it was specified to extract the archive in this '\
                  'case, yet this'
          opnn; e 'archive could not be found at the above reported path, '\
                  'we will exit'
          opnn; e 'now. You may consider downloading the source archive, '\
                  'should'
          opnn; e 'it exist.' 
          exit_program
        end
        cd_to_the_configure_base_directory
      end
    end
    cd_to_the_configure_base_directory
    # ======================================================================= #
    # === Optional start messages
    #
    # Display optional start message here before we continue to the
    # preinstall? stage and other stages.
    # ======================================================================= #
    consider_displaying_the_start_message
    # ======================================================================= #
    # Consider applying a patch next - this should come before the
    # preinstall action, but after the optional start message.
    # ======================================================================= #
    consider_applying_a_patch
    # ======================================================================= #
    # === Check for sed-action
    #
    # Next, we check whether we must apply sed. It must come before any
    # preinstall-action, and after we have cd-ed to the correct directory.
    # This also means after we have extracted the archive at hand.
    # ======================================================================= #
    check_for_sed_action
    # ======================================================================= #
    # === Pre-install actions
    #
    # Next, handle pre-install actions first, should they exist.
    # ======================================================================= #
    run_preinstall_actions
    # ======================================================================= #
    # Next register that we are compiling a program.
    # ======================================================================= #
    register_that_this_program_is_currently_being_compiled
    # ======================================================================= #
    # We could set some environment variables if we use ccache.
    # However had, programs such as "cmake" may then no longer work,
    # so the following lines of code were disabled.
    # ======================================================================= #
    # if use_ccache?
    #   ENV['CC']  = 'ccache gcc'
    #   ENV['CXX'] = 'ccache g++'
    # end
    exit_program if extract_only?
    # ======================================================================= #
    # (4) Reset any possible error message at this point.
    # ======================================================================= #
    RBT.reset_error_message
    # ======================================================================= #
    # (5) Change directory to the proper path:
    # ======================================================================= #
    unless is_a_gem_file?
      # ===================================================================== #
      # We have to be careful here when we build up this target.
      # ===================================================================== #
      change_into_this_target = extract_to_which_directory?.dup+
                                dataset_program_short_name?.to_s.dup+
                                '-'+
                                program_version?.dup.to_s+'/'
      set_extracted_base_directory(
        change_into_this_target.dup
      )
      if cookbook_dataset_configure_base_directory?
        change_into_this_target << cookbook_dataset_configure_base_directory?.dup
      end
      set_configure_base_directory(
        change_into_this_target
      )
      unless return_pwd == configure_base_directory?
        opnn; e "Entering the directory "\
                "#{sdir(configure_base_directory?)}"
      end
      cd_to_the_configure_base_directory
    end
    # ======================================================================= #
    # Next, we have to consider whether we will use a build directory.
    # Some programs insist on using a separate build directory.
    # ======================================================================= #
    consider_handling_build_directory
    # ======================================================================= #
    # Next, we have to diverge - for files that exist as-is, we have
    # to guess the build type. The other ones can be compiled based
    # on the information stored in the cookbook dataset itself. We
    # determine whether the file exists by querying whether there
    # is a yaml_dataset.
    # ======================================================================= #
    if yaml_dataset?
      consider_running_the_installation_steps_if_they_have_been_defined
      # ===================================================================== #
      # === The (optional) autogen-step
      #
      # Consider running "autogen" next.
      #
      # This should come after the archive was already extracted, and
      # pre-installation steps were performed - but it should come
      # BEFORE we invoke "autoconf" (the latter one is an optional step
      # as well, though).
      # ===================================================================== #
      decide_whether_to_invoke_autogen # (autogen tag)
      # ===================================================================== #
      # === Infer the default build system in use
      #
      # Next, we will find out which build system is to be used. By default
      # no assumptions are made, so we have to remain flexible and try to
      # guess which build system makes sense. The user may overrule this
      # behaviour, though, by specifically instructing RBT to use a specific
      # build system. This may sometimes be necessary when there are
      # projects that make use of more than one build system.
      # ===================================================================== #
      use_this_build_system = 
        RBT.infer_build_system(
          use_this_build_system,
          program_path?,
          required_deps_on?,
          { use_a_build_directory: use_build_directory? }
        )
      determine_which_compiler_will_be_used
      # ===================================================================== #
      # The user can overrule the ^^^ above guess-work with the
      # following flag:
      # ===================================================================== #
      if @internal_hash[:use_this_build_system].nil?
        unless cookbook_dataset?.build_system?.is_a?(Symbol) or # Symbols will be ignored.
               cookbook_dataset?.build_system?.empty?
          use_this_build_system = cookbook_dataset?.build_system?
        end
      else
        use_this_build_system = @internal_hash[:use_this_build_system]
      end
      cookbook_dataset?.set_use_this_build_system(use_this_build_system)
      # ===================================================================== #
      # Consider showing the infobox next. The infobox may also show
      # the required dependencies of the given program at hand, which
      # should always come before the archive at hand is extracted.
      #
      # A configuration showing the dependencies, within the file
      # called "always_show_dependencies.yml".
      #
      # Note that since as of Nov 2017, the default is to not always
      # show the dependencies, so the user has to specifically enable
      # this option if he/she wants to have that.
      #
      # In the old code, we used to call the method
      # feedback_dependencies_of_the_program() rather than
      # show the infobox at hand.
      # ===================================================================== #
      consider_showing_the_infobox
      # ===================================================================== #
      # In the following case-when menu, we must invoke the proper
      # build-system.
      # ===================================================================== #
      case use_this_build_system # case tag
      # ===================================================================== #
      # === meson
      # ===================================================================== #
      when 'meson'
        set_configure_command(:meson)
        _ = "meson --prefix=#{prefix?.to_s}".dup
        if meson_configure_options? and
          !meson_configure_options?.empty?
          meson_configure_options = meson_configure_options?.strip.sub(/PLACEHOLDER/,'').strip
          unless meson_configure_options.to_s.empty?
            # =============================================================== #
            # Append the meson-configure options in this case.
            # =============================================================== #
            opne "Making use of the #{royalblue('meson_configure_options')}, "\
                 "as specified by the #{slateblue('.yml')} file."
            _ << " #{meson_configure_options?.to_s}"
          end
        else
          if use_configure_options?
            _ << " #{configure_options?.to_s}"
          end
        end
        _.squeeze!(' ')
        e teal(_)
        run_this_sys_command(_)
        cd name_of_the_build_directory?
        ninja_install
      # ===================================================================== #
      # === rubygem
      # ===================================================================== #
      when 'rubygem'
        install_this_ruby_gem(program_path?)
      # ===================================================================== #
      # === ninja
      # ===================================================================== #
      when 'ninja'
        # =================================================================== #
        # Since as of 02.10.2018, we try to use ninja here automatically,
        # if the cookbook_dataset has a dependency on ninja.
        # =================================================================== #
        set_use_this_make_command('ninja')
      # ===================================================================== #
      # === waf
      # ===================================================================== #
      when 'waf'
        run_waf_based_installation
      # ===================================================================== #
      # === cmake
      # ===================================================================== #
      when 'cmake'
        run_cmake_then_make_then_make_install
      # ===================================================================== #
      # === scons
      # ===================================================================== #
      when 'scons'
        run_scons_based_installation
      # ===================================================================== #
      # === python
      # ===================================================================== #
      when 'python'
        run_python_installation
      # ===================================================================== #
      # === default
      #
      # This is the default. We will default to 'configure', 'make'
      # and 'make install'. The else clause is also used for 'configure',
      # so the default is essentially 'configure' as well.
      # ===================================================================== #
      else
        # =================================================================== #
        # === GNU configure step
        #
        # This entry point is used to run the traditional "configure",
        # "make" and "make install" steps, right after considering
        # creating the AppDir skeleton.
        #
        # It is the assumed default entry point, as most programs will still
        # use the GNU configure chain (at the least in the year 2019).
        # =================================================================== #
        consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install
      end
    else
      # ===================================================================== #
      # In this case we have to guess the build type, before we proceed,
      # since we have given the path to a file that exists.
      # ===================================================================== #
      guessed_build_type = guess_build_type
      opnn; e "Guessing the build-type next ... the build type is: "\
              "#{slateblue(':'+guessed_build_type.to_s)}"
# =========================================================================== #
# === FIX THE NEXT THING:
# TODO: FIXME
# =========================================================================== #
cliner
e swarn("DEBUG: THIS HERE OUGHT TO BE FIXED")
ecrimson extract_to_this_directory?
ecrimson extract_to_this_directory?
ecrimson extract_to_this_directory?
cliner
      # ===================================================================== #
      # Next handle the different build-types appropriately:
      # ===================================================================== #
      case guessed_build_type
      when :configure
        run_configure_then_make_then_make_install
      end
    end
    we_can_not_continue if an_error_has_occurred?
    # ======================================================================= #
    # Consider symlink glib-schema files into the /usr/ hierarchy.
    # ======================================================================= #
    consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy
    # ======================================================================= #
    # Make our instance of SymlinkProgram behave properly:
    # ======================================================================= #
    prepare_symlink_program_instance
    if successfully_compiled?
      # ===================================================================== #
      # Next, consider performing postinstallation steps:
      # ===================================================================== #
      consider_performing_postinstallation_actions # <- Postinstallation step
      # ===================================================================== #
      # Consider stripping the compiled binaries.
      # ===================================================================== #
      if had_to_be_compiled?
        do_strip_the_compiled_binaries
        # =================================================================== #
        # Next, we will consider creating and populating the subdirectory
        # called "lib/pkgconfig/". This may be necessary for programs that
        # install into "share/pkgconfig/" rather than "lib/pkgconfig".
        #
        # This step has to be done before we call the method
        # consider_symlinking_the_pkgconfig_files().
        # =================================================================== #
        consider_creating_and_populating_the_pkgconfig_directory
        # =================================================================== #
        # If the cookbook file at hand has symlinking_pkgconfig_files
        # enabled, and if the program is compiled, as AppDir, then we
        # will symlink .pc iles into /usr/lib/pkgconfig/, if the latter
        # one exists.
        #
        # This should actually be part of the post-installation actions,
        # but before running ldconfig.
        # =================================================================== #
        consider_symlinking_the_pkgconfig_files
        # =================================================================== #
        # Next register the configure-line into the configure "database",
        # unless a problem or error has occurred.
        # =================================================================== #
        if no_problem_was_encountered? and
           no_error_was_encountered?
          register_configure_line_into_configure_database
          # ================================================================= #
          # Also register it to the file that keeps track of which
          # programs were compiled successfully.
          # ================================================================= #
          register_last_compiled_program
        end
      end
      # ===================================================================== #
      # Consider running "ldconfig" next.
      # ===================================================================== #
      consider_running_ldconfig
    else
      # ===================================================================== #
      # Else a problem or an error may have occurred. We will thus check
      # for that. The error will be re-set more on the beginning of
      # this method rather than its end.
      # ===================================================================== #
      check_for_common_problems_and_common_errors
    end
    # ======================================================================= #
    # === Remove the extracted archive / directory
    #
    # We have to clean-up again, by removing the extracted archive. This
    # behaviour can be changed by the user, though. Additionally, the
    # individual .yml file may decide for us whether we will remove the
    # extracted directory or whether we will keep that directory. User
    # instructions overrule the settings in the .yml file, though.
    # ======================================================================= #
    consider_removing_the_extracted_archive
    # ======================================================================= #
    # Next we will consider removing empty subdirectories. This has to
    # happen here again, after the postinstall step, because the installation
    # may have failed. The method will also do a more general clean-up
    # step in the respective AppDir prefix.
    # ======================================================================= #
    consider_removing_empty_subdirectories
    consider_comparing_the_installed_libraries_versus_the_assumed_libraries
    store_time_snapshot
    consider_reporting_the_time_it_took_to_compile_this_program
    # ======================================================================= #
    # Also store the prefix that we used on the toplevel namespace.
    # ======================================================================= #
    RBT.set_last_prefix_used(use_which_prefix?)
    show_success_or_failure_status
    # ======================================================================= #
    # Ensure that the expanded cookbook .yml file exists:
    # ======================================================================= #
    if is_on_roebe? and !does_the_expanded_cookbook_file_exist_for_this_program?(this_program)
      expand_this_cookbook(this_program)
    end
    # ======================================================================= #
    # Return to the temp-directory as start again. This has to happen because
    # the underlying directory may have been removed, so we need to go to
    # a "stable" directory instead.
    # The second argument exists so that we are silent.
    # ======================================================================= #
    change_directory(temp_directory?, :do_not_report_anything)
    consider_changing_the_tab_title('.')
  end
Also aliased as: compile_this_program
do_download(i)
do_download_this_program(i) click to toggle source
#

do_download_this_program (download tag)

This is simply a plain wget wrapper.

#
# File lib/rbt/compile/upload_and_download.rb, line 263
def do_download_this_program(i)
  esystem 'wget '+i
end
do_enable_static_compilation() click to toggle source
#

do_enable_static_compilation

Enable static compilations.

#
# File lib/rbt/compile/static.rb, line 50
def do_enable_static_compilation
  @internal_hash[:build_static] = true
end
Also aliased as: enable_static?
do_exit_before_make() click to toggle source
#

do_exit_before_make

#
# File lib/rbt/compile/exit.rb, line 32
def do_exit_before_make
  @internal_hash[:exit_before_make] = true
end
do_exit_before_make_install() click to toggle source
#

do_exit_before_make_install

#
# File lib/rbt/compile/exit.rb, line 39
def do_exit_before_make_install
  @internal_hash[:exit_before_make_install] = true
end
do_expand_the_cookbooks() click to toggle source
#

do_expand_the_cookbooks

#
# File lib/rbt/compile/misc.rb, line 307
def do_expand_the_cookbooks
  ::RBT.expand_cookbooks(:all_of_them)
end
do_extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
do_guess_the_build_type()
Alias for: guess_build_type
do_install_only_binaries() click to toggle source
#

do_install_only_binaries

#
# File lib/rbt/compile/compile.rb, line 175
def do_install_only_binaries
  @internal_hash[:install_only_binaries] = true
end
do_install_only_the_headers( of_this_program = compile_these_programs?.first ) click to toggle source
#

do_install_only_the_headers

This method will only intall the headers of a program. You must call the method action_install_only_headers() for real action.

#
# File lib/rbt/compile/headers.rb, line 52
def do_install_only_the_headers(
    of_this_program = compile_these_programs?.first
  )
  do_not_compile
  do_not_run_configure
  disable_logging # We dont want to log.
  opnn; e "Installing only headers for the program `"\
          "#{sfancy(of_this_program)}` now."
  @internal_hash[:install_only_the_headers] = true
end
do_keep_la_files() click to toggle source
#

do_keep_la_files

Use this method if you wish to keep the libtool .la files. This may sometimes be necessary, even though libtool .la files are a fairly bad solution altogether.

#
# File lib/rbt/compile/libtool.rb, line 114
def do_keep_la_files
  @internal_hash[:keep_la_files] = true
end
do_not_check_whether_the_program_exists() click to toggle source
#

do_not_check_whether_the_program_exists

#
# File lib/rbt/compile/misc.rb, line 2797
def do_not_check_whether_the_program_exists
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = false
end
do_not_compile( be_verbose = true ) click to toggle source
#

do_not_compile

This method can be invoked to set the :continue_after_configure_step entry in the internal hash to false.

If set to false then we will NOT compile a program. Instead, we will run the configure script and quit after having done so.

#
# File lib/rbt/compile/misc.rb, line 2472
def do_not_compile(
    be_verbose = true
  )
  case be_verbose
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'We will not continue after configure phase.'
  end
  @internal_hash[:continue_after_configure_step] = false
  @internal_hash[:do_not_compile] = true
  set_do_not_symlink(:be_verbose) # So we don't run advanced symlink.
end
do_not_compile?() click to toggle source
#

do_not_compile?

#
# File lib/rbt/compile/misc.rb, line 2257
def do_not_compile?
  @internal_hash[:do_not_compile]
end
do_not_continue(be_verbose = false)
Alias for: we_can_not_continue
do_not_continue_after_make_step() click to toggle source
#

do_not_continue_after_make_step

#
# File lib/rbt/compile/misc.rb, line 2039
def do_not_continue_after_make_step
  @internal_hash[:continue_after_make_step] = false
end
do_not_display_the_infobox() click to toggle source
#

do_not_display_the_infobox

#
# File lib/rbt/compile/infobox.rb, line 101
def do_not_display_the_infobox
  @internal_hash[:show_the_infobox] = false
end
Also aliased as: do_not_show_the_infobox
do_not_download() click to toggle source
#

do_not_download

Setter-method to disable downloading the remote source package.

#
# File lib/rbt/compile/upload_and_download.rb, line 285
def do_not_download
  ihash?[:may_we_download] = false
end
do_not_exit_after_a_rubygem_has_been_installed() click to toggle source
#

do_not_exit_after_a_rubygem_has_been_installed

#
# File lib/rbt/compile/ruby.rb, line 94
def do_not_exit_after_a_rubygem_has_been_installed
  @internal_hash[:exit_after_a_rubygem_has_been_installed] = false
end
do_not_extract( be_verbose = true )
Alias for: set_skip_extracting
do_not_honour_check_to_ensure_that_the_program_exists()
do_not_initialize_a_new_cookbook_dataset() click to toggle source
#

do_not_initialize_a_new_cookbook_dataset

#
# File lib/rbt/compile/misc.rb, line 359
def do_not_initialize_a_new_cookbook_dataset
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset] = false
end
do_not_invoke_configure( be_verbose = true )
do_not_register_into_the_yaml_database() click to toggle source
#

do_not_register_into_the_yaml_database

#
# File lib/rbt/compile/gobolinux.rb, line 36
def do_not_register_into_the_yaml_database
  RBT.do_not_register_into_the_yaml_database
end
do_not_remove_extracted_archive(i = true)
do_not_remove_the_extracted_archive(i = true)
do_not_rename_the_kde_konsole_tab() click to toggle source
#

do_not_rename_the_kde_konsole_tab

#
# File lib/rbt/compile/tab.rb, line 29
def do_not_rename_the_kde_konsole_tab
  opnn; e 'We will not rename the KDE Konsole tab.'
  @internal_hash[:rename_tab_title] = false
end
do_not_run_configure( be_verbose = true ) click to toggle source
#

do_not_run_configure

Do not run the configure script. Since Jan 2012 we also disable running ldconfig in this method.

#
# File lib/rbt/compile/configure.rb, line 324
def do_not_run_configure(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not compile - or run any configure script.'
  end
  do_not_run_the_configure_script
  do_not_use_ldconfig
  no_postinstall_actions
end
Also aliased as: do_not_invoke_configure
do_not_run_configure_script() click to toggle source
#

do_not_run_configure_script

#
# File lib/rbt/compile/configure.rb, line 338
def do_not_run_configure_script
  @internal_hash[:run_configure_script] = false
end
do_not_run_ldconfig() click to toggle source
#

do_not_run_ldconfig

#
# File lib/rbt/compile/ldconfig.rb, line 42
def do_not_run_ldconfig
  do_not_use_ldconfig :be_silent
end
do_not_run_make() click to toggle source
#

do_not_run_make

#
# File lib/rbt/compile/make.rb, line 118
def do_not_run_make
  @internal_hash[:run_make_command] = false
end
do_not_run_make_install( be_verbose = false ) click to toggle source
#

do_not_run_make_install

Use this method if you wish to specifically skipping the “make install” step.

#
# File lib/rbt/compile/make_install.rb, line 107
def do_not_run_make_install(
    be_verbose = false
  )
  @internal_hash[:run_make_install] = false
  if be_verbose
    opnn; e 'We will not run the "'+slateblue('make install')+'" command.'
  end
  # ======================================================================= #
  # Running ldconfig seems pointless, so it is also disabled (silently).
  # ======================================================================= #
  do_not_use_ldconfig(:do_not_be_verbose)
end
Also aliased as: dont_make_install
do_not_run_ninja() click to toggle source
#

do_not_run_ninja

#
# File lib/rbt/compile/meson_and_ninja.rb, line 87
def do_not_run_ninja
  @internal_hash[:may_we_run_ninja] = false 
end
do_not_run_postinstall_actions()
do_not_run_the_configure_script()
do_not_show_the_infobox()
do_not_skip_extracting() click to toggle source
#

do_not_skip_extracting

This method will set towards extracting the archive.

#
# File lib/rbt/compile/extract.rb, line 45
def do_not_skip_extracting
  @internal_hash[:skip_extracting] = false
end
do_not_strip_binaries() click to toggle source
#

do_not_strip_binaries

This is the non-verbose variant to disable stripping of binaries.

If you need the verbose variant, use the method called verbose_do_not_strip_the_binaries() instead.

#
# File lib/rbt/compile/strip.rb, line 155
def do_not_strip_binaries
  @internal_hash[:strip_binaries] = false
end
do_not_strip_binaries?() click to toggle source
#

do_not_strip_binaries?

#
# File lib/rbt/compile/strip.rb, line 185
def do_not_strip_binaries?
  !strip_binaries?
end
Also aliased as: do_not_strip_the_binaries?
do_not_strip_the_binaries?()
do_not_try_to_autofix() click to toggle source
#

do_not_try_to_autofix

This method will specifically disable any attempts to try to autofix libtool-related problems. It is currently silent, all of the time.

#
# File lib/rbt/compile/misc.rb, line 1866
def do_not_try_to_autofix
  @internal_hash[:try_to_autofix] = false
end
do_not_use_any_compile_time_flags() click to toggle source
#

do_not_use_any_compile_time_flags

If you do not want to use any compile-time flags, aka CFLAGS, then you can use this method here.

#
# File lib/rbt/compile/misc.rb, line 2424
def do_not_use_any_compile_time_flags
  opne 'Setting compile-time flags ('+
       royalblue('CFLAGS')+', '+
       royalblue('LDFLAGS')+
       ') to empty.'
  set_cflags('')
end
do_not_use_any_configure_option() { |== :be_verbose| ... } click to toggle source
#

do_not_use_any_configure_option

This option allows us to avoid using any configure option.

Invocation example from the commandline:

ry htop --dont-use-configure-options
#
# File lib/rbt/compile/misc.rb, line 1457
def do_not_use_any_configure_option
  if block_given? and yield == :be_verbose
    # ===================================================================== #
    # Be verbose in this case.
    # ===================================================================== #
    opne 'No configure options will be used '\
         'for this run.'
  end
  @internal_hash[:try_to_use_configure_options] = false
end
do_not_use_autoconf() click to toggle source
#

do_not_use_autoconf

#
# File lib/rbt/compile/autoconf.rb, line 73
def do_not_use_autoconf
  @internal_hash[:use_autoconf] = false
  opnn; e 'We will not invoke autoconf.'
end
do_not_use_ldconfig( be_verbose = be_verbose? ) click to toggle source
#

do_not_use_ldconfig

Use only this method when you wish to disable running ldconfig.

To set this, do something like:

ry htop do_not_use_ldconfig
#
# File lib/rbt/compile/ldconfig.rb, line 26
def do_not_use_ldconfig(
    be_verbose = be_verbose?
  )
  case be_verbose
  when :do_not_be_verbose, :be_silent
    be_verbose = false
  end
  if be_verbose
    opne "We will not run `#{teal('ldconfig')}`."
  end
  RBT.configuration?.run_ldconfig = false
end
do_not_use_sed( be_verbose = false ) click to toggle source
#

do_not_use_sed

Disable the use of sed through this method.

#
# File lib/rbt/compile/sed.rb, line 136
def do_not_use_sed(
    be_verbose = false
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  end
  if be_verbose
    opnn; e "We will not be using #{lightgreen('sed')}."
  end
  @internal_hash[:sed] = false
end
do_permanently_disable_ccache( into = FILE_CCACHE, what = "false\n" ) click to toggle source
#

do_permanently_disable_ccache

#
# File lib/rbt/compile/ccache.rb, line 87
def do_permanently_disable_ccache(
    into = FILE_CCACHE,
    what = "false\n"
  )
  write_what_into(what, into)
  opne "Permanently disabling the use of ccache "\
       "(Stored into this file: `#{sfile(into)}`)."
  if is_on_roebe?
    into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\
           "#{File.basename(into)}"
    write_what_into(what, into)
    opne "Permanently disabling the use of ccache "\
         "(Stored into this file: `#{sfile(into)}`)."
  end
end
do_permanently_disable_the_colours() click to toggle source
#

do_permanently_disable_the_colours

This method can be used to permanently disable the colours.

Invoke this method by issuing:

ry --permanent-no-colours
#
# File lib/rbt/compile/colours.rb, line 46
def do_permanently_disable_the_colours
  opne 'Now permanently disabling the colours.'
  configuration?.use_colours = false
  what = false
  into = RBT.file_use_colours
  write_what_into(what, into)
  if is_on_roebe?
    into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+
           File.basename(into)
    opne "Also storing in `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
do_permanently_enable_ccache( into = FILE_CCACHE, what = "true\n" ) click to toggle source
#

do_permanently_enable_ccache

#
# File lib/rbt/compile/ccache.rb, line 68
def do_permanently_enable_ccache(
    into = FILE_CCACHE,
    what = "true\n"
  )
  write_what_into(what, into)
  opne "Permanently enabling the use of ccache "\
       "(Stored into this file: `#{sfile(into)}`)."
  if is_on_roebe?
    into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\
           "#{File.basename(into)}"
    write_what_into(what, into)
    opne "Permanently enabling the use of ccache "\
         "(Stored into this file: `#{sfile(into)}`)."
  end
end
do_permanently_enable_the_colours() click to toggle source
#

do_permanently_enable_the_colours

This method can be used to permanently enable the colours.

Invoke this method by issuing:

ry --permanent-enable-colours
#
# File lib/rbt/compile/colours.rb, line 24
def do_permanently_enable_the_colours
  opne 'Now permanently enable the colours.'
  configuration?.use_colours = true
  write_what_into(false, RBT.file_use_colours)
  if is_on_roebe?
    into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+
           File.basename(into)
    opne "Also storing in `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
do_postinstall_actions()
do_remove_la_files_after_compilation() click to toggle source
#

do_remove_la_files_after_compilation

#
# File lib/rbt/compile/libtool.rb, line 121
def do_remove_la_files_after_compilation
  @internal_hash[:keep_la_files] = false
end
do_run_simulation() click to toggle source
#

do_run_simulation

#
# File lib/rbt/compile/misc.rb, line 2053
def do_run_simulation
  @internal_hash[:run_simulation] = true
end
do_run_via_nontraditional_way()
do_set_keep_extracted(be_verbose = true) click to toggle source
#

do_set_keep_extracted

This delegates towards the method set_keep_the_extracted_archive and may also report to the end-user as to what is being done.

#
# File lib/rbt/compile/extract.rb, line 220
def do_set_keep_extracted(be_verbose = true)
  case be_verbose
  when :be_silent,
       :be_quiet
    be_verbose = false
  end
  if be_verbose
    opnn; e 'We will not remove the extracted directory '\
            'after we have finished.'
  end
  set_keep_the_extracted_archive
end
do_set_keep_extracted_archive(be_verbose = true)
do_show_the_infobox() click to toggle source
#

do_show_the_infobox

#
# File lib/rbt/compile/infobox.rb, line 108
def do_show_the_infobox
  @internal_hash[:show_the_infobox] = true
end
do_skip_extracting() click to toggle source
#

do_skip_extracting

#
# File lib/rbt/compile/extract.rb, line 298
def do_skip_extracting
  @internal_hash[:skip_extracting] = true
end
do_skip_postinstall_actions()
do_strip_the_compiled_binaries( strip_how = '--strip-unneeded' ) click to toggle source
#

do_strip_the_compiled_binaries

This will strip the compiled binaries, but only if we install them in an AppDir-prefix, that is, a path such as:

/Programs/Htop/2.0.2/

This stripping-operation will be done by the program called “strip”, which is part of the binutils suite.

There are three major ways how to use the strip essentially:

(1) --strip-unneeded
(2) --strip-debug
(3) --strip-all

“strip –strip-debug” will only remove the debugging symbols.

“strip –strip-all” will remove all symbols.

“strip –strip-unneeded” will remove all symbols that are not needed for relocation processing.

Note that you can also strip the symbol table, from an object file, by using the “-s option” of the strip command.

When I tested different strip variants, in particular –strip-debug and –strip-unneeded, the latter one was producing significantly smaller binary files. When I used –strip-all and compared it to –strip-unneeded, the results were the same - so based on this, I am setting “–strip-unneeded” as the default.

#
# File lib/rbt/compile/strip.rb, line 44
def do_strip_the_compiled_binaries(
    # ===================================================================== #
    # Determine which strip-variant to use next:
    #   strip_how = '--strip-debug'
    #   strip_how = '--strip-all'
    # ===================================================================== #
    strip_how = '--strip-unneeded' # <- This is the current default.
  )
  # ======================================================================= #
  # Do not strip the binaries if an error has occurred or if the user
  # has not enabled this option.
  # ======================================================================= #
  return unless can_we_continue?
  return if an_error_has_occurred?
  return if do_not_strip_the_binaries?
  # ======================================================================= #
  # First, we must determine whether we will use the strip command or
  # whether we will not. Presently, we will use the strip command if
  # the user_prefix either includes the programs directory - or if
  # we use a path that is NOT using /usr as part of its prefix.
  #
  # As of January 2019, the above has been changed - we will only use
  # this if the real prefix includes the programs directory. Any other
  # prefixes will be ignored.
  # ======================================================================= #
  if real_prefix?.include?(programs_dir?) # or
     # !real_prefix?.include?('/usr')
    _ = rds(real_prefix?.to_s+'/bin/')
    # ===================================================================== #
    # Next obtain all entries in the bin/ subdirectory there. This may
    # lead to wrong results, though, as it may also include other files
    # if we are not careful.
    # ===================================================================== #
    all_files_in_the_bin_subdirectory = Dir["#{_}*"]
    # ===================================================================== #
    # Since as of 01.02.2019 we will only keep entries that are also
    # registered under "binaries:" in the corresponding .yml file.
    # This was specifically done to prevent running strip on e. g.
    # /usr/bin/* or /root/bin/*.
    # ===================================================================== #
    binaries = binaries?
    all_files_in_the_bin_subdirectory.select! {|entry|
      binaries.include?(File.basename(entry))
    }
    strip_command = "strip #{strip_how.lstrip}"
    unless all_files_in_the_bin_subdirectory.empty?
      how_many = sfancy(all_files_in_the_bin_subdirectory.size.to_s)
      # =================================================================== #
      # Notify the user how many executables will be modified
      # through strip next.
      # =================================================================== #
      text = "Next running \"#{sfancy(strip_command)}\" on".dup
      if all_files_in_the_bin_subdirectory.size > 1
        text << ' all'
      end
      text << ' '+how_many # Add the number here.
      if all_files_in_the_bin_subdirectory.size > 1
        text << ' binaries.'
      else
        text << ' binary.'
      end
      # =================================================================== #
      # Display our findings to the user next:
      # =================================================================== #
      opne text
      all_files_in_the_bin_subdirectory.each {|this_file|
        # ================================================================= #
        # The following command will usually run:
        #   "strip --strip-unneeded *"
        # ================================================================= #
        cmd = "#{strip_command} #{this_file}"
        opne "  #{sfancy(cmd)}"
        system(cmd) 
      }
    end
  end
end
do_the_dependencies_include_this_program?( i = compile_which_program? ) click to toggle source
#

do_the_dependencies_include_this_program?

This method can be used to check whether the dependencies include a given program at hand (the input).

Keep in mind that dependencies can be written in either “name” or “name >= 1.2.3” style. So we also have to check for the second possibility there.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 520
def do_the_dependencies_include_this_program?(
    i = compile_which_program?
  )
  dependencies = required_dependencies_on?
  # ======================================================================= #
  # Simplify the dependencies next.
  # ======================================================================= #
  dependencies.map! {|entry|
    if entry.include?(' >') or entry.include?(' <')
      entry = entry.split(' ').first.strip
    end
    entry
  }
  dependencies.include? i
end
do_upgrade_from_this_file(i) click to toggle source
#

do_upgrade_from_this_file

This method can be used to read input from a file, in order to determine which programs are to be compiled.

#
# File lib/rbt/compile/misc.rb, line 2131
def do_upgrade_from_this_file(i)
  case i # case tag
  when :default, :def
    i = 'these_programs_can_be_upgraded.yml'
  end
  if File.exist? i
    if i.end_with? '.yml'
      dataset_to_use = YAML.load_file(i)
    else
      dataset_to_use = File.readlines(i).map {|line| line.strip }
    end
    _ = dataset_to_use
    _ = _.join(', ') if _.is_a? Array
    opne "We will use this dataset: #{slateblue(_)}"
    set_compile_these_programs(dataset_to_use)
  else
    opne "No file called #{sfile(i)} appears to exists."
  end
end
do_upload_binaries() click to toggle source
#

do_upload_binaries

#
# File lib/rbt/compile/upload_and_download.rb, line 160
def do_upload_binaries
  @internal_hash[:upload_binaries] = true
end
do_upload_ruby_binary() click to toggle source
#

do_upload_ruby_binary

To invoke this, try:

rbt --upload-ruby-binary
#
# File lib/rbt/compile/ftp.rb, line 68
def do_upload_ruby_binary
  ensure_that_the_log_directory_exists
  # ======================================================================= #
  # Obtain the path to the local ruby version in use:
  # ======================================================================= #
  path_to_ruby = "#{programs_dir?}Ruby/"
  base_directory_to_upload = "#{path_to_ruby}Current" # This is a symlink.
  ruby_version = File.readlink(base_directory_to_upload)
  cd log_dir?
  _ = path_to_ruby+ruby_version+'/' # This is the full, real path.
  # ======================================================================= #
  # Next, use tar to create an archive.
  # ======================================================================= #
  readelf_command_to_use  = "readelf -h #{_}bin/ruby"
  binary_32_bit_or_64_bit = `#{readelf_command_to_use}`
  binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.split(N).select {|line|
    line.include? 'Class:'
  }
  binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.to_s.dup
  binary_32_bit_or_64_bit =~ /(\d+)/
  binary_32_bit_or_64_bit = $1.to_s.dup+'-bit'
  e 'We will put this archive into `'+sdir((Dir.pwd+'/').squeeze('/'))+'`.'
  name_of_the_ruby_archive = 'ruby-'+ruby_version+'-'+binary_32_bit_or_64_bit+'.tar.xz'
  _ = 'tar cfJv '+name_of_the_ruby_archive+' '+_
  esystem _
  _ = (Dir.pwd+'/'+name_of_the_ruby_archive).squeeze '/'
  if File.exist? _
    e 'The file now resides at `'+sfile(_)+'`.'
    do_binary_upload_of_this_file(_) # Here we finally upload the archive.
  else
    e 'Some error appears to have happened - no archive at '+sfile(_)
    e ' could be found.'
  end
end
do_use_a_build_directory( be_verbose = true )
do_use_a_white_background() click to toggle source
#

do_use_a_white_background

We will silently assume that the user has a white background, and will re-assign to use a green font colour in this case, on KDE Konsole.

#
# File lib/rbt/compile/colours.rb, line 67
def do_use_a_white_background
  ::Colours.table_colour_methods_to_specific_colour[:simp] = :seagreen
end
do_use_an_appdir_prefix()
do_use_appdir_prefix() click to toggle source
#

do_use_appdir_prefix

This method will call do_compile_in_a_non_traditional_way, but it will always be quiet.

#
# File lib/rbt/compile/prefix.rb, line 138
def do_use_appdir_prefix
  do_compile_in_a_non_traditional_way(:be_quiet)
end
do_use_autoconf() click to toggle source
#

do_use_autoconf

#
# File lib/rbt/compile/autoconf.rb, line 65
def do_use_autoconf
  @internal_hash[:use_autoconf] = true
  opnn; e 'We will invoke autoconf.'
end
do_use_autogen( use_this_cmd = "sh click to toggle source
#

do_use_autogen

This invokes the autogen script, by using 'sh'.

In oldschool shell script code, this means that we will run the following command:

sh autogen.sh
#
# File lib/rbt/compile/autogen.rb, line 73
def do_use_autogen(
    use_this_cmd = "sh #{FILE_AUTOGEN}" # 2>&1'
  )
  cliner {
    _ = return_pwd
    opne simp('Doing `')+sfancy(use_this_cmd)+simp('` from ')+sdir(_)
    opne simp('using the following command:')
    opn; efancy '  '+use_this_cmd
  }
  `#{use_this_cmd}`
end
do_use_build_directory( be_verbose = true ) click to toggle source
#

do_use_build_directory

Use this method to specifcally “tell” a program to do use a build directory. For cmake-based projects it is recommended to use a build directory.

Usage example:

ry htop build
#
# File lib/rbt/compile/build_directory.rb, line 106
def do_use_build_directory(
    be_verbose = true
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'A build directory will be used.'
  end
  @internal_hash[:use_build_directory] = true
end
do_use_clang_compiler( shall_we_notify_the_user = :notify_the_user )
do_use_cmake() click to toggle source
#

do_use_cmake

If you wish to use cmake, you can do so via this method here.

#
# File lib/rbt/compile/cmake.rb, line 43
def do_use_cmake
  opne 'We will use cmake rather than make.'
  set_use_this_make_command 'cmake'
end
Also aliased as: use_cmake
do_use_glib_schema() click to toggle source
#

do_use_glib_schema

Use this method to enable the use of a glib-schema.

#
# File lib/rbt/compile/misc.rb, line 1901
def do_use_glib_schema
  @internal_hash[:use_glib_schema] = true
end
do_use_gobolinux_symlinkprogram(be_verbose = true) click to toggle source
#

do_use_gobolinux_symlinkprogram

#
# File lib/rbt/compile/gobolinux.rb, line 110
def do_use_gobolinux_symlinkprogram(be_verbose = true)
  if be_verbose
    opnn; e 'Using the GoboLinux SymlinkProgram rather than '\
            'the internal RBT::SymlinkProgram script.'
  end
  @internal_hash[:use_gobolinux_symlinkprogram] = true
end
do_use_meson() click to toggle source
#

do_use_meson

This method will allow us to use meson. It will, on roebe systems, also try to use Python 3 if it is not the main one in use.

#
# File lib/rbt/compile/meson_and_ninja.rb, line 19
def do_use_meson
  use_utf8_encoding_in_env
  set_use_this_configure_command(:meson)
  set_use_this_build_directory('build')
  consider_enabling_python3
end
do_use_meson_and_ninja() click to toggle source
#

do_use_meson_and_ninja

#
# File lib/rbt/compile/meson_and_ninja.rb, line 36
def do_use_meson_and_ninja
  do_use_meson
  do_use_ninja_as_the_build_system
end
do_use_ninja_as_the_build_system() click to toggle source
#

do_use_ninja_as_the_build_system

#
# File lib/rbt/compile/meson_and_ninja.rb, line 29
def do_use_ninja_as_the_build_system
  set_use_this_make_command(:ninja)
end
do_use_python2( shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?) )
do_use_python3( shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?) )
do_use_random_build_directory( be_verbose = true ) click to toggle source
#

do_use_random_build_directory

This method can be used to use an ad-hoc random build directory.

#
# File lib/rbt/compile/build_directory.rb, line 145
def do_use_random_build_directory(
    be_verbose = true
  )
  use_this_as_the_new_name = ''.dup
  n_times = (8..16).to_a.sample
  n_times.times {
    use_this_as_the_new_name << ALPHABET.sample
  }
  if be_verbose
    opne "We will use a #{lightgreen('random directory')} as "\
         "build directory (#{sfancy(use_this_as_the_new_name)})."
  end
  do_use_build_directory :be_quiet
  set_name_for_the_build_directory(use_this_as_the_new_name)
end
do_use_random_version( this_program = compile_which_program? ) click to toggle source
#

do_use_random_version

Use a random version of a program.

Usage example:

ry gcc --use-random-version
#
# File lib/rbt/compile/version.rb, line 227
def do_use_random_version(
    this_program = compile_which_program?
  )
  cfav = RBT::Cookbooks::CheckForAvailableVersions.new(this_program)
  available_programs = cfav.programs?.map {|entry| File.basename(entry) }
  _ = available_programs.sample
  opne "We will use another version (for program #{simp(_)})"
  dataset?.set_complex_program_version(_) # This here sets the new version.
end
do_use_the_clang_compiler( shall_we_notify_the_user = :notify_the_user ) click to toggle source
#

do_use_the_clang_compiler

Use this method if you wish to make use of the (LLVM) clang compiler rather than gcc.

Do note that you can also use special arguments or combine clang with ccache, such as shown in the following examples:

export CC='ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'

Invocation example:

ry htop --clang
#
# File lib/rbt/compile/clang.rb, line 28
def do_use_the_clang_compiler(
    shall_we_notify_the_user = :notify_the_user
  )
  case shall_we_notify_the_user
  when :notify_the_user,
       :and_notify_the_user
    opnn; e "We will attempt to use (#{teal('LLVM')}) #{slateblue('clang')} "\
            "to compile the code at hand."
  end
  set_this_env_variable 'CC=clang',    :be_quiet
  set_this_env_variable 'CXX=clang++', :be_quiet
  @internal_hash[:compiler_to_use] = :clang # Keep track of the compiler here.
end
Also aliased as: do_use_clang_compiler
do_we_compile_statically?()
Alias for: build_static?
do_we_use_a_build_directory?()
do_we_use_python3?() click to toggle source
#

do_we_use_python3?

This method will return true if we use python version 3 or higher, and false otherwise.

#
# File lib/rbt/compile/python.rb, line 234
def do_we_use_python3?
  version = `python -V 2>&1`.chomp
  if version.include? ' '
    version = version.split(' ').last
  end
  version.start_with? '3' # <- This check has to suffice for now.
end
does_a_python_binary_exist?() click to toggle source
#

does_a_python_binary_exist?

This method will return true if a “python” binary can be found in the PATH variable - and it will return false otherwise.

#
# File lib/rbt/compile/python.rb, line 17
def does_a_python_binary_exist?
  _ = false
  check_these_directories = query_path?
  if check_these_directories.is_a?(String) and
     check_these_directories.include?(':')
    splitted = check_these_directories.split(':')
    splitted.each {|this_path|
      target = rds(this_path+'/python')
      if File.exist?(target)
        _ = true
      end
    }
  end
  _
end
does_this_file_exist?( this_file = FILE_SCONS ) click to toggle source
#

does_this_file_exist?

This method checks whether the given-input argument, an assumed path to a file, exists.

The reason why this method exists is because it was necessary to do a “does this file exist” check in other directories rather than the current working directory.

#
Calls superclass method RBT::Base#does_this_file_exist?
# File lib/rbt/compile/misc.rb, line 3176
def does_this_file_exist?(
    this_file = FILE_SCONS
  )
  this_file = this_file.dup # <- We must always work on a copy.
  # ======================================================================= #
  # We have to check whether the cookbook_dataset has been initialized.
  # If it has not been initialized yet, we will not query whether we
  # ought to use a build directory or not.
  # ======================================================================= #
  if cookbook_dataset? and use_build_directory?
    this_file.prepend('../')
  end
  super(this_file)
end
dont_make_install( be_verbose = false )
download( url_for_program = url1?, may_we_download = may_we_download?, change_to_this_directory = base_dir?, shall_we_update_the_dataset = true )
Alias for: download_program
download_program( url_for_program = url1?, may_we_download = may_we_download?, change_to_this_directory = base_dir?, shall_we_update_the_dataset = true ) click to toggle source
#

download_program (download tag, download archive, wget tag)

The method `download_program` will attempt to download the given program, which is the first argument passed to this method. An URL is expected as argument here, such as 'hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz'.

For this download-related activity, we will either use a plain system() call to “wget” or we may use a ruby wget-wrapper. On Linux or BSD-based systems 'wget' may be simpler. On windows we may have to use a ruby-variant of 'wget' instead.

Do note that the method download_program() will always assume that the first argument given is an Array - that is, an Array of multiple urls. It will download all passed remote programs in a batch-like operation. This allows you to e. g. download the whole KDE stack, in principle, by simply passing the Array of remote entries.

Please keep in mind that we will change_directory() in this method too, so you don't have to call that on your own.

As of 05 September 2014 we will also honour the “do_not_download” setting, if it was defined. This can be overruled in the arguments to this method.

#
# File lib/rbt/compile/upload_and_download.rb, line 69
def download_program(
    url_for_program             = url1?,
    may_we_download             = may_we_download?,
    change_to_this_directory    = base_dir?,
    shall_we_update_the_dataset = true
  )
  url_for_program = [url_for_program].flatten.compact
  # ======================================================================= #
  # We will handle some special Symbols next:
  # ======================================================================= #
  case shall_we_update_the_dataset
  when :do_not_update_the_dataset
    shall_we_update_the_dataset = false
  end
  case may_we_download
  when :do_download,
       :we_may_download
    may_we_download = true
  end
  case change_to_this_directory
  when :default
    change_to_this_directory = base_dir?
  end
  url_for_program.each {|use_this_remote_url|
    if may_we_download
      url_for_program = use_this_remote_url
      url_for_program = url1? if url_for_program == :def
      # ======================================================================= #
      # Since Jul 2011 we use pure wget for this. Something is odd with
      # RubyWget and until we have fixed this, plain wget has to be used.
      # ======================================================================= #
      use_svn = dataset?.svn_url?
      # ======================================================================= #
      # Check whether the base directory exists.
      # ======================================================================= #
      if !File.exist?(change_to_this_directory.to_s)
        opnn; e simp('Creating the directory `')+
                sdir(change_to_this_directory)+
                simp('` next.')
        create_directory(change_to_this_directory)
      end
      # ======================================================================= #
      # Change into the base directory first, before continuing to try
      # to download the archive in question.
      # ======================================================================= #
      change_directory(change_to_this_directory) # cd into the archive.
      # ======================================================================= #
      # Change into the archive. Be verbose about it.
      # ======================================================================= #
      cliner {
        opnn; e "#{simp('Downloading ')}#{sfile(url_for_program)}"
        opnn; e simp('into the directory ')+sdir(change_to_this_directory)+
                simp(' now.')
      }
      if url_for_program.to_s.include? 'tar.gz'
        # overrule here for .tar.gz files.
        _ = cookbook_dataset? #.data
        _.set_archive_type('.tar.gz')
        _.set_program_full_name
        _.assemble_program_path
        @data = cookbook_dataset?.return_dataset
      end
      if use_svn.empty? # Assume no SVN was given. bl rubywget
        do_download_this_program(url_for_program)
        # RubyWget.new(url_for_program)
      else # Else, we should use svn perhaps? Hmm or not.
        if _
          do_download_this_program(_)
        else
          do_download_this_program(url_for_program)
        end
        # RubyWget.new(_)
      end
      if shall_we_update_the_dataset
        # ================================================================= #
        # We will update the dataset as well.
        # ================================================================= #
        yaml_dataset = load_yaml_dataset_for_this_program(
          program_information_return_name(url_for_program), :return_flat_datastructure
        )
        assign_to_the_main_dataset(
          yaml_dataset
        )
      end
    end
  }
end
Also aliased as: download
download_this_remote_program(i)
download_this_remote_url_into_that_local_directory( url = url1?, local_directory = '/Depot/Temp/downloads/' ) click to toggle source
#

download_this_remote_url_into_that_local_directory

The first argument should be the remote URL to the program at hand.

The second argument should be a local directory.

#
# File lib/rbt/compile/upload_and_download.rb, line 24
def download_this_remote_url_into_that_local_directory(
    url             = url1?,
    local_directory = '/Depot/Temp/downloads/'
  )
  local_directory = local_directory.dup if local_directory.frozen?
  local_directory << '/' unless local_directory.end_with? '/'
  unless File.directory? local_directory
    create_directory(local_directory) { :be_verbose }
  end
  cd local_directory # change directory into that target
  download_program(
    url,
    :we_may_download,
    local_directory,
    :do_not_update_the_dataset
  )
end
download_using_svn( i = program? ) click to toggle source
#

download_using_svn

Use this method here to download/checkout from svn. In order for this to properly work, you need to define a svn_url in the yaml file for the respective program at hand.

To try out this method, do:

ry dosbox svn
#
# File lib/rbt/compile/upload_and_download.rb, line 208
def download_using_svn(
    i = program?
  )
  _ = "svn co #{dataset?.svn_url?}"
  working_directory = sdir(return_current_pwd)
  opnn; e "Now trying to use svn to download the source directly "\
          "(working directory is: #{working_directory}."
  opnn; print '  '
  e _
  _result = `#{_}` # We may want to use this return-value at a later time.
  # ======================================================================= #
  # === Rename the trunk directory next
  # ======================================================================= #
  if File.directory? 'trunk'
    _ = "#{i}-#{today?}"
    opnn; e 'Now renaming directory `'+sdir('trunk')+'` to `'+simp(_)+'`.'
    rename('trunk', _)
    unless Object.const_defined? :ToTarXz
      begin # Try to pull in gem to_tar_xz here.
        require 'to_tar_xz'
      rescue LoadError; end
    end
    if Object.const_defined? :ToTarXz
      opnn; e 'Now trying to package the directory `'+sdir(_)+'`.'
      ToTarXz.new(_)
      package_name = Dir[_+'.tar.xz']
      unless package_name.empty?
        e 'All should be done now. You can move this .tar.xz '\
          'package ('+simp(package_name.first)+').'
      end
    end
  end
end
edit_the_yaml_file_via_the_main_editor( this_yaml_file = compile_which_program? ) click to toggle source
#

edit_the_yaml_file_via_the_main_editor

Invocation example:

rbt --edit-file=nano
#
# File lib/rbt/compile/yaml.rb, line 41
def edit_the_yaml_file_via_the_main_editor(
    this_yaml_file = compile_which_program?
  )
  this_yaml_file = this_yaml_file.to_s.dup
  this_yaml_file = 'nano' if this_yaml_file.empty?
  _ = nil
  _ = ENV['EDITOR'].to_s.dup+' ' if ENV['EDITOR']
  # ======================================================================= #
  # Overrule on my home system.
  # ======================================================================= #
  if is_on_roebe? or _.nil?
    _ = editor?+' '
  end
  unless File.exist? this_yaml_file
    unless this_yaml_file.include? '/'
      this_yaml_file = return_location_to_this_programs_yaml_file(this_yaml_file)
    end
  end
  if File.exist? this_yaml_file
    _ << this_yaml_file
  else
    _ << find_this_yaml_file(this_yaml_file)
  end
  esystem _
end
edit_this_yaml_file_via_the_main_editor( this_yaml_file = compile_which_program? )
either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install() click to toggle source
#

either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install

#
# File lib/rbt/compile/misc.rb, line 2099
def either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install
  if a_program_has_been_initialized?
    report_the_amount_of_binaries
  else
    RBT.report_how_many_binaries_are_registered
  end
end
empty_archive_type() click to toggle source
#

empty_archive_type

This will clear the archive type.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 700
def empty_archive_type
  cookbook_dataset?.archive_type = ''
end
enable_autogen( be_verbose = true ) click to toggle source
#

enable_autogen

This method will enable autogen.

#
# File lib/rbt/compile/autogen.rb, line 124
def enable_autogen(
    be_verbose = true
  )
  if be_verbose
    opne 'We will make use of autogen.'
  end
  @internal_hash[:use_autogen] = true # Enable the use of autogen in our dataset here.
end
enable_is_on_gobolinux() click to toggle source
#

enable_is_on_gobolinux

This method can be used to default to a GoboLinux behaviour.

We should closely follow the behaviour of GoboLinux via the RBT scripts, 1:1 - no need to create incompatibilities at this point.

#
# File lib/rbt/compile/gobolinux.rb, line 23
def enable_is_on_gobolinux
  # ENV['IS_ON_GOBOLINUX'] = '1' # <- Disabled as of 25.09.2018; we probably no longer need to do this.
  @internal_hash[:is_on_gobolinux] = true
  use_non_traditional_prefix
  do_not_symlink_headers
  do_not_symlink_pkgconfig_files
  do_use_gobolinux_symlinkprogram # <-- Trying this as of Oct 2017.
  do_not_register_into_the_yaml_database
end
Also aliased as: is_on_gobolinux
enable_non_traditional_compilation( optional_command_given = nil, be_verbose = true )
enable_porg() click to toggle source
#

enable_porg

Enable porg via this method.

#
# File lib/rbt/compile/porg.rb, line 59
def enable_porg
  @internal_hash[:use_porg] = config?.use_porg = true
end
enable_python2() click to toggle source
#

enable_python3

#
# File lib/rbt/compile/python.rb, line 179
def enable_python2
  consider_enabling_python2(true)
end
enable_python3() click to toggle source
#

enable_python3

#
# File lib/rbt/compile/python.rb, line 224
def enable_python3
  consider_enabling_python3(true)
end
enable_shared_disable_static() click to toggle source
#

enable_shared_disable_static

#
# File lib/rbt/compile/configure.rb, line 248
def enable_shared_disable_static
  append_enable_shared_to_the_configure_options
  append_disable_static_to_the_configure_options
end
enable_simulation( optional_message = '' ) click to toggle source
#

enable_simulation

Enable to run in simulation mode. The first argument is an optional message we give, in which case we will output that message.

#
# File lib/rbt/compile/misc.rb, line 2207
def enable_simulation(
    optional_message = ''
  )
  unless optional_message.empty?
    opne optional_message
  end
  do_run_simulation
end
enable_static?()
enable_stow() click to toggle source
#

enable_stow

This method will enable stow.

#
# File lib/rbt/compile/misc.rb, line 3044
def enable_stow
  configuration?.use_stow = true
  opne 'Enabling stow next.'
  configuration?.save # And store this.
end
enable_traditional_compilation( be_verbose = true )
ensure_dataset_for_this_program( i, optional_arguments = nil )
ensure_proper_dataset( i, optional_arguments = nil )
ensure_proper_dataset_for( i, optional_arguments = nil )
ensure_that_a_dataset_exists_for_this_program( i, optional_arguments = nil )
ensure_that_the_dataset_exists( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
ensure_that_the_dataset_exists_for_this_program( i, optional_arguments = nil )
ensure_that_the_default_dataset_exists_for_this_program( i, optional_arguments = nil )
ensure_that_the_log_directory_exists() click to toggle source
#

ensure_that_the_log_directory_exists

This method will ensure that the log directory, usually the one at “/Depot/Temp/rbt/”, exists.

#
# File lib/rbt/compile/ensure.rb, line 63
def ensure_that_the_log_directory_exists
  _ = log_directory?
  mkdir(_) unless File.directory? _
end
ensure_that_the_main_dataset_exists( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
ensure_that_the_program_exists( i ) click to toggle source
#

ensure_that_the_program_exists

This method will control whether we can continue to run. We can continue to run if the program exists as part of the cookbooks project. One exception to this rule is when the last character is a '*' token. In this case we assume that he user wants to simply get a list of available programs instead, starting with that specific name, e. g. “e*” should yield a list of all programs starting with the character “e”.

You can try this out by doing:

ry e*
#
# File lib/rbt/compile/ensure.rb, line 25
def ensure_that_the_program_exists(
    i
  )
  i = i.to_s
  if honour_check_to_ensure_that_the_program_exists?
    unless cookbooks_include_this_program?(i)
      # =================================================================== #
      # Handle not-registered programs next:
      # =================================================================== #
      opne "#{crimson('The program `')}#{seagreen(i)}#{crimson('` could not be found. We thus ')}"\
           "#{crimson('can not compile')}"
      opne crimson('it and hence, can not continue. If this '\
           'file should exist, it')
      opne crimson('could be found at:')
      e
      e "  #{sfile(return_location_to_this_programs_yaml_file(i))}"
      e
      we_can_not_continue
    end unless i.end_with? '*'
  end
  return can_we_continue?
end
ensure_that_we_can_extract_to_a_proper_directory() click to toggle source
#

ensure_that_we_can_extract_to_a_proper_directory

#
# File lib/rbt/compile/ensure.rb, line 51
def ensure_that_we_can_extract_to_a_proper_directory
  if extract_to?.to_s.empty?
    set_extract_to(temp_directory?)
  end
end
ensure_that_we_have_a_dataset( i, optional_arguments = nil )
erroneous_libtool_entries?()
error_is( this_error = :meson_could_not_be_found ) click to toggle source
#

error_is (error_is tag)

This registered an error. An error is always a problem, but some problems allow us to continue the installation steps. An error on the other hand will end the installation procedure.

#
# File lib/rbt/compile/problems_and_errors.rb, line 49
def error_is(
    this_error = :meson_could_not_be_found
  )
  problem_is(this_error)
  an_error_has_occurred
  # ======================================================================= #
  # Register the error on the main RBT namespace as well.
  # ======================================================================= #
  RBT.append_error_message(
    this_error
  )
end
error_is?()
Alias for: errors?
error_message?()
Alias for: errors?
errors?() click to toggle source
#

errors?

#
# File lib/rbt/compile/problems_and_errors.rb, line 37
def errors?
  RBT.error_message?
end
Also aliased as: error_is?, error_message?
exit_after_a_rubygem_has_been_installed?() click to toggle source
#

exit_after_a_rubygem_has_been_installed?

#
# File lib/rbt/compile/ruby.rb, line 101
def exit_after_a_rubygem_has_been_installed?
  @internal_hash[:exit_after_a_rubygem_has_been_installed]
end
exit_before_make?() click to toggle source
#

exit_before_make?

#
# File lib/rbt/compile/exit.rb, line 53
def exit_before_make?
  @internal_hash[:exit_before_make]
end
exit_before_make_install?() click to toggle source
#

exit_before_make_install?

#
# File lib/rbt/compile/exit.rb, line 46
def exit_before_make_install?
  @internal_hash[:exit_before_make_install]
end
expand_this_cookbook( i = compile_which_program? )
extra_information?() click to toggle source
#

extra_information?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 582
def extra_information?
  cookbook_dataset?.extra_information?
end
extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_only?() click to toggle source
#

extract_only?

#
# File lib/rbt/compile/extract.rb, line 269
def extract_only?
  @internal_hash[:extract_only]
end
extract_package( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_program_and_cd_to_the_configure_base_directory() click to toggle source
#

extract_program_and_cd_to_the_configure_base_directory

#
# File lib/rbt/compile/misc.rb, line 2182
def extract_program_and_cd_to_the_configure_base_directory
  do_extract
  cd_to_the_configure_base_directory
end
extract_the_archive?() click to toggle source
#

extract_the_archive?

Query method over as to whether RBT will extract the archive or not.

#
# File lib/rbt/compile/extract.rb, line 322
def extract_the_archive?
  @internal_hash[:extract_the_archive]
end
extract_this_archive( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_this_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_this_program_if_it_exists( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true ) click to toggle source
#

extract_this_program_if_it_exists (extract tag, extracter tag)

This method will extract the given archive directory, by delegating towards class Extracter.

This method ought to be invoked quite early, logically; the method “consider_extracting_this_program()” may be used to invoke this method.

#
# File lib/rbt/compile/extract.rb, line 149
def extract_this_program_if_it_exists(
    i                                                         = cookbook_dataset_program_path?,
    extract_to_this_location                                  = extract_to?,
    shall_we_report_to_the_user_if_the_archive_does_not_exist = true
  )
  if File.exist? i
    if compile_which_program?.nil?
      set_program_name(ProgramInformation.return_name(i))
    end
    if program_version?.nil?
      set_program_version(
        ProgramInformation.return_program_version(i)
      )
    end
    @program_name_and_program_version = compile_which_program?+'-'+program_version?.to_s
    if run_simulation?
      opnn; e "We would normally extract `#{sfile(i)}` "\
              "to #{sdir(extract_to_this_location)} next,"
      opnn; e 'but since we run in simulation-mode, we will not '\
              'extract anything.'
    else
      invoke_extracter(i) # <- Delegate to invoke_extracter() here.
    end
    # ===================================================================== #
    # Next we will exit if the user told us that he/she is only
    # interested in extracting the program.
    # ===================================================================== #
    exit_program if extract_only?
  else
    if shall_we_report_to_the_user_if_the_archive_does_not_exist
      opnn; e swarn('No file could be found at `')+
              sfile(i)+
              swarn('` - thus,')
      opnn; e swarn('we can not extract anything.')
      # =================================================================== #
      # Also set a specific error, so that we won't continue.
      # =================================================================== #
      error_is 'We can not continue. Has the archive '\
               'been properly extracted?'
    end
  end
end
extract_to( i = RBT.log_directory?, be_verbose = false )
extract_to?()
extract_to_default_directory( i = RBT.log_directory? ) click to toggle source
#

extract_to_default_directory

By default, we will extract to this directory - but the value is lateron refined to the full path instead; so the assignment done here is just so that we have a starting value we can work with.

This method will be called from within the method reset().

#
# File lib/rbt/compile/extract.rb, line 94
def extract_to_default_directory(
    i = RBT.log_directory?
  )
  @internal_hash[:extract_to_this_directory] = i
end
extract_to_this_dir?()
extract_to_this_directory?() click to toggle source
#

extract_to_this_directory?

This query-method tells us where we will extract (our archive) to.

The temp-directory should usually be available through RBT.rbt_log_directory?.

#
# File lib/rbt/compile/extract.rb, line 72
def extract_to_this_directory?
  _ = @internal_hash[:extract_to_this_directory]
  if @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
    _ = @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
  end
  _
end
extract_to_which_directory?()
extract_what_to( i = program_path?, extract_to_this_directory = extract_to_this_directory? )
Alias for: invoke_extracter
extract_where_to?()
extracted_base_directory?() click to toggle source
#

extracted_base_directory?

#
# File lib/rbt/compile/extract.rb, line 291
def extracted_base_directory?
  @internal_hash[:extracted_base_directory]
end
extracted_directory?()
feedback_all(i = program?) click to toggle source
#

feedback_all

#
# File lib/rbt/compile/feedback.rb, line 141
def feedback_all(i = program?)
  RBT::Cookbooks::Cookbook.feedback_all(i)
end
feedback_all_available_formats() click to toggle source
#

feedback_all_available_formats

Invocation example:

ry --feedback_all_available_formats
#
# File lib/rbt/compile/show_and_report.rb, line 250
def feedback_all_available_formats
  require 'rbt/cookbooks/class/feedback/feedback_all_available_formats.rb'
  RBT::Cookbooks::Cookbook.feedback_all_available_formats
end
feedback_all_binaries( this_program = program? )
feedback_all_case_options_of_the_main_menu() click to toggle source
#

feedback_all_case_options_of_the_main_menu

#
# File lib/rbt/compile/feedback.rb, line 118
def feedback_all_case_options_of_the_main_menu
  _ = THIS_FILE
  if File.exist? _
    if Object.const_defined? :CaseParser
      _ = CaseParser.parse(_)
      _.each {|entry|
        e entry
      }
    else
      opne 'The project case_parser is not available. Please install it.'
      e
      opne sfancy('  gem install case_parser')
      e
    end
  else # Else the file does not exist.
    opne "No file at #{sfile(_)} could be found. We "\
         "thus can not use CaseParser."
  end
end
feedback_all_libraries( from_this_program = program? ) click to toggle source
#

feedback_all_libraries

Feedback all libraries from a given program.

#
# File lib/rbt/compile/feedback.rb, line 357
def feedback_all_libraries(
    from_this_program = program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_all_libraries(from_this_program)
end
feedback_all_libraries_and_all_binaries( of_this_program = compile_which_program? ) click to toggle source
#

feedback_all_libraries_and_all_binaries

Invoke this by issuing:

ry htop installs_what?
#
# File lib/rbt/compile/feedback.rb, line 345
def feedback_all_libraries_and_all_binaries(
    of_this_program = compile_which_program?
  )
  feedback_all_binaries(of_this_program)
  feedback_all_libraries(of_this_program)
end
feedback_all_registered_binaries_of_all_programs() click to toggle source
#

feedback_all_registered_binaries_of_all_programs

This method will show, on the commandline, all registered binaries of all the programs together.

Invocation example:

rbt --all-binaries
#
# File lib/rbt/compile/feedback.rb, line 502
def feedback_all_registered_binaries_of_all_programs
  _ = RBT.registered_binaries?
  opne 'These '+royalblue(_.size.to_s)+' binaries are registered:'
  e
  _.each_with_index {|this_binary, index| index += 1
    padded_index = (index.to_s+') ').rjust(5)
    e '  '+lightgreen(padded_index)+
           slateblue(this_binary)
  }
  e
end
feedback_configure_options(i = compile_this_program?) click to toggle source
#

feedback_configure_options

To test this method, try something like this:

ry htop configure_options?
ry gcc configure_options?
#
# File lib/rbt/compile/feedback.rb, line 304
def feedback_configure_options(i = compile_this_program?)
  opne 'The configure options for the program '+sfancy(i)+' are:'
  if dataset?.nil?
    ensure_that_we_have_a_dataset(i)
  end
  _ = configure_options?
  e
  e '  '+sfancy(_)
  e
end
feedback_default_values_of_the_internal_hash() click to toggle source
#

feedback_default_values_of_the_internal_hash

Invocation example from the commandline:

ry --feedback-the-default-values-of-the-internal-hash
#
# File lib/rbt/compile/feedback.rb, line 400
def feedback_default_values_of_the_internal_hash
  dataset = return_default_internal_hash
  e
  e "The following #{lightblue(dataset.keys.size.to_s)} entries are known:"
  e
  dataset.each_pair {|key, value|
    if value.nil?
      value = 'nil'
    end
    e "  #{slateblue(key)}: #{lightgreen(value)}"
  }; e
end
feedback_dependencies( i = compile_which_program? )
feedback_dependencies_of_the_program( i = compile_which_program? )
feedback_dependencies_of_this_program( i = compile_which_program? ) click to toggle source
#

feedback_dependencies_of_this_program

Feedback the dependencies of a given program through this method.

Invocation example:

ry pango --feedback_dependencies_of_this_program
#
# File lib/rbt/compile/feedback.rb, line 371
def feedback_dependencies_of_this_program(
    i = compile_which_program?
  )
  if dataset?.nil?
    ensure_proper_dataset(i)
  end
  dependencies = dataset?.deps_on?
  unless dependencies.empty?
    cliner {
      opne 'We did find these dependencies for `'+sfancy(i)+'`:'
      # =================================================================== #
      # We will next assume that dependencies is an Array.
      # =================================================================== #
      dependencies.each {|dep|
        opne '  A dependency on: `'+olivedrab(dep)+'`.'
      }
    }
  else
    opne 'No dependency was found for `'+sfancy(i)+'`.'
  end
end
feedback_description(i = program?)
feedback_extra_description( of_this_program = program? ) click to toggle source
#

feedback_extra_description

To trigger this method, do:

ry php edesc
#
# File lib/rbt/compile/feedback.rb, line 333
def feedback_extra_description(
    of_this_program = program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_extra_description(of_this_program)
end
feedback_last_compiled(i) click to toggle source
#

feedback_last_compiled

There are several ways how to invoke this method. We thus need to be rather flexible about feedbacking this to the user.

One of the first distinctions will be whether we have a '=' token in the input or whether we do not.

Examples:

rbt --last-compiled?
rbt --last-5-compiled?
rbt --last-five-compiled?
rbt --last-compiled?=5
rbt --last-compiled?=6
#
# File lib/rbt/compile/feedback.rb, line 533
def feedback_last_compiled(i)
  i = i.first if i.is_a? Array # Grab the first entry.
  # ======================================================================= #
  # Next, we determine the dataset of which programs have been compiled.
  # ======================================================================= #
  dataset = compiled_programs?
  show_n_programs = 1 # This is the default.
  if i.to_s =~ /^\d+$/
    show_n_programs = i.to_i
  end
  if i and i.to_s.include?('=')
    splitted = i.split('=')
    show_n_programs = splitted.last.to_i
  elsif (show_n_programs > 1)
    # pass through in this case
  else # Else it does not include a '='.
    regex_to_use = /--last(-\d+-)compiled\?/
    i =~ regex_to_use
    show_n_programs = $1.to_s.dup.delete('-').to_i if $1
    array = HASH_ENGLISH_NUMBERS.keys
    if array.any? {|entry| i.include? entry }
      result = array.select {|entry| i.include? entry }
      result = result.first unless result.empty?
      # =================================================================== #
      # Now we must convert this:
      # =================================================================== #
      result = HASH_ENGLISH_NUMBERS[result]
      show_n_programs = result.to_i
    end
  end
  # ======================================================================= #
  # Narrow our dataset down.
  # ======================================================================= #
  if show_n_programs > dataset.size
    opne 'We have not kept track of that many ('+
          sfancy(show_n_programs.to_s)+') registered programs, so we will'
    opne "only show #{dataset.keys.size.to_s} programs instead."
    show_n_programs = dataset.size
  end
  dataset = dataset.reverse[0 .. (show_n_programs - 1)].reverse
  e
  opne "The last #{simp(show_n_programs.to_s)} compiled "\
       "programs (most recent one comes first) were:"
  # ======================================================================= #
  # Now we can report this dataset, which contains our programs.
  # ======================================================================= #
  e; dataset.reverse.each {|key|
    e "  #{sfancy(key)}"
  }; e
end
feedback_licenses( filter_for_licenses = '*' ) click to toggle source
#

feedback_licenses

This will feedback all licenses, or apply a filter.

Usage example:

ry htop flicenses
#
# File lib/rbt/compile/feedback.rb, line 95
def feedback_licenses(
    filter_for_licenses = '*'
  )
  RBT::Cookbooks::FeedbackLicenses.new(filter_for_licenses) # bl $RUBY_COOKBOOKS/lib/cookbooks/feedback_licenses.rb
end
feedback_local_base( i = compile_which_program? ) click to toggle source
#

feedback_local_base

Feedback which local base directory is used for a particular program.

#
# File lib/rbt/compile/feedback.rb, line 487
def feedback_local_base(
    i = compile_which_program?
  )
  RBT::Cookbooks::DisplayCookbookDataset.feedback_local_base(i)
end
feedback_local_location( i = compile_which_program? ) click to toggle source
#

feedback_local_location

Invoke this like:

ry htop feedback_local_location
#
# File lib/rbt/compile/feedback.rb, line 475
def feedback_local_location(
    i = compile_which_program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_local_location(i)
end
feedback_main_config() click to toggle source
#

feedback_main_config

In order to invoke this method, do:

rbt config?
#
# File lib/rbt/compile/feedback.rb, line 195
def feedback_main_config
  opne 'We will show the configuration options set for the '\
       'RBT project next.'
  cliner {
    hash = RBT.configuration?._ # Delegate to the config.
    hash.each_pair {|key, value|
      case key.to_s.strip
      when 'email'
        value = crimson(value.to_s.ljust(10))
      else
        value = slateblue(value.to_s.ljust(10))
      end
      key = lightgoldenrodyellow( ((key.to_s+':').ljust(46)) )
      e '  '+key+' '+value
    }
  }
end
feedback_main_config_then_exit() click to toggle source
#

feedback_main_config_then_exit

#
# File lib/rbt/compile/feedback.rb, line 216
def feedback_main_config_then_exit
  feedback_main_config
  exit_program
end
feedback_make_options( i = compile_which_program? ) click to toggle source
#

feedback_make_options

To trigger this method, do e. g.:

ry ruby make_opts
ry binutils make_opts
#
# File lib/rbt/compile/feedback.rb, line 53
def feedback_make_options(
    i = compile_which_program?
  )
  _ = cookbook_dataset_make_options?
  _ = _.first if _.is_a? Array
  e
  e royalblue(_)
  e
end
feedback_prefix_in_use( shall_we_exit = true )
feedback_prefix_in_use?( shall_we_exit = true ) click to toggle source
#

feedback_prefix_in_use?

Use this method to feedback which prefix is in use.

Usage examples:

ry allegro --prefix?
ry openmpi --prefix?
ry htop    prefix?
#
# File lib/rbt/compile/feedback.rb, line 423
def feedback_prefix_in_use?(
    shall_we_exit = true
  )
  program_name = compile_which_program?.dup
  if cookbook_dataset?.nil?
    ensure_proper_dataset_for(program_name)
  end
  e "The prefix in use for #{lightgreen(program_name)} will be:"
  e "  #{sfancy(prefix?)}"
  exit_program if shall_we_exit
end
Also aliased as: feedback_prefix_in_use
feedback_program_description(i = program?) click to toggle source
#

feedback_program_description

We feedback the description here, by tapping into the method feedback_description() from class Cookbooks.

#
# File lib/rbt/compile/feedback.rb, line 321
def feedback_program_description(i = program?)
  e
  RBT.feedback_description_of(i)
  e
end
Also aliased as: feedback_description
feedback_program_version() click to toggle source
#

feedback_program_version

#
# File lib/rbt/compile/feedback.rb, line 104
def feedback_program_version
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_program_version(program?)
end
feedback_programs_dir() click to toggle source
#

feedback_programs_dir

#
# File lib/rbt/compile/feedback.rb, line 111
def feedback_programs_dir
  opne 'The programs directory is at '+sfile(programs_dir?)
end
feedback_rbt_version( ljust = 35, use_opn = true ) click to toggle source
#

feedback_rbt_version

#
# File lib/rbt/compile/feedback.rb, line 179
def feedback_rbt_version(
    ljust = 35, use_opn = true
  )
  opnn if use_opn
  e sfancy('RBT Version: '.ljust(ljust))+
    simp(RBT.version?)
end
feedback_sanitize_dataset_version( ljust = 35, use_opn = true ) click to toggle source
#

feedback_sanitize_dataset_version

#
# File lib/rbt/compile/feedback.rb, line 168
def feedback_sanitize_dataset_version(
    ljust = 35, use_opn = true
  )
  opnn if use_opn
  e sfancy('RBT::Cookbooks::Cookbook version: '.ljust(ljust))+
    simp(RBT.version?)
end
feedback_url(i = compile_which_program?) click to toggle source
#

feedback_url

Wrapper around Cookbooks functionality.

Usage example:

rbt htop url?
#
# File lib/rbt/compile/feedback.rb, line 455
def feedback_url(i = compile_which_program?)
  RBT::Cookbooks::Url.new(i)
  # ======================================================================= #
  # The next line of code has been commented out at 21.09.2018:
  # ======================================================================= #
  # ::RBT::Cookbooks::DisplayCookbookDataset.feedback_url.feedback_url(compile_which_program?)
  # ======================================================================= #
  # The next part may be controversial, as it sets the xorg buffer.
  # As of May 2014 I have disabled it.
  # ======================================================================= #
  #   result = @cookbooks.feedback_url
  #   set_xorg_buffer(result)
end
feedback_various_versions( optional_use_opn = true, ljust = 45 ) click to toggle source
#

feedback_various_versions

This actually will only feedback the RBT version in use, since we have merged the different projects together in September 2018.

To invoke this method, do:

ry htop feedback_version
#
# File lib/rbt/compile/feedback.rb, line 154
def feedback_various_versions(
    optional_use_opn = true,
    ljust            = 45
  )
  case optional_use_opn
  when :do_not_use_opn
    optional_use_opn = false
  end
  feedback_rbt_version(ljust, optional_use_opn)
end
feedback_what_we_are_currently_compiling?() click to toggle source
#

feedback_what_we_are_currently_compiling?

This method will feedback what we are currently compiling.

To invoke this method, do:

ry --what-are-we-currently-compiling?
#
# File lib/rbt/compile/feedback.rb, line 229
def feedback_what_we_are_currently_compiling?
  status_file = FILE_STATUS
  if File.exist? status_file
    dataset = YAML.load_file(status_file)
  end
  this_key = 'currently_compiling_these_programs'
  if dataset.has_key?(this_key) and
     !dataset[this_key].empty? # This should work because it is an Array.
    these_programs_are_currently_compiled = dataset[this_key]
    opne 'The following programs are currently compiled:'
    e
    these_programs_are_currently_compiled.each {|this_program|
      e "  #{sfancy(this_program)}"
    }; e
  else
    opne 'No program is being currently compiled.'
  end
end
feedback_whether_the_cookbook_will_modify_env_variables() click to toggle source
#

feedback_whether_the_cookbook_will_modify_env_variables

#
# File lib/rbt/compile/feedback.rb, line 284
def feedback_whether_the_cookbook_will_modify_env_variables
  _ = set_env_variables?
  if _.nil?
    opne 'The program '+sfancy(program_name?)+' does not '\
         'set any ENV variable.'
  else
    opne 'The program '+sfancy(program_name?)+' will modify '\
         'at the least one ENV variable.'
    opne 'Displaying these next:'
    set_these_env_variables(_, :report_only)
  end
end
feedback_whether_we_will_strip_or_whether_we_will_not() click to toggle source
#

feedback_whether_we_will_strip_or_whether_we_will_not

Feedback whether we will run the “strip” binary or whether we will not.

Invocation example:

ry --strip?
#
# File lib/rbt/compile/feedback.rb, line 30
def feedback_whether_we_will_strip_or_whether_we_will_not
  _ = strip_binaries?
  case _
  when true
    opne 'Yes, we will run "'+slateblue('strip')+'" on the resulting '\
         'binaries of'
    opne 'the given program at hand.'
  when false
    opne 'No, we will '+swarn('NOT')+' run "strip" on the '\
         'resulting binaries of'
    opne 'the given program at hand.'
  end
end
feedback_whether_we_will_use_stow() click to toggle source
#

feedback_whether_we_will_use_stow

To invoke this, do:

ry --use-stow?
#
# File lib/rbt/compile/feedback.rb, line 443
def feedback_whether_we_will_use_stow
  opne "Will we use stow? #{royalblue(verbose_truth(use_stow?))}"
end
find_all_archive_types() click to toggle source
#

find_all_archive_types

#
# File lib/rbt/compile/misc.rb, line 2666
def find_all_archive_types
  RBT::Cookbooks::FindAllArchiveTypes.new.show_results
end
find_all_keys_starting_with( i ) click to toggle source
#

find_all_keys_starting_with

This method will find all keys starting with a specific character.

Currently we will always exist when we use this method, so returning something is not hugely important.

#
# File lib/rbt/compile/misc.rb, line 2560
def find_all_keys_starting_with(
    i
  )
  i.delete!('*') # Get rid of '*' since we no longer need it past this point.
  all_matches = all_programs?.select {|key| key =~ /^#{i}/ } 
  e all_matches.sort.join(', ').split(N).map {|entry| '  '+entry }.join(N)
  e
  opne 'Found a total of '+
       royalblue(all_matches.size.to_s)+
       ' matches.'
  return all_matches
end
first_arg()
fix_libtool_la_file_from_saved_file() click to toggle source
#

fix_libtool_la_file_from_saved_file

#
# File lib/rbt/compile/libtool.rb, line 57
def fix_libtool_la_file_from_saved_file
  RBT.fix_libtool_la_file_from_saved_file
end
full_configure_command?() click to toggle source
#

full_configure_command?

The @full_configure_command contains the full configure command that we will use. The advantage in using this is that we can easily copy/paste this at a later time, should we need to do so.

#
# File lib/rbt/compile/misc.rb, line 538
def full_configure_command?
  @internal_hash[:full_configure_command]
end
full_path?()
generate_all_gobolinux_recipes() click to toggle source
#

generate_all_gobolinux_recipes

This method can be used to auto-generate all GoboLinux recipes.

Invocation example:

ry --generate-all-gobolinux-recipes
#
# File lib/rbt/compile/gobolinux.rb, line 126
  def generate_all_gobolinux_recipes
    # ======================================================================= #
    # Must first change into an appropriate directory.
    # ======================================================================= #
    target_dir = "#{rbt_log_directory?}gobolinux/"
    if File.directory? target_dir
      # ===================================================================== #
      # Always remove the old directory should it exist.
      # ===================================================================== #
      remove_directory(target_dir)
    end
    mkdir(target_dir)
    if File.directory? target_dir
      opnn; cd target_dir, :be_verbose
      # ===================================================================== #
      # Next, create the subdirectories but be silent about it.
      # ===================================================================== #
      array = ('a'..'z').to_a
      # ===================================================================== #
      # Add two exceptions.
      # ===================================================================== #
      array[0,0] = '3'
      array[0,0] = '0'
      array.each {|entry| mkdir(entry, :be_quiet) }
    else
      opnn; e "The target directory `#{sdir(target_dir)}` does not exist."
      opnn; e 'Please create it before we can create GoboLinux recipes.'
      return
    end
    available_programs?.each {|this_program|
      opnn; e 'Now generating a GoboLinux recipe for '\
              'the program `'+sfancy(this_program)+'`.'
      create_gobolinux_recipe_for(this_program)
    }
    # ======================================================================= #
    # Now that we have generated all these recipes, let's create a tarball
    # of the directory.
    # ======================================================================= #
    cd rbt_log_directory?, :be_quiet
    begin
      require 'totarxz'
      gobolinux_recipes_archive = "gobolinux-recipes-#{return_current_date}"
      mv 'gobolinux', gobolinux_recipes_archive
      ToTarXz.new(gobolinux_recipes_archive)
      target_archive = "#{gobolinux_recipes_archive.dup}.tar.xz"
      if File.exist? target_archive
        opnn; e "Everything has been packaged up into `"\
                "#{sfancy(target_archive)}` (cwd: #{sdir_return_pwd})."
        # =================================================================== #
        # Rename the directory again.
        # =================================================================== #
        opnn; mv gobolinux_recipes_archive, 'gobolinux'
        # =================================================================== #
        # FTP upload if we are on Roebe.
        # =================================================================== #
        if is_on_roebe?
          require 'ftp_paradise'
          if File.exist? target_archive
            FtpParadise.upload_this_binary_file(target_archive)
          else
            opnn; e 'Can not upload the file '+sfile(target_archive)
            opnn; e 'as it does not exist.' 
          end
          # ================================================================= #
          # Next, connect and upload all the individual directories to
          # my remote FTP host.
          # ================================================================= #
        end
        # =================================================================== #
        # Next, upload the individual directories to the remote FTP host.
        # Unfortunately this has a problem so we have disabled this for now.
        # =================================================================== #

# =========================================================================== #
# DISABLED FOR NOW. MUST BE FIXED ONE DAY.
# =========================================================================== #
if false
        _ = FtpParadise.new(:shevy)
        _.remote_mkdir 'gobolinux'
        _.remote_cd    'gobolinux'
        opnn; cd 'gobolinux', :be_verbose
        array.each {|this_directory|
          _.remote_mkdir(this_directory)
          _.rcd(this_directory)
          # ================================================================= #
          # Ok, we can obtain the local directories and then upload them
          # all.
          # ================================================================= #
          local_target = this_directory+'/*'
          all_local_directories = Dir[local_target].select {|entry|
            File.directory? entry
          }
          if all_local_directories.empty?
            opnn; e 'Nothing found under '+sfancy(local_target)+'.'
          else
            all_local_directories.each {|this_entry|
              opnn; e 'Now uploading the directory `'+sdir(this_entry)+'`.'
              _.upload_this_directory(this_entry)
            }
          end
          _.rcd '..' # Return to the base directory again.
        }
end # end false clause (DEBUG - FIXME!!!)
      end
    rescue LoadError
      opnn; e 'Please install the gem totarxz, in order to create '\
              'a '+sorange('.tar.xz')+' archive.'
    end
  end
generate_global_yaml_database() click to toggle source
#

generate_global_yaml_database

#
# File lib/rbt/compile/misc.rb, line 2046
def generate_global_yaml_database
  RBT.generate_global_yaml_database
end
generate_gobolinux_recipe(i = compile_which_program?) click to toggle source
#

generate_gobolinux_recipe

This will delegate towards Cookbooks and generate gobolinux recipe for the given program.

Invocation example:

ry zenity --gobolinux-recipe
#
# File lib/rbt/compile/gobolinux.rb, line 397
def generate_gobolinux_recipe(i = compile_which_program?)
  RBT.create_gobolinux_recipe(i) { :store_in_alphanumeric_subdirectory }
end
Also aliased as: create_gobolinux_recipe_for
generate_homepage() click to toggle source
#

generate_homepage

Generate a LFS-like homepage, which is part of the Cookbooks project.

#
# File lib/rbt/compile/misc.rb, line 2926
def generate_homepage
  require 'rbt/utility_scripts/generate_homepage/generate_homepage.rb'
  RBT::Cookbooks::GenerateHomepage[]
end
generate_machomebrew_formula( i = compile_which_program? ) click to toggle source
#

generate_machomebrew_formula

#
# File lib/rbt/compile/misc.rb, line 3002
def generate_machomebrew_formula(
    i = compile_which_program?
  )
  RBT::GenerateMachomebrewFormula.new(i)
end
generate_new_cookbook( shall_we_exit = true ) click to toggle source
#

generate_new_cookbook

This method can be used to generate a new cookbook file. It is no longer that useful, but retained mostly for legacy reasons.

To generate a new cookbook, do:

ry htop ---generate_new_cookbook
#
# File lib/rbt/compile/misc.rb, line 2733
def generate_new_cookbook(
    shall_we_exit = true
  )
  opne 'Will generate a new cookbook file, as instructed.'
  RBT::Cookbooks::CreateNewCookbook.new # bl $RUBY_COOKBOOKS/new_cook*
  exit_program if shall_we_exit
end
generate_shell_completion( for_this_shell = :all ) click to toggle source
#

generate_shell_completion

Generates shell completion code. Right now it will only work for Bash.

Invocation example:

ry --generate_shell_completion
#
# File lib/rbt/compile/shell.rb, line 25
def generate_shell_completion(
    for_this_shell = :all
  )
  RBT::GenerateShellCompletion.new(
    for_this_shell
  ) # bl GenerateShellCompletion
end
generate_slack_desc_file_for_this_program( i = compile_which_program? ) click to toggle source
#

generate_slack_desc_file_for_this_program

Trigger like so:

rbt htop --gsc
#
# File lib/rbt/compile/misc.rb, line 1489
def generate_slack_desc_file_for_this_program(
    i = compile_which_program?
  )
  path_to_this_file = RBT.generate_slackware_description_file(i)
  return path_to_this_file
end
generate_slack_desc_files_for_every_program() click to toggle source
#

generate_slack_desc_files_for_every_program

#
# File lib/rbt/compile/misc.rb, line 3078
def generate_slack_desc_files_for_every_program
  target = "#{rbt_log_directory?}slackware_desc_files/"
  opnn; mkdir target, :be_verbose
  cd target
  all_programs?.each {|entry|
    generate_slack_desc_file_for_this_program(entry)
  }
end
get_packages( this_program = compile_which_program? ) click to toggle source
#

get_packages

Get all packages from the directory /Depot/Packages and compare them to our given request.

I am no longer making heavy use of Packages but perhaps one day I may extend it, so this is one reason why it is kept.

Invoke it like so:

ry php pgk?
#
# File lib/rbt/compile/misc.rb, line 2273
def get_packages(
    this_program = compile_which_program?
  )
  this_program = this_program.first if this_program.is_a? Array
  packages_dir = packages_directory? # This constant is defined in Configuration.rb
  opnn
  e "Searching packages for `#{simp(this_program)}` matches now inside "+
    sdir(packages_dir)+'.'
  _ = get_files_from(packages_dir, true)
  if _
    result = _.grep(/#{this_program}/i)
    pp result
    return result
  else
    opnn
    e "Unfortunately we did not find any match in `#{sdir(packages_dir)}`."
  end
end
guess_build_type() click to toggle source
#

guess_build_type

#
# File lib/rbt/compile/misc.rb, line 1684
def guess_build_type
  RBT.build_type?
end
Also aliased as: do_guess_the_build_type
had_to_be_compiled?()
has_a_problem_occurred?() click to toggle source
#

has_a_problem_occurred?

Query-method over as to whether a problem has occurred or whether it has not.

#
# File lib/rbt/compile/problems_and_errors.rb, line 404
def has_a_problem_occurred?
  problem?
end
Also aliased as: a_problem_has_occurred?
has_an_error_occurred?()
has_been_installed_successfully?()
has_been_successfully_compiled?()
has_linux_makefile?(i = 'Makefile.linux') click to toggle source
#

has_linux_makefile?

Return true if we find a linux-specific Makefile.

#
# File lib/rbt/compile/make.rb, line 258
def has_linux_makefile?(i = 'Makefile.linux')
  File.exist?(i)
end
has_makefile?(i = 'Makefile') click to toggle source
#

has_makefile?

Query whether we have a file called Makefile in the current working directory.

#
# File lib/rbt/compile/make.rb, line 249
def has_makefile?(i = 'Makefile') 
  File.exist?(i)
end
has_the_program_been_installed_successfully?() click to toggle source
#

has_the_program_been_installed_successfully?

#
# File lib/rbt/compile/problems_and_errors.rb, line 421
def has_the_program_been_installed_successfully?
  @internal_hash[:has_the_program_been_installed_successfully]
end
has_to_be_compiled?()
headers?()
honour_check_to_ensure_that_the_program_exists?() click to toggle source
#

honour_check_to_ensure_that_the_program_exists?

#
# File lib/rbt/compile/misc.rb, line 2335
def honour_check_to_ensure_that_the_program_exists?
  @internal_hash[:honour_check_to_ensure_that_the_program_exists] # This is true by default.
end
ihash()
Alias for: internal_hash?
ihash?() click to toggle source
#

ihash

#
# File lib/rbt/compile/compile.rb, line 161
def ihash?
  @internal_hash
end
increment_compiled_counter( by_plus_n = 1 )
increment_compiled_this_program_n_times_counter( by_plus_n = 1 ) click to toggle source
#

increment_compiled_this_program_n_times_counter

By default this method will increment by +1.

#
# File lib/rbt/compile/misc.rb, line 1882
def increment_compiled_this_program_n_times_counter(
    by_plus_n = 1
  )
  @internal_hash[:we_tried_to_compile_this_program_n_times] += by_plus_n
end
Also aliased as: increment_compiled_counter
initialize_cookbook_dataset( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
initialize_cookbook_dataset_for( this_program = @internal_hash[:compile_this_program], optional_arguments = nil ) click to toggle source
#

initialize_cookbook_dataset_for

This method is different to load_yaml_dataset_for_this_program() in that we will also assign to the main internal Hash.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 73
def initialize_cookbook_dataset_for(
    this_program       = @internal_hash[:compile_this_program],
    optional_arguments = nil
  )
  this_program = this_program.to_s.dup # We need a String.
  if this_program.include? '_'
    this_program.delete!('_') # <- Is already unfrozen by default.
  end
  yaml_dataset = load_yaml_dataset_for_this_program(
    this_program, optional_arguments
  )
  # ======================================================================= #
  # Next, assign to the internal Hash:
  # ======================================================================= #
  assign_to_the_main_dataset(
    yaml_dataset
  )
end
initialize_dataset( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
initialize_dataset_for( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
initialize_dataset_for_this_program( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
initialize_default_values() click to toggle source
#

initialize_default_values

We need some default values, which are set here.

#
# File lib/rbt/compile/reset.rb, line 43
def initialize_default_values
  @internal_hash[:compile_this_program] = nil
  set_program_path(nil)
  @program_name_and_program_version = nil
  # ======================================================================= #
  # Instantiate a new RBT::Make object next, as our wrapper to 'make'.
  # ======================================================================= #
  @make = RBT::Make.new
  # ======================================================================= #
  # We ought to populate our internal Hash with some default values.
  # ======================================================================= #
  populate_internal_hash_with_default_values
  extract_to_default_directory
end
initialize_yaml_dataset( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
input?()
Alias for: original_input?
install_only_headers?() click to toggle source
#

install_only_headers?

#
# File lib/rbt/compile/headers.rb, line 17
def install_only_headers?
  @internal_hash[:install_only_the_headers]
end
Also aliased as: install_only_the_headers?
install_only_the_headers?()
install_palemoon( path = '/Users/x/SRC/palemoon/palemoon-'\ '28.5.2-64bit.tar.xz' ) click to toggle source
#

install_palemoon

To invoke this ad-hoc method, try:

rbt --install-palemoon
#
# File lib/rbt/compile/misc.rb, line 197
def install_palemoon(
    path = '/Users/x/SRC/palemoon/palemoon-'\
           '28.5.2-64bit.tar.xz'
  )
  if File.exist? path
    _ = remove_archive_from_the_end(
      File.basename(path)
    ).sub(/-64bit$/, '')
    program_name    = ProgramInformation.return_name(_)
    program_version = ProgramInformation.return_version(_)
    target = program_dir?+program_name.capitalize+'/'+program_version+'/'
    create_app_skeleton(target)
    cd target
    extract_to = target
    extract_what_to(path, extract_to)
    e 'Done!'
  else
    opnn; no_file_at(path)
  end
end
install_ruby_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? ) click to toggle source
#

install_ruby_gem (install gem, gem install, gem tag)

Use this method to install a ruby gem, then exit.

The input argument should be the path towards the .gem file in question.

Right now we will always exit when we use this method, by default. This behaviour can be changed through the variable 'shall_we_exit'.

Invocation example:

ry /Users/x/SRC/ruby/gems/wirble-0.1.3.gem
ry $MY_SRC/ruby/gems/unf-0.0.5.gem
ry thor
#
# File lib/rbt/compile/ruby.rb, line 135
def install_ruby_gem(
    this_gem      = program_path?,
    shall_we_exit = exit_after_a_rubygem_has_been_installed?
  )
  do_not_display_the_infobox
  do_not_symlink :be_quiet
  case this_gem
  when :default
    this_gem = program_path?
  end
  case shall_we_exit
  when :then_exit, :do_exit
    shall_we_exit = true
  when :do_not_exit
    shall_we_exit = false
  end
  # ======================================================================= #
  # === Download the gem
  #
  # If the path to a gem includes a "http" string, then we will assume
  # that we will first have to download it.
  # ======================================================================= #
  if this_gem and this_gem.include? 'http'
    go_to_base_dir
    do_download(this_gem)
  end
  # ======================================================================= #
  # Next, install the gem via a system() call. There are several ways
  # how to install a gem through, most importantly, with or without
  # dependency management by gem.
  # ======================================================================= #
  _ = ("gem install #{return_gem_install_options} #{this_gem}").squeeze(' ')
  opnn; e _
  system _
  exit_program if shall_we_exit
end
install_the_dependencies_of_this_program( this_program = compile_which_program? ) click to toggle source
#

install_the_dependencies_of_this_program

Invocation example:

ry rails --install-its-dependencies
#
# File lib/rbt/compile/misc.rb, line 2882
def install_the_dependencies_of_this_program(
    this_program = compile_which_program?
  )
  dependencies = required_deps_on?
  e
  opne 'Next, installing the '+orange(dependencies.size.to_s)+
       ' dependencies of the program `'+
        sfancy(this_program)+'`.'
  e
  opne 'These programs are:'
  e
  dependencies.each {|this_entry|
    e slateblue('  '+this_entry)
  }
  e
  dependencies.each {|this_entry|
    install_that_program = true
    # ===================================================================== #
    # Consider skipping a few.
    # ===================================================================== #
    case this_entry
    when 'ruby'
      target = "#{programs_directory?}Ruby/Current/bin/ruby"
      if File.exist? target
        install_that_program = false
        e 'Skipping ruby as it is already installed at '+sfancy(target)+'.'
      end
    end
    if install_that_program
      # =================================================================== #
      # We ought to not quit after a rubygem has been installed.
      # =================================================================== #
      _ = RBT::Compile.new(this_entry, :do_not_run_yet)
      _.do_not_exit_after_a_rubygem_has_been_installed
      _.run
    end
  }
end
install_this_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? )
Alias for: install_ruby_gem
install_this_ruby_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? )
Alias for: install_ruby_gem
installation_steps?()
installation_was_successful?()
instantiate_a_new_cookbook(i)
instantiate_a_new_cookbook_for( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
instantiate_a_new_cookbook_instance(i)
instantiate_a_new_cookbook_instance_for_this_program(i) click to toggle source
#

instantiate_a_new_cookbook_instance_for_this_program

Since as of January 2018, whenever you need an instance from class RBT::Cookbooks::Cookbook, this method here should be used.

The reason is simple:

  • This method will do all the required invocations needed to properly instantiate a new Cookbook instance.

#
# File lib/rbt/compile/misc.rb, line 381
def instantiate_a_new_cookbook_instance_for_this_program(i)
  # ======================================================================= #
  # Next, instantiate a new Cookbooks::Cookbook instance.
  # ======================================================================= #
  RBT::Cookbooks::Cookbook.new(i) {{
    use_menu_interface: :bypass_menu_check,
    make_use_of_aliases_kept_in_the_file_cookbook_aliases: make_use_of_cookbook_aliases?
  }}
end
internal_configure_options?() click to toggle source
#

internal_configure_options?

#
# File lib/rbt/compile/configure.rb, line 286
def internal_configure_options?
  @internal_hash[:configure_options]
end
internal_hash()
Alias for: internal_hash?
internal_hash?() click to toggle source
#

internal_hash?

#
# File lib/rbt/compile/obtain.rb, line 57
def internal_hash?
  @internal_hash
end
Also aliased as: ihash?, ihash, internal_hash, return_default_internal_hash
internal_hash_build_static?() click to toggle source
#

internal_hash_build_static?

#
# File lib/rbt/compile/static.rb, line 57
def internal_hash_build_static?
  @internal_hash[:build_static]
end
internal_program_name?()
invoke_extracter( i = program_path?, extract_to_this_directory = extract_to_this_directory? ) click to toggle source
#

invoke_extracter

Delegate towards class Extracter next.

#
# File lib/rbt/compile/extract.rb, line 409
def invoke_extracter(
    i                         = program_path?,
    extract_to_this_directory = extract_to_this_directory?
  )
  unless skip_extracting?
    # ===================================================================== #
    # Remove the extracted directory if it exists next. This will,
    # however had, NOT be done if we extract to another target
    # directory, such as when issuing a command like
    # "ry htop --extract-to=/opt/test".
    # ===================================================================== #
    # possibly_existing_old_extracted_archive = cookbooks_dataset_extracted_towards?
    # unless possibly_existing_old_extracted_archive.include? extract_to?
      # =================================================================== #
      # In this case we reasonably assume that the user has NOT given
      # a --extract-to value.
      # =================================================================== #
      if cookbooks_dataset?
        _ = cookbooks_dataset_extracted_towards?.dup
        if File.directory?(_)
          opnn; e 'Removing the old directory at `'+
                  sdir(_)+'`.'
          remove_directory(_)
        end
      end
    # end
    # ===================================================================== #
    # Delegate towards class Extracter next.
    # ===================================================================== #
    Extracter.extract_this(
      i,
      to:                      extract_to_this_directory,
      prepend_this_namespace:  'RBT->',
      use_colours:             use_colours?,
      verbosity:               :be_verbose,
      run_simulation:          run_simulation?,
      pad_opn_with_n_tokens:   RBT.n_padding_to_use_for_opn?,
      use_opn:                 show_the_classname?
    )
  end
end
Also aliased as: extract_what_to
is_a_gem?( i = program_path? )
Alias for: is_a_gem_file?
is_a_gem_file?( i = program_path? ) click to toggle source
#

is_a_gem_file?

Query whether we have a .gem file at hand here.

#
# File lib/rbt/compile/ruby.rb, line 48
def is_a_gem_file?(
    i = program_path?
  )
  i.to_s.end_with? '.gem'
end
Also aliased as: is_a_gem?
is_a_kde_program?() click to toggle source
#

is_a_kde_program?

We assume that every program that has the “kde” tag associated, is a KDE program. Thus this method will return true.

#
# File lib/rbt/compile/kde.rb, line 199
def is_a_kde_program?
  tags.include? 'kde'
end
is_an_abbreviation?() click to toggle source
#

is_an_abbreviation?

#
# File lib/rbt/compile/misc.rb, line 2161
def is_an_abbreviation?
  @internal_hash[:is_an_abbreviation]
end
is_an_appdir_prefix?( i = prefix?.to_s )
is_appdir_prefix?( use_this_prefix = programs_dir? ) click to toggle source
#

is_appdir_prefix?

This method will return true if we use an AppDir prefix, such as one that includes the programs directory (e. g. the string “/Programs/”, and false otherwise.

#
# File lib/rbt/compile/prefix.rb, line 232
def is_appdir_prefix?(
    use_this_prefix = programs_dir?
  )
  prefix?.include?(use_this_prefix)
end
is_cmake_available?()
Alias for: cmake_exists?
is_compiled?()
is_make_available?() click to toggle source
#

is_make_available?

This method will attempt to find out whether make is available. It will do so by checking on the path.

#
# File lib/rbt/compile/make.rb, line 268
def is_make_available?
  is_make_available = false
  path = query_path?
  if path.include? ':'
    check_these_directories = path.split(':')
    check_these_directories.each {|dir|
      if File.exist?(dir+'/make')
        is_make_available = true # Yup, make is available.
      end
    }
  end
  return is_make_available
end
is_meson_build_type?() click to toggle source
#

is_meson_build_type?

This method will return true if we can use meson in the current directory; and false otherwise.

#
# File lib/rbt/compile/meson_and_ninja.rb, line 73
def is_meson_build_type?
  RBT.build_type? == :meson
end
Also aliased as: uses_meson?
is_on_32_bit_system?() click to toggle source
#

is_on_32_bit_system?

#
# File lib/rbt/compile/misc.rb, line 2757
def is_on_32_bit_system?
  TARGET_CPU == 'i686'
end
is_on_gobolinux()
is_on_gobolinux?() click to toggle source
#

is_on_gobolinux?

Query whether we are on GoboLinux or whether we are not.

In the past this was only a check for an environment variable.

Since we will allow commandline options to change this, we also had to use a proper variable to keep track of this.

#
# File lib/rbt/compile/gobolinux.rb, line 60
def is_on_gobolinux?
  @internal_hash[:is_on_gobolinux]
end
is_on_slackware?() click to toggle source
#

is_on_slackware?

This method will return true if we are using slackware; and false otherwise.

#
# File lib/rbt/compile/misc.rb, line 1509
def is_on_slackware?
  RBT.configuration?.operating_system == 'slackware'
end
is_registered?(i) click to toggle source
#

is_registered?

Determine whether a given program is registered or whether it is not.

#
# File lib/rbt/compile/register.rb, line 114
def is_registered?(i)
  return RBT.is_available? i
end
is_superuser?() click to toggle source
#

is_superuser?

#
# File lib/rbt/compile/compile.rb, line 168
def is_superuser?
  Process.uid == 0
end
is_this_a_registered_binary_name?(i) click to toggle source
#

is_this_a_registered_binary_name?

#
# File lib/rbt/compile/misc.rb, line 1916
def is_this_a_registered_binary_name?(i)
  ::RBT.has_this_binary?(i)
end
is_this_input_an_appdir_prefix?( i = prefix?.to_s ) click to toggle source
#

is_this_input_an_appdir_prefix?

This method will return true if the given input is an AppDir-prefix; and false otherwise.

#
# File lib/rbt/compile/prefix.rb, line 87
def is_this_input_an_appdir_prefix?(
    i = prefix?.to_s
  )
  if i and !i.is_a?(Symbol)
    i.to_s.include?(programs_directory?) and (i.to_s =~ /\d+/) # And "has a number".
  else
    false
  end
end
Also aliased as: is_an_appdir_prefix?
is_this_program_included?( i, be_verbose = :default ) click to toggle source
#

is_this_program_included?

#
# File lib/rbt/compile/misc.rb, line 965
def is_this_program_included?(
    i, be_verbose = :default
  )
  RBT::Compile.is_this_program_included?(i, be_verbose)
end
keep_extracted?()
keep_extracted_archive?()
keep_the_extracted_archive?() click to toggle source
#

keep_the_extracted_archive?

This is a query method towards a setting kept in the internal Hash variable.

A boolean value will be returned. This boolean value determines whether the archive will be kept after it was extracted, or whether it will be removed again after it was extracted.

#
# File lib/rbt/compile/extract.rb, line 243
def keep_the_extracted_archive?
  _ = cookbook_dataset_keep_extracted? # <- The default.
  unless @internal_hash[:keep_the_extracted_archive].nil?
    _ = @internal_hash[:keep_the_extracted_archive]
  end
  _
end
last_compiled_program?()
last_error_line?() click to toggle source
#

last_error_line?

#
# File lib/rbt/compile/misc.rb, line 3194
def last_error_line?
  sys_command_string?.last
end
last_system_command_was_a_success?() click to toggle source
#

last_system_command_was_a_success?

#
# File lib/rbt/compile/system.rb, line 134
def last_system_command_was_a_success?
  $CHILD_STATUS.success?
end
libraries?()
linux_from_scratch() click to toggle source
#

linux_from_scratch (lfs tag)

We simply delegate this task to the class LFS.

#
# File lib/rbt/compile/misc.rb, line 261
def linux_from_scratch
  RBT::LFS.new
end
load_data_from_this_gobolinux_recipe(i) click to toggle source
#

load_data_from_this_gobolinux_recipe

This method will allow us to load the dataset from a local GoboLinux recipe, as a drop-in replacement.

The most important setting there will be to use:

url="http://ftp.gnome.org/pub/gnome/sources/GConf/3.2/GConf-3.2.6.tar.xz"

which is part of the file called “Recipe”.

The other settings are also useful but not as important.

#
# File lib/rbt/compile/gobolinux.rb, line 270
def load_data_from_this_gobolinux_recipe(i)
  i = i.to_s.dup # Always work on a new String-copy anyway.
  case i
  when 'Dir.pwd'
    i = return_pwd
  end
  # ======================================================================= #
  # === Handle GoboLinux Recipes past that point
  # ======================================================================= #
  if i.include? '/'
    the_program_is_included # Enable the fact that the program is "included":
    # ===================================================================== #
    # Assume the input to be something like '/Depot/jjjjj/GConf/3.2.6-r3/'.
    # ===================================================================== #
    if i.count('/') > 1 # At the least two '/'.
      splitted = i.split('/')
      program_name = splitted[-2]
      program_version = splitted[-1]
      set_program_name(program_name)
      initialize_yaml_dataset(program_name, :bypass_check)
      set_program_version(program_version)
      chop_off_revision_number
      set_base_dir(i)
      # =================================================================== #
      # The position of the Description file.
      # =================================================================== #
      description_file = 'Resources/Description'
      dataset_from_the_description_file = nil
      assume_default_archive_type
      # =================================================================== #
      # Next, read in the information from the file 'Recipe'.
      # =================================================================== #
      this_file = 'Recipe'
      if File.exist? this_file
        recipe_dataset = File.read(this_file)
        use_this_regex = /^url="(.+)"/
        use_this_url = recipe_dataset.scan(use_this_regex).flatten.first
        set_url(use_this_url)
        set_this_archive(File.basename(use_this_url))
      else
        opnn; e 'Something appears to be incorrect - no file '\
                'called '+sfile(this_file)+' could be found.'
        exit_program
      end
      if File.exist? description_file
        dataset_from_the_description_file = File.read(description_file)
        # ================================================================= #
        # Next, use some regexes to properly interprete the dataset.
        # ================================================================= #
        regex_for_url1              = /\[Homepage\] (.+)/
        regex_for_license           = /\[License\] (.+)/
        regex_for_description       = /\[Description\] (.+)/
        regex_for_short_description = /\[Summary\] (.+)/
        _regex_for_name             = /\[Name\] (.+)/
        # ================================================================= #
        # Next determine some values here.
        # ================================================================= #
        dataset_from_the_description_file =~ regex_for_url1
        set_url2($1.to_s.dup) # Here we change the "homepage" URL.
        dataset_from_the_description_file =~ regex_for_license
        set_license($1.to_s.dup)
        dataset_from_the_description_file =~ regex_for_description
        set_description($1.to_s.dup)
        dataset_from_the_description_file =~ regex_for_short_description
        set_short_desc($1.to_s.dup)
        set_short_name(program_name)
        set_real_short_name(program_name)
        # ================================================================= #
        # The following code is probably no longer needed, but we can
        # keep it for now - maybe one day we have to use it.
        #   dataset_from_the_description_file =~ regex_for_name
        #   this_program = $1.to_s.dup.downcase
        #   set_this_program(this_program)
        # ================================================================= #
        attach_program_name_and_program_version
        determine_program_full_name # This is like: 'gnome-mahjonng-5.08.tar.xz'
        assemble_program_path
        unless File.exist?(File.basename(program_full_name?))
          e 'As the program does not exist locally, we will download it from:'
          e
          e '  '+sfancy(url?.to_s)
          e
          download_this_remote_program(url1)
        end
        # ================================================================= #
        # Now we assume that the program must exist locally.
        # ================================================================= #
        opnn; e 'The following information is known about this program:'
        cliner
        e main_eight? # Show some more information.
        cliner
        target = File.basename(program_full_name?)
        extract_this_archive(target, return_pwd)
        new_target = dataset_program_name?
        opnn; cd new_target, :be_verbose
        do_use_appdir_prefix(:be_quiet)
        use_default_configure_command
        # ================================================================= #
        # Determine the configure options.
        # ================================================================= #
        use_this_regex = /^configure_options=\(([\s\S]+)\)$/ # See: http://rubular.com/r/Zy29SMPvLm
        set_configure_options(
          recipe_dataset.scan(use_this_regex).flatten.first
        )
        set_configure_base_dir('')
        set_use_this_build_directory('')
        do_not_remove_the_extracted_archive
        # ================================================================= #
        # Run "configure" next.
        # ================================================================= #
        run_configure_via_system(nil, :do_not_change_the_directory)
        run_premake_make_then_make_install
        run_all_actions_after_the_make_install_step
      end
    end
  end
end
load_last_compiled_program() click to toggle source
#

load_last_compiled_program

This essentially does the following:

x = YAML.load_file('/Depot/Temp/rbt_logs/last_compiled_programs.yml')

To obtain this information from the commandline, try:

rbt --last-compiled-program?
#
# File lib/rbt/compile/misc.rb, line 3127
def load_last_compiled_program
  _ = RBT.file_compiled_programs
  if File.exist? _
    @last_compiled_program = YAML.load_file(_)
    result = @last_compiled_program
    # ===================================================================== #
    # If we store it as an Array, the last compiled program is the
    # one that comes last in that Array, too.
    # ===================================================================== #
    result = result.last if result.is_a? Array
    # ===================================================================== #
    # It may include a '#' character, in which case we will treat this
    # as a comment:
    # ===================================================================== #
    if result.include? '#'
      result = result[0, result.index('#')].strip
    end
    return result # <- And return the result here.
  else
    opne "No file exists at `#{sfile(_)}`."
    opne 'Thus, we can not load anything.'
    exit_program
  end
end
Also aliased as: last_compiled_program?
load_yaml_dataset_for_this_program( i, optional_arguments = nil ) click to toggle source
#

load_yaml_dataset_for_this_program

The first argument to this method should be the program that you wish to compile/install, as a String, such as “php” or “ruby” or something like that.

Keep in mind that this method will return an unsanitized description of the target program at hand.

#
# File lib/rbt/compile/yaml.rb, line 21
def load_yaml_dataset_for_this_program(
    i, optional_arguments = nil
  )
  dataset = RBT::Cookbooks::Cookbook.new(i) { :bypass_menu_check }
  return dataset # Return the cookbook here.
end
main_dataset()
Alias for: cookbook_dataset?
main_dataset?()
Alias for: cookbook_dataset?
main_eight?() click to toggle source
#

main_eight?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 677
def main_eight?
  cookbook_dataset?.main_eight?
end
make_command?() click to toggle source
#

make_command?

Tell us which make command we will be using.

#
# File lib/rbt/compile/make.rb, line 287
def make_command?
  @internal_hash[:make_command]
end
make_file?()
Alias for: make_file_exists?
make_file_exists?() click to toggle source
#

make_file_exists?

Determine whether a “Makefile” exists or whether it does not exist.

#
# File lib/rbt/compile/make.rb, line 232
def make_file_exists?
  File.exist? 'Makefile'
end
Also aliased as: make_file?
make_install_stage_was_a_success?() click to toggle source
#

make_install_stage_was_a_success?

#
# File lib/rbt/compile/problems_and_errors.rb, line 509
def make_install_stage_was_a_success?
  @internal_hash[:make_install_stage_was_a_success]
end
make_object?() click to toggle source
#

make_object?

Query-method towards the @make object (aka RBT::Make).

#
# File lib/rbt/compile/misc.rb, line 70
def make_object?
  @make
end
make_options?()
Alias for: parameters_to_make?
make_use_of_cookbook_aliases?() click to toggle source
#

make_use_of_cookbook_aliases?

#
# File lib/rbt/compile/obtain.rb, line 32
def make_use_of_cookbook_aliases?
  @internal_hash[:make_use_of_cookbook_aliases]
end
may_we_download?() click to toggle source
#

may_we_download?

#
# File lib/rbt/compile/upload_and_download.rb, line 253
def may_we_download?
  result = ihash?[:may_we_download]
  return result
end
may_we_initialize_a_new_cookbook_dataset?() click to toggle source
#

may_we_initialize_a_new_cookbook_dataset?

#
# File lib/rbt/compile/misc.rb, line 366
def may_we_initialize_a_new_cookbook_dataset?
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset]
end
may_we_run_make_install_command?()
Alias for: run_make_install?
may_we_run_ninja?() click to toggle source
#

may_we_run_ninja?

#
# File lib/rbt/compile/meson_and_ninja.rb, line 94
def may_we_run_ninja?
  @internal_hash[:may_we_run_ninja]
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

This menu may not have an else-clause, so we have to handle any other cases elsewhere.

#
Also aliased as: check_against_menu
meson_build_file_exists?() click to toggle source
#

meson_build_file_exists?

When we check for the file called “meson.build”, we must also keep in mind that we may use a build directory. This is the reason why the following code uses a variable.

#
# File lib/rbt/compile/meson_and_ninja.rb, line 48
def meson_build_file_exists?
  check_for_this_file = 'meson.build'
  # ======================================================================= #
  # Next check whether we do use a build directory or whether we do not.
  # ======================================================================= #
  if use_build_directory?
    check_for_this_file = check_for_this_file.dup if check_for_this_file.frozen?
    check_for_this_file.prepend('../')
  end
  does_this_file_exist?(check_for_this_file)
end
meson_configure_options?()
modify_the_makefile?() click to toggle source
#

modify_the_makefile?

If this is used then it should be used before invoking the “make” step.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 23
def modify_the_makefile?
  cookbook_dataset?.modify_the_makefile?
end
my_program()
Alias for: cookbook_dataset?
name?()
name_for_the_build_directory?() click to toggle source
#

name_for_the_build_directory?

#
# File lib/rbt/compile/build_directory.rb, line 164
def name_for_the_build_directory?
  @internal_hash[:name_for_the_build_directory]
end
Also aliased as: name_of_the_build_directory?
name_of_program?()
name_of_the_build_directory?()
ninja_install() click to toggle source
#

ninja_install

#
# File lib/rbt/compile/meson_and_ninja.rb, line 101
def ninja_install
  this_file = 'build.ninja'
  if may_we_run_ninja?
    if File.exist?(this_file)
      # =================================================================== #
      # === ninja
      # =================================================================== #
      e teal('ninja')
      reset_error_map_line_to_a_specific_error
      run_this_system_command 'ninja' # <- Run the sys-command here.
      run_through_the_registered_problems_registered_errors_and_behaviour_changes
      reset_error_map_line_to_a_specific_error
      # =================================================================== #
      # === ninja install
      # =================================================================== #
      e teal('ninja install')
      reset_error_map_line_to_a_specific_error
      run_this_system_command 'ninja install' # <- Run the sys-command here.
      run_through_the_registered_problems_registered_errors_and_behaviour_changes
      reset_error_map_line_to_a_specific_error
    else
      opne "No file called #{sfile(this_file)} could be found - thus,"
      opne "the build tool called #{orange('ninja')} can not be run."
      # =================================================================== #
      # Register this error as well:
      # =================================================================== #
      error_is :could_not_find_file_called_build_ninja
    end
  end
end
Also aliased as: ninjait, run_ninja
ninjait()
Alias for: ninja_install
no_colours( be_verbose = true )
Alias for: disable_colours
no_cookbook_dataset?() click to toggle source
#

no_cookbook_dataset?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 105
def no_cookbook_dataset?
  !(
    @internal_hash and @internal_hash[:yaml_dataset] and !@internal_hash[:yaml_dataset].nil?
  )
end
no_error_has_occurred?() click to toggle source
#

no_error_has_occurred?

#
# File lib/rbt/compile/problems_and_errors.rb, line 384
def no_error_has_occurred?
  !an_error_has_occurred?
end
no_error_was_encountered?() click to toggle source
#

no_error_was_encountered?

#
# File lib/rbt/compile/problems_and_errors.rb, line 65
def no_error_was_encountered?
  !an_error_has_occurred?
end
no_postinstall_actions()
no_postinstall_step()
no_problem_has_occurred?() click to toggle source
#

no_problem_has_occurred?

This method will return true if no problem has occurred - otherwise it will return false.

#
# File lib/rbt/compile/problems_and_errors.rb, line 394
def no_problem_has_occurred?
  !problem?
end
Also aliased as: no_problem_was_encountered?
no_problem_was_encountered?()
notify_the_user_that_ccache_is_not_available() click to toggle source
#

notify_the_user_that_ccache_is_not_available

Provide some information to the user about the use of ccache.

#
# File lib/rbt/compile/ccache.rb, line 36
def notify_the_user_that_ccache_is_not_available
  opnn; ewarn 'You are trying to use ccache, as specified by the '\
        'configuration'
  opnn; ewarn 'file, but ccache could not be found. Please install '\
        'ccache if'
  opnn; ewarn 'you wish to use it. The URL to the latest source would be:'
  e
  e sfancy("  #{::RBT.return_url1_of_this_program(:ccache)}")
  e
  opnn; ewarn 'If you do not want to use ccache, you can '\
              'disable ccache, via'
  opnn; ewarn 'either of the following two options:'
  e
  e sfancy('  rbt --permanently-disable-ccache')
  e
  e sfancy('  rbt --disable-ccache # this variant will avoid '\
           'ccache just for this run')
  e
  opnn; ewarn 'RBT will now continue without ccache.'
end
notify_the_user_that_no_binary_python_could_be_found() click to toggle source
#

notify_the_user_that_no_binary_python_could_be_found

#
# File lib/rbt/compile/python.rb, line 36
def notify_the_user_that_no_binary_python_could_be_found
  opnn; e 'No binary called "'+gold('python')+'" could be found. This may'
  opnn; e 'be resolved by a symlink to e. g. python3.'
end
notify_the_user_that_porg_is_not_available() click to toggle source
#

notify_the_user_that_porg_is_not_available

#
# File lib/rbt/compile/porg.rb, line 79
def notify_the_user_that_porg_is_not_available
  opnn; e 'You are trying to use porg, but porg is not installed.'
  opnn; e 'Please either install porg - or disable the configuration '
  opnn; e "option use_porg in the #{slateblue('configuration setting')}."
end
notify_the_user_that_something_failed_at_configure_stage() click to toggle source
#

notify_the_user_that_something_failed_at_configure_stage

#
# File lib/rbt/compile/misc.rb, line 2031
def notify_the_user_that_something_failed_at_configure_stage
  opne swarn('Something appears to have failed at the configure stage.')
  report_status
end
notify_the_user_that_this_program_is_missing( i = :jam ) { || ... } click to toggle source
#

notify_the_user_that_this_program_is_missing

The first argument to this method should be the program that is missing, such as 'ruby' or 'htop' or 'glib'.

The method will also notify the user how to install the program via the RBT scripts, if this is applicable - aka, if this program is registered.

#
# File lib/rbt/compile/problems_and_errors.rb, line 343
def notify_the_user_that_this_program_is_missing(
    i = :jam
  )
  i = i.to_s unless i.is_a? String
  e; cliner(use_colour: :konsole_slateblue) {
    e "#{rev}#{sfancy(i)} was not found on your system."
    e
    e 'As you are running via the RBT scripts, you can possibly '\
      'install '+simp(i)
    e 'by issuing the following command:'
    e
    e '  '+sfancy("rbt #{i}")
    e
    # ===================================================================== #
    # Extra options can be passed into the block to this method.
    # ===================================================================== #
    if block_given?
      yield
    end
  }; e
end
notify_the_user_that_we_will_use_sed_from_the_pwd() click to toggle source
#

notify_the_user_that_we_will_use_sed_from_the_pwd

#
# File lib/rbt/compile/sed.rb, line 152
def notify_the_user_that_we_will_use_sed_from_the_pwd
  opnn; e "Next applying #{teal('sed')} in the "\
          "directory #{sdir_return_pwd}:"
end
ntrad( optional_command_given = nil, be_verbose = true )
obtain_and_set_commandline_arguments_from(i) click to toggle source
#

obtain_and_set_commandline_arguments_from

#
# File lib/rbt/compile/commandline.rb, line 57
def obtain_and_set_commandline_arguments_from(i)
  if i and i.respond_to?(:any?) and i.any? {|entry| entry.to_s.start_with?('--') }
    commandline_arguments? << i.select {|inner_entry|
      inner_entry.to_s.start_with?('--')
    }
    commandline_arguments?.flatten!
    # ===================================================================== #
    # === filter_away_commandline_options
    #
    # Filter away the commandline-arguments from the rest of the input:
    # ===================================================================== #
    i.reject! {|inner_entry| inner_entry.to_s.start_with?('--') }
  end
  i # And we must return the modified variant here.
end
opn( optional_i = { namespace: @namespace } )
Alias for: opnn
opne(i = '') click to toggle source
#

opne

#
# File lib/rbt/compile/misc.rb, line 1443
def opne(i = '')
  opnn; e i
end
opnn( optional_i = { namespace: @namespace } ) click to toggle source
#

opnn (opnn tag)

#
# File lib/rbt/compile/opn.rb, line 89
def opnn(
    optional_i = { namespace: @namespace }
  )
  if use_opn?
    ::RBT::Compile.opnn(optional_i)
  end
end
Also aliased as: output_namespace?, opn, output_namespace?
original_input?() click to toggle source
#

original_input?

#
# File lib/rbt/compile/misc.rb, line 527
def original_input?
  @internal_hash[:original_input]
end
Also aliased as: input?
output_all_urls() click to toggle source
#

output_all_urls

This method will output all URLs of every registered program.

Invocation example:

ry --output_all_urls
#
# File lib/rbt/compile/misc.rb, line 2987
def output_all_urls
  dataset = RBT.all_urls(:no_opn).result? # Tap into this method here, without outputting the namespace.
  dataset = dataset.map {|entry|
    entry[0] = '  '+(entry[0]+' ').ljust(30)
    entry.join
  }.join("\n")
  store_where = rbt_log_dir?+'all_program_urls.md'
  File.delete(store_where) if File.exist? store_where # Let's get rid of the old file first.
  opne "Storing into #{sfile(store_where)}"
  save_file(dataset, store_where)
end
output_all_urls_then_exit() click to toggle source
#

output_all_urls_then_exit

#
# File lib/rbt/compile/misc.rb, line 2972
def output_all_urls_then_exit
  output_all_urls
  exit_program
end
output_namespace?( optional_i = { namespace: @namespace } )
Alias for: opnn
package_rbt_scripts( also_exit = false ) click to toggle source
#

package_rbt_scripts (package tag, release tag)

You can use this method to package the RBT scripts.

A specialized class will do this for us, class PackageRbtScripts.

Invocation examples:

ry --package_rbt_scripts
ry --release
#
# File lib/rbt/compile/misc.rb, line 2388
def package_rbt_scripts(
    also_exit = false
  )
  RBT::PackageRbtScripts.new
  also_exit = true if also_exit == :then_exit
  exit_program if also_exit
end
parameters_to_make?() click to toggle source
#

parameters_to_make?

The aliased method to this method, called make_options?, is mildly discouraged after 12.04.2019. The primary reason for this is that the name parameters_to_make? is more explicit, and thus better in the long run (less confusing).

#
# File lib/rbt/compile/make.rb, line 147
def parameters_to_make?
  _ = @internal_hash[:parameters_to_make]
  if _.nil?
    _ = cookbook_dataset_parameters_to_make?
  end
  _
end
Also aliased as: make_options?
parse_this_line_obtained_via_io_popen( line, use_colours = use_colours? ) click to toggle source
#

parse_this_line_obtained_via_io_popen

This method is used to parse all output generated via IO.popen().

#
# File lib/rbt/compile/system.rb, line 16
def parse_this_line_obtained_via_io_popen(
    line,
    use_colours = use_colours?
  )
  # ======================================================================= #
  # Delegate towards class ColourizeParser next.
  # ======================================================================= #
  cparser = @internal_hash[:colourize_parser]
  unless use_colours
    cparser.disable_colours
  end
  line.chomp!
  # ======================================================================= #
  # Feed towards module RBT::Errors::MapLineToASpecificError next:
  # ======================================================================= #
  RBT::Errors::MapLineToASpecificError.parse_this_line(line)
  # ======================================================================= #
  # Next, put the line towards ColourizeParser. The reason why this is
  # done after the error checking above is to simply keep the output
  # as it was originally, before changing it via colours and the like.
  # ======================================================================= #
  cparser.grab_this_line(line)
  line = cparser.line?.dup
  if line.include?('A required package was not found') and
     !RBT::Errors::MapLineToASpecificError.required_packages?.empty?
    name_of_the_package = RBT::Errors::MapLineToASpecificError.required_packages?.first.to_s
    line << ' '+crimson('( -> '+name_of_the_package+' is missing)')
    line << N+N+'You can try to install it via:'+N
    line << N+slateblue('  rbt '+name_of_the_package)+N+N
  end
  # ======================================================================= #
  # The reason we output the line here is so that we can still do
  # modifications to it, if we have to. This is the case e. g. for
  # when we wish to display which package is missing.
  # ======================================================================= #
  e line # Output here.
  if line.include?('configure: No such file or directory')
    opnn; e 'The '+crimson('above error message')+' most likely means '\
            'that no configure script could be found.'
  end
  @internal_hash[:array_sys_command_string] << line # We could also store the lines here.
end
path?()
Alias for: program_path?
pc_files?()
Alias for: pkgconfig_files?
permanently_add_this_global_flag(i) click to toggle source
#

permanently_add_this_global_flag

Use this method in order to permanently add a new global flag, into the file called “global_flags.yml”.

To test this method, try:

rbt --add-global-flag=--disable-static
#
# File lib/rbt/compile/permanent.rb, line 57
def permanently_add_this_global_flag(i)
  i = i.to_s.dup
  into = RBT.file_global_flags
  opne "Now appending the flag `#{sfancy(i)}` into the "\
       "file `#{sfile(into)}`."
  old_file_content = ''.dup
  if File.exist? into
    old_file_content << File.read(into).strip
  end
  old_file_content << " #{i}"
  what = old_file_content
  write_what_into(what, into)
  if is_on_roebe?
    into = ROEBE_FILE_GLOBAL_FLAGS
    opne 'Now appending the flag `'+sfancy(i)+'` into the '\
         'file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
Also aliased as: add_this_global_flag
permanently_disable_porg() click to toggle source
#

permanently_disable_porg

Permanently disable porg via this method.

#
# File lib/rbt/compile/porg.rb, line 23
def permanently_disable_porg
  if use_porg?
    opne 'Disabling porg.'
    if configuration?.respond_to? :use_porg=
      configuration?.use_porg = false
      if configuration?.respond_to? :save_config
        configuration?.save_config
      else
        what = false
        into = FILE_USE_PORG
        opne "Storing into `#{sfile(into)}`."
        write_what_into(what, into)
      end
    else
      opnn; e 'The configuration-object is not functional - it does not'
      opnn; e 'respond to the method called .use_porg='
    end
  else
    opne 'Porg is already disabled.'
  end
end
permanently_enable_is_on_gobolinux( be_verbose = :be_verbose ) click to toggle source
#

permanently_enable_is_on_gobolinux

Use this method to “enable” the GoboLinux file layout.

To call this method from the commandline, do:

rbt --permanently-enable-is-on-gobolinux
#
# File lib/rbt/compile/gobolinux.rb, line 87
def permanently_enable_is_on_gobolinux(
    be_verbose = :be_verbose
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  end
  _ = RBT.file_is_on_gobolinux
  if File.exist? _
    opnn; e "The file at `#{sfile(_)}` already exists."
  else
    if be_verbose
      opnn; e "Enabling GoboLinux layout now via the file `#{sfile(_)}`."
    end
    opnn; e "Now creating the file #{sfile(_)}."
    create_file(_)
    enable_is_on_gobolinux # And also enable the GoboLinux behaviour.
  end
end
permanently_remove_this_global_flag(i) click to toggle source
#

permanently_remove_this_global_flag

Use this method in order to permanently remove a new global flag, into the file called “global_flags.yml”.

To test this method, try:

rbt --remove-global-flag=--disable-static
#
# File lib/rbt/compile/permanent.rb, line 88
def permanently_remove_this_global_flag(i)
  i = i.to_s.dup
  into = RBT.file_global_flags
  old_file_content = ''.dup
  if File.exist? into
    old_file_content << File.read(into).strip
  end
  if old_file_content.include? i
    opne 'Now removing the flag `'+sfancy(i)+'` from the '\
         'file `'+sfile(into)+'`.'
    old_file_content.gsub!(/#{i}/, '')
  else
    opne "The flag `#{sfancy(i)}` can not be removed from "\
         "the file `#{sfile(into)}`."
    opne 'because this file does not have that flag.'
  end
  what = old_file_content
  write_what_into(what, into)
  if is_on_roebe?
    into = ROEBE_FILE_GLOBAL_FLAGS
    opne 'Now removing the flag `'+sfancy(i)+'` from the '\
         'file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
Also aliased as: remove_this_global_flag
permanently_set_programs_dir(what) click to toggle source
#

permanently_set_programs_dir

#
# File lib/rbt/compile/permanent.rb, line 14
def permanently_set_programs_dir(what)
  into = FILE_PROGRAMS_DIRECTORY
  opnn; e 'Storing '+sfancy(what)+' into the file `'+sfile(into)+'`.'
  write_what_into(what, into)
  if is_on_roebe?
    into = RUBY_SRC+'rbt/lib/rbt/yaml/configuration/programs_directory.yml'
    opnn; e 'Storing '+sfancy(what)+' into the file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
permanently_set_programs_directory(what)
pid?() click to toggle source
#

pid?

#
# File lib/rbt/compile/misc.rb, line 2855
def pid?
  $?.pid
end
pkgconfig_files?() click to toggle source
#

pkgconfig_files?

Query method over the registered .pc files of a particular program.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 591
def pkgconfig_files?
  cookbook_dataset?.pkgconfig_files?
end
Also aliased as: pc_files?
populate_internal_hash_with_default_values() click to toggle source
#

populate_internal_hash_with_default_values

This method will populate the internal Hash with sane default values.

These are values that, for the most part, can NOT be persistently set on the commandline. This may change at a later time, though, or is not true for some variables, such as :prefix. But it is true for entries such as :have_we_successfully_installed_the_program.

#
# File lib/rbt/compile/reset.rb, line 339
def populate_internal_hash_with_default_values
  # ======================================================================= #
  # Whether we have encountered a problem or not. Must be reset for
  # any new per-compile cycle run.
  # ======================================================================= #
  @internal_hash[:problem] = false
  # ======================================================================= #
  # The next variable must be true by default.
  # ======================================================================= #
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset] = true
  # ======================================================================= #
  # The variable at :can_we_continue is reset during every iteration.
  # It will be true by default.
  # ======================================================================= #
  @internal_hash[:may_we_download] = RBT::TRY_TO_DOWNLOAD_IF_NOT_FOUND
  @internal_hash[:can_we_continue] = true
  @internal_hash[:compile_this_program] = nil
  @internal_hash[:may_we_run_ninja] = true # <- By default we can always run ninja again.
  @internal_hash[:prefix] = RBT::Prefix.new(:trad) # Set a default prefix to use.
  # ======================================================================= #
  # The next variable will be nil by default, so that we can grab the
  # value that the cookbook-dataset is using here.
  # ======================================================================= #
  @internal_hash[:run_make_command] = nil
  # ======================================================================= #
  # By default, we will run "make install". This covers most programs
  # that are to be compiled from source.
  # ======================================================================= #
  @internal_hash[:run_make_install] = true
  @internal_hash[:use_opn] = true # <- Whether we use opn or whether we don't.
  # ======================================================================= #
  # The next variable can keep track of sys-commands that were run.
  # ======================================================================= #
  @internal_hash[:array_sys_command_string] = []
  @internal_hash[:exit_after_a_rubygem_has_been_installed] = false
  @internal_hash[:install_only_binaries] = false
  # ======================================================================= #
  # Whether the "make install" stage was a success. This is true by
  # default and will only become false if an error is encountered.
  # ======================================================================= #
  @internal_hash[:make_install_stage_was_a_success] = true
  # ======================================================================= #
  # The next variable keeps track over as to whether we have
  # successfully installed the program or whether we have not.
  # ======================================================================= #
  @internal_hash[:have_we_successfully_installed_the_program] = false
  @internal_hash[:rename_tab_title] = RBT.configuration?.rename_tab_title
  # ======================================================================= #
  # Whether the given input is an abbreviation or not. By default we
  # assume that the user has NOT used an abbreviated term for a real
  # program.
  # ======================================================================= #
  @internal_hash[:is_an_abbreviation] = false
  # ======================================================================= #
  # By default, all programs will have been installed successfully. The
  # next variable keeps track of this.
  # ======================================================================= #
  @internal_hash[:has_the_program_been_installed_successfully] = true
  # ======================================================================= #
  # We have to store the full configure command as well. It is not just
  # for configure but also for cmake, meson and so forth.
  # ======================================================================= #
  @internal_hash[:full_configure_command] = ''.dup
  # ======================================================================= #
  # Register any reported dependencies.
  # ======================================================================= #
  @internal_hash[:array_required_dependencies] = []
  @internal_hash[:an_error_has_occurred] = false
  @internal_hash[:try_to_autofix] = true
  @internal_hash[:try_to_recompile_upon_error] = true
  @internal_hash[:continue_after_make_step] = true
end
Also aliased as: reset_internal_hash
portingaids()
postinstall?()
Alias for: postinstallation?
postinstallation?() click to toggle source
#

postinstallation?

#
# File lib/rbt/compile/postinstallation_step.rb, line 83
def postinstallation?
  _ = cookbook_dataset_postinstall?
  # ======================================================================= #
  # The following part is, as of January 2019, only added when we have
  # modified this variable through the method set_user_prefix(). The
  # user can (currently) not modify this variable on his/her own.
  # ======================================================================= #
  unless @internal_hash[:postinstallation].nil?
    _ = @internal_hash[:postinstallation]
  end
  _ # Return it here.
end
Also aliased as: postinstall?
pre_configure_steps?() click to toggle source
#

pre_configure_steps?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 37
def pre_configure_steps?
  cookbook_dataset?.pre_configure_steps?
end
pre_make_install_sed()
pre_make_install_sed?() click to toggle source
#

pre_make_install_sed

#
# File lib/rbt/compile/cookbook_dataset.rb, line 421
def pre_make_install_sed?
  cookbook_dataset?.pre_make_install_sed?
end
Also aliased as: pre_make_install_sed
prefix()
Alias for: prefix?
prefix=( i = :use_ntrad_prefix_at_a_later_time )
Alias for: set_user_prefix
prefix?() click to toggle source
#

prefix?

This will properly handle the prefix in use. It is the general getter-method which should be used whenever we wish to obtain the prefix in user.

#
# File lib/rbt/compile/prefix.rb, line 52
def prefix?
  if @internal_hash[:user_prefix] # aka: if user_prefix?
    use_this_as_prefix = @internal_hash[:user_prefix]
  else
    use_this_as_prefix = @internal_hash[:prefix]
    # ===================================================================== #
    # Or we could try:
    # ===================================================================== #
    #  use_this_prefix = cookbook_prefix?
  end
  unless use_this_as_prefix.end_with? '/'
    use_this_as_prefix = use_this_as_prefix.dup
    use_this_as_prefix << '/'
  end if use_this_as_prefix.is_a? String
  use_this_as_prefix # Return it here.
end
preinstall?()
prepare_dataset_for( this_program = @internal_hash[:compile_this_program], optional_arguments = nil )
prepend_dot_to_configure_string() click to toggle source
#

prepend_dot_to_configure_string

#
# File lib/rbt/compile/misc.rb, line 2197
def prepend_dot_to_configure_string
  full_configure_command?.prepend('.')
end
prepend_env_path_with(i = '/usr/bin/') click to toggle source
#

prepend_env_path_with

#
# File lib/rbt/compile/path.rb, line 38
def prepend_env_path_with(i = '/usr/bin/')
  unless i.end_with? ':'
    i = i.dup if i.frozen?
    i << ':'
  end
  set_path(i+query_path?)
end
problem?() click to toggle source
#

problem?

#
# File lib/rbt/compile/problems_and_errors.rb, line 113
def problem?
  @internal_hash[:problem]
end
problem_is( i = nil, optional_extra_information = nil ) click to toggle source
#

problem_is

Keep in mind that not every problem is an error. An error will indicate that copilationg will (or already has) fail(ed).

An example for an error may be :missing_headers, which indicates that some .h files may be missing (or could not be found, anyway).

An example for a problem may be some add-on failing, without this being a “critical problem” (aka an error).

#
# File lib/rbt/compile/problems_and_errors.rb, line 91
def problem_is(
    i                          = nil,
    optional_extra_information = nil
  )
  case i
  when :default,
       :no_problem # This is the default too. The nil value will be used in these cases.
    i = nil
  end
  if i.is_a? Array
    i = i.first # Only use the first Array entry.
  end
  if optional_extra_information
    @internal_hash[:problem] = [i, optional_extra_information]
  else # This here is the default - it is a LOT more common.
    @internal_hash[:problem] = i
  end
end
problem_is?()
Alias for: problem?
problems?()
Alias for: problem?
program?()
program_compile_name?() click to toggle source
#

program_compile_name?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 721
def program_compile_name?
  cookbook_dataset?.program_compile_name?.to_s
end
program_full_name?() click to toggle source
#

program_full_name?

This will always query the dataset object.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 298
def program_full_name?
  cookbook_dataset?.program_full_name? # This returns e. g. 'gnome-mahjonng-5.08.tar.xz'
end
program_has_to_be_compiled?() click to toggle source
#

program_has_to_be_compiled?

The query-method program_has_to_be_compiled? determines whether our program has to be compiled or whether it does not have to be compiled.

For example, ruby .gem files typically do not have to be compiled, whereas C/C++ projects have to be compiled.

#
# File lib/rbt/compile/misc.rb, line 3218
def program_has_to_be_compiled?
  cookbook_dataset? and cookbook_dataset_program_has_to_be_compiled?
end
program_information_return_name(i) click to toggle source
#

program_information_return_name

This method can be used to specifically return the short name of a given input-String. That input-String usually is a remote URL to some program.

#
# File lib/rbt/compile/misc.rb, line 549
def program_information_return_name(i)
  ProgramInformation.return_short_name(File.basename(i))
end
program_name?()
program_name_and_program_version?() click to toggle source
#

program_name_and_program_version?

#
# File lib/rbt/compile/misc.rb, line 489
def program_name_and_program_version?
  @program_name_and_program_version
end
program_name_and_version?() click to toggle source
#

program_name_and_version?

This method must return the program_name and the program version of any given program.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 315
def program_name_and_version?
  cookbook_dataset?.program_name? # Delegate to dataset? here.
end
program_path?() click to toggle source
#

program_path?

#
# File lib/rbt/compile/misc.rb, line 585
def program_path?
  @internal_hash[:program_path]
end
Also aliased as: path?
program_uses_an_appdir_prefix?( use_this_prefix = programs_dir? )
Alias for: is_appdir_prefix?
program_uses_cmake?()
Alias for: depends_on_cmake?
program_version()
Alias for: program_version?
program_version?() click to toggle source
#

program_version?

This method will return the program version in use. The default will be to simply use the version stored in the cookbook dataset, but we also allow for the user to supply commandline-flags to use any other program version that he/she desires to use.

#
# File lib/rbt/compile/version.rb, line 245
def program_version?
  _ = cookbook_dataset_program_version? # <- Default value.
  if @internal_hash[:use_this_specific_program_version]
    _ = @internal_hash[:use_this_specific_program_version]
  end
  _.delete('/') if _ # A bit hackish, since it is a workaround, but necessary for now (Jan 2019).
end
Also aliased as: version?, program_version
purge_all_man_files_in_the_programs_hierarchy() click to toggle source
#

purge_all_man_files_in_the_programs_hierarchy

Invoke this method by issuing something like this:

ry --nomanpage
#
# File lib/rbt/compile/misc.rb, line 2532
def purge_all_man_files_in_the_programs_hierarchy
  target = programs_directory?
  opne "Now purging all man-pages in `#{sdir(target)}`."
  opne '(Note that we will only work on entries pointed at '\
       'with a Current symlink.)'
  Dir[target+'*'].each {|entry|
    entry << '/' unless entry.end_with? '/'
    current = entry + 'Current'
    if File.symlink? current
      # Ok, the Current -> symlink exists, thus we can continue.
      manpage = File.readlink(current)+'/share/man/'
      manpage = rds(manpage)
      if File.exist? manpage and File.directory? manpage
         opne 'Now removing the directory `'+sdir(manpage)+'`.'
         remove_directory(manpage) unless manpage.squeeze('/') == '/' # Trivial "safeguard".
      end
    end
  }
end
purge_fhs_binaries_of_this_program( i = compile_which_program? ) click to toggle source
#

purge_fhs_binaries_of_this_program

This method will purge binaries that may reside at the /usr/bin/ hierarchy. Be careful when using this - only use it when you are sure that you want this functionality.

Invocation examples:

ry littleutils --purge-fhs-binaries
ry --purge-traditional-binaries-from=xscreensaver
#
# File lib/rbt/compile/misc.rb, line 1664
def purge_fhs_binaries_of_this_program(
    i = compile_which_program?
  )
  if i.nil?
    opne 'Please provide a valid program name to this method.'
    return
  end
  PurgeBinariesOfThisProgram.new(i.downcase)
end
purge_fhs_libraries_of_this_program( i = compile_which_program? ) click to toggle source
#

purge_fhs_libraries_of_this_program

Get rid of all /usr/lib/ libraries of the respective program at hand.

Invocation example:

ry --fhs-purge-libraries=libgc
#
# File lib/rbt/compile/misc.rb, line 2810
def purge_fhs_libraries_of_this_program(
    i = compile_which_program?
  )
  if i.nil?
    opne 'Please provide a valid program name to this method.'
    return
  end
  PurgeLibrariesOfThisProgram.new(i)
end
purge_these_binaries( i = binaries? ) click to toggle source
#

purge_these_binaries

This method can be used to purge binaries.

#
# File lib/rbt/compile/misc.rb, line 1753
def purge_these_binaries(
    i = binaries?
  )
  removed_n_binaries = 0
  opne "Now attempting to remove #{sfancy(i.size.to_s)} binaries:"
  e
  i.each {|this_binary|
    target = "/usr/bin/#{this_binary}"
    ftype = nil
    begin
      ftype = File.ftype(target)
    rescue Errno::ENOENT; end
    if File.exist? target
      e "Deleting the file `#{sfile(target)}` next."
      remove_file(target)
      removed_n_binaries += 1
    else
      if ftype == 'link'
        e "Deleting the stray symlink at `#{sfile(target)}` next."
        remove_symlink(target)
      end
    end
  }
  e
  if removed_n_binaries == 0
    opne 'None of these binaries could be '\
         'found at '+sdir('/usr/bin/')+'.'
  end
end
query_configuration_options( i = compile_this_program? ) click to toggle source
#

query_configuration_options

This method will query the configuration option of a given program.

Invocation example:

ry glibc qco
#
# File lib/rbt/compile/misc.rb, line 2962
def query_configuration_options(
    i = compile_this_program?
  )
  RBT::Cookbooks::ShowConfigurationOptions.new(i)
  exit_program
end
query_debug_value() click to toggle source
#

query_debug_value

#
# File lib/rbt/compile/debug.rb, line 14
def query_debug_value
  opne 'Will we debug? '+sfancy(yes_no(RBT.debug?))
end
query_path?() click to toggle source
#

query_path?

Query the $PATH variable, within ENV.

#
# File lib/rbt/compile/path.rb, line 19
def query_path?
  ENV['PATH'].dup # .dup-ing it is better in the long run.
end
real_prefix?()
Alias for: prefix?
real_program_name?()
real_short_name?() click to toggle source
#

real_short_name?

The real_short_name is a String such as 'gnomemahjonng'. If you need to obtain the String that includes the '-' token then you should use short_name? instead.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 228
def real_short_name?
  cookbook_dataset?.real_short_name?
end
rebuild_path() click to toggle source
#

rebuild_path

#
# File lib/rbt/compile/cookbook_dataset.rb, line 553
def rebuild_path
  cookbook_dataset?.reassemble_program_path
end
register_all_programs() click to toggle source
#

register_all_programs

#
# File lib/rbt/compile/register.rb, line 70
def register_all_programs
  get_all_programs.each {|entry| register_program(entry) }
end
register_all_protos_for_compilation() click to toggle source
#

register_all_protos_for_compilation

Invoke this method like so:

ry --protos
#
# File lib/rbt/compile/misc.rb, line 319
def register_all_protos_for_compilation
  proto_programs = available_programs?.select {|entry|
    entry.include?('proto')
  }
  proto_programs.reject! {|line|
    line.include? 'protobuf'
  }
  # ======================================================================= #
  # Reject those that are .gem files next - but this will only work if
  # the directory with expanded cookbooks is available:
  # ======================================================================= #
  if directory_expanded_cookbooks_exists?
    proto_programs.reject! {|name_of_the_program|
      this_file = directory_expanded_cookbooks+name_of_the_program+'.yml'
      if File.exist? this_file
        dataset = YAML.load_file(this_file)
        dataset['program_path'].end_with? '.gem'
      else
        e 'No file called '+sfile(this_file)+' was found.'
        nil
      end
    }
  end
  opne "We will next compile all "\
       "#{sfancy(proto_programs.size.to_s)}"\
       " proto-programs."
  set_compile_these_programs(proto_programs)
end
register_configure_line_into_configure_database() click to toggle source
#

register_configure_line_into_configure_database

This method will register the complete configure-line used by the program at hand, into a yaml “database”. This is just a single .yml file that keeps track of all configure options used when compiling a program.

#
# File lib/rbt/compile/misc.rb, line 3292
def register_configure_line_into_configure_database
  compile_this_program = compile_which_program?
  store_this = full_configure_command?.dup
  unless store_this.empty?
    # ===================================================================== #
    # First load up the old "database" if it exists.
    # ===================================================================== #
    into = RBT.file_configure_database?
    hash = {}
    # ===================================================================== #
    # Load the dataset from the file if it already exists.
    # ===================================================================== #
    if File.exist? into
      hash.update(YAML.load_file(into))
    end
    # ===================================================================== #
    # We do not need to delete any old entry, because the following line
    # will overwrite the old content anyway, if it exists.
    # ===================================================================== #
    hash[compile_this_program] = store_this
    what = YAML.dump(hash)
    opne 'Storing the configure command'
    opne "  `#{sfancy(store_this)}`"
    opne "into the file `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
register_last_compiled_program( i = compile_which_program? ) click to toggle source
#

register_last_compiled_program

This method will try to store the last compiled program into the file determined via the method call RBT.file_compiled_program().

We will only store if the entry is DIFFERENT to the last one though.

This file is:

$RBT/yaml/last_compiled_program.yml
#
# File lib/rbt/compile/register.rb, line 25
def register_last_compiled_program(
    i = compile_which_program?
  )
  unless has_a_problem_occurred?
    unless do_not_compile? # Continue only if we do want to compile.
      file = RBT.file_compiled_programs
      base_dir = File.dirname(
        RBT.file_compiled_programs
      )
      mkdir(base_dir) unless Dir.exist? base_dir
      if File.exist? file # Must check whether the file exists first.
        array_dataset = YAML.load_file(file)
      else
        array_dataset = []
      end
      if array_dataset.respond_to? :uniq!
        array_dataset.uniq!
      # else
      #   opne swarn('Some minor problem occurred:')
      end
      unless array_dataset.last == i # Storing only if it is different.
        opne 'Trying to register the last compiled program '\
             '(`'+springgreen(i)+'`) into the file:'
        opne "  `#{sfile(file)}`"
        # ================================================================= #
        # Remove any old entries, if they exist.
        # ================================================================= #
        if array_dataset.include? i 
          array_dataset.reject! {|entry| entry == i }
        end
        what = array_dataset.map {|entry|
          " - #{entry}#{N}"
        }.join
        # ================================================================= #
        # Simply append to the dataset (aka file) at hand.
        # ================================================================= #
        write_what_into(what, file)
      end if array_dataset.respond_to? :last
    end
  end
end
register_required_dependency( name_of_the_program, program_version ) click to toggle source
#

register_required_dependency

#
# File lib/rbt/compile/register.rb, line 77
def register_required_dependency(
    name_of_the_program, program_version
  )
  @internal_hash[:array_required_dependencies] << [
    name_of_the_program, program_version
  ]
end
register_sigint() click to toggle source
#

register_sigint

We have to register the siginterrupts, so as to gracefully handle user-interrupts via Ctrl-C.

#
# File lib/rbt/compile/sigint.rb, line 17
def register_sigint
  Signal.trap('SIGINT') {
    do_set_keep_extracted(:be_silent)
    do_not_run_ldconfig
    remove_compiling_is_in_progress
    opne 'Exiting now at once.'
    exit_program
  }
end
register_that_this_program_is_currently_being_compiled() click to toggle source
#

register_that_this_program_is_currently_being_compiled

This method will register that a given program is currently being compiled.

#
# File lib/rbt/compile/register.rb, line 124
def register_that_this_program_is_currently_being_compiled
  into = RBT.file_status # <- This may be e. g. "/Depot/Temp/rbt/status.yml".
  dataset = {}
  if File.exist? into
    dataset.merge!(YAML.load_file(into))
  end
  unless dataset.has_key? 'currently_compiling_these_programs'
    dataset['currently_compiling_these_programs'] = []
  end
  dataset['currently_compiling_these_programs'] << compile_this_program?
  what = YAML.dump(dataset)
  # ======================================================================= #
  # We must sure that the base directory exists.
  # ======================================================================= #
  unless File.directory?(File.dirname(into))
    mkdir(File.dirname(into))
  end
  write_what_into(what, into)
end
registered_erroneous_libtool_entries?() click to toggle source
#

registered_erroneous_libtool_entries?

#
# File lib/rbt/compile/libtool.rb, line 103
def registered_erroneous_libtool_entries?
  RBT::Errors::MapLineToASpecificError.erroneous_libtool_entries?
end
Also aliased as: erroneous_libtool_entries?
registered_errors?()
Alias for: problem?
remove_all_temp_directories() click to toggle source
#

remove_all_temp_directories

This method will remove all directories in the /Depot/Temp hierarchy. It was added since it is sometimes easier to just remove all extracted archives via batch-process.

#
# File lib/rbt/compile/extract.rb, line 309
def remove_all_temp_directories
  _ = rbt_log_dir?
  all_directories_there = Dir["#{_}*"].select {|entry| File.directory? entry }
  opnn; e "All #{sfancy(all_directories_there.size.to_s)}"\
          " directories in the #{sdir(_)} hierarchy will be removed."
  remove_these_directories(all_directories_there)
end
remove_extracted_archive( where = :build_anew ) click to toggle source
#

remove_extracted_archive

This method simply removes the extracted archive. If @keep_extracted was set to true we will not run it, but this is decided in another method called consider_removing_extracted_archive().

Note that the invocation of this method must happen last, as otherwise we may run into problems such as:

in `pwd': No such file or directory - getcwd (Errno::ENOENT)

We can not use the string returned by the method extract_to_this_directory? because this will refer to the rbt/ base directory.

#
# File lib/rbt/compile/extract.rb, line 359
def remove_extracted_archive(
    where = :build_anew
  )
  case where
  when :build_anew, :default
    where = rds(
      extract_to_this_directory?+
      cookbook_dataset_real_program_name?.to_s+'-'+program_version?.to_s+
      '/'
    )
  end
  if run_simulation? # Run in simulation mode here.
    opnn; e sfancy('We run in simulation mode right now. Normally the directory ')
    opnn; e sdir(where)+sfancy('would next be removed.')
  else # ================================================================== #
       # We must honour the keep_extracted setting. We also will not
       # remove the log directory.
       # ================================================================== #
    if keep_the_extracted_archive? or (where == RBT.log_directory?)
      # =================================================================== #
      # In this case we do not have to do anything.
      # =================================================================== #
    else
      opnn; e "Removing the extracted archive at `#{sdir(where)}`."
      unless File.directory? where
        _ = 'However had, no such directory exists. Perhaps '\
            'it was already removed, or it has never existed.'
        opnn; e _
      end
      # =================================================================== #
      # We must check whether the directory exists, before trying to
      # remove it.
      # =================================================================== #
      if File.directory? where
        remove_directory(where)
      else
        # No directory exists there.
      end
    end
  end
end
remove_la_files_after_compilation?()
remove_the_extracted_archive( where = :build_anew )
remove_this_global_flag(i)
rename_shell( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title] )
rename_tab_title?() click to toggle source
#

rename_tab_title?

#
# File lib/rbt/compile/tab.rb, line 22
def rename_tab_title?
  @internal_hash[:rename_tab_title]
end
report_all_blfs_entries() click to toggle source
#

report_all_blfs_entries

#
# File lib/rbt/compile/show_and_report.rb, line 295
def report_all_blfs_entries
  RBT::Blfs.new
end
report_all_programs_that_make_use_of_a_build_directory() click to toggle source
#

report_all_programs_that_make_use_of_a_build_directory

This method can report all programs that make use of a build directory. Note that this presently depends on the existance of the directory expanded_cookbooks.

#
# File lib/rbt/compile/show_and_report.rb, line 347
def report_all_programs_that_make_use_of_a_build_directory
  if expanded_directory_exists?
    target = directory_expanded_cookbooks?
    all_files = Dir["#{target}*.yml"]
    all_files.select! {|entry|
      dataset = YAML.load_file(entry)
      dataset['use_build_directory']
    }
    all_files.map! {|entry|
      File.basename(entry).sub(/\.yml$/,'')
    }
    if all_files.empty?
      opnn; e 'No cookbook recipe makes use of a build directory.'
    else
      opnn; e "The following #{slateblue(all_files.size.to_s)} programs "\
              "make use of a build directory:"
      all_files.each_with_index {|this_program, index| index += 1
        padded_index = index.to_s.rjust(4).ljust(6)
        colourized_and_padded_index = royalblue(padded_index)
        e colourized_and_padded_index+
          lightblue(this_program)
      }
    end
  else
    # ===================================================================== #
    # else notify the user how to create the relevant directory.
    # ===================================================================== #
    opnn; e 'The expanded directory does not exist. You can (re)create it'
    opnn; e 'by issuing:'
    e
    e '  rbt --create-expanded-directory'
    e
  end
end
report_finished_installing_this_program( i = compile_this_program? ) click to toggle source
#

report_finished_installing_this_program

Report that we have finished compiling the program.

#
# File lib/rbt/compile/show_and_report.rb, line 519
def report_finished_installing_this_program(
    i = compile_this_program?
  )
  unless do_not_compile?
    unless problem? || an_error_has_occurred?
      opnn; e "Finished installing the program `#{sfancy(i)}`."
    end
  end
end
report_n_programs() click to toggle source
#

report_n_programs

Report how many programs (cookbook files) are currently registered in the RBT project.

Commandline-invocation example:

rbt --report-n-programs
#
# File lib/rbt/compile/show_and_report.rb, line 472
def report_n_programs
  RBT.report_the_registered_programs
end
report_post_xorg_server_components() click to toggle source
#

report_post_xorg_server_components

#
# File lib/rbt/compile/xorg.rb, line 54
def report_post_xorg_server_components
  result = return_chained_programs['post_xorg_server']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
report_rbt_version( optional_shall_we_exit = false ) click to toggle source
#

report_rbt_version

This method will report the version in use by the RBT project.

Invocation examples:

ry --version
rbt version?
#
# File lib/rbt/compile/version.rb, line 207
def report_rbt_version(
    optional_shall_we_exit = false
  )
  case optional_shall_we_exit
  when :also_exit,
       :then_exit
    optional_shall_we_exit = true
  end
  RBT.report_rbt_version
  exit if optional_shall_we_exit
end
report_status()
report_status_information() click to toggle source
#

report_status_information

Invocation example:

rbt --report-status
#
# File lib/rbt/compile/misc.rb, line 1017
def report_status_information
  e
  e 'The source directory is at:                      '+sdir(RBT.source_dir?)
  e 'The temp directory is at:                        '+sdir(RBT.temp_dir?)
  report_where_archives_will_be_extracted_into
  e
end
report_the_amount_of_binaries( i = compile_which_program? ) click to toggle source
#

report_the_amount_of_binaries

Invocation example:

ry glib --n-binaries?
#
# File lib/rbt/compile/show_and_report.rb, line 235
def report_the_amount_of_binaries(
    i = compile_which_program?
  )
  ensure_proper_dataset_for(i) if cookbook_dataset?.nil?
  _ = binaries?
  opnn; e 'The program '+sfancy(i)+' will '\
          'install '+sfancy(_.size.to_s)+' binaries.'
end
report_the_compile_strategies() click to toggle source
#

report_the_compile_strategies

#
# File lib/rbt/compile/statistics.rb, line 30
def report_the_compile_strategies
  require 'rbt/statistics/compile_strategies.rb'
  RBT.report_the_compile_strategies
end
report_where_archives_will_be_extracted_into() click to toggle source
#

report_where_archives_will_be_extracted_into

#
# File lib/rbt/compile/show_and_report.rb, line 335
def report_where_archives_will_be_extracted_into
  e "Archives will be extracted into this directory: "\
    "#{sdir(extract_to?)}"
end
report_where_we_store_then_exit() click to toggle source
#

report_where_we_store_then_exit

#
# File lib/rbt/compile/show_and_report.rb, line 45
def report_where_we_store_then_exit
  report_where_we_will_store_logs
  exit_program
end
report_where_we_will_store_logs() click to toggle source
#

report_where_we_will_store_logs

This will ask where we store our BT-Related files. The Config object defines that.

To trigger this, do:

ry --store_where?
#
# File lib/rbt/compile/show_and_report.rb, line 61
def report_where_we_will_store_logs
  opnn; e "Log-files will be stored into the directory `"\
          "#{sdir(log_dir?)}`."
end
Also aliased as: store_where?
report_whether_a_build_directory_will_be_used_for_this_program() click to toggle source
#

report_whether_a_build_directory_will_be_used_for_this_program

#
# File lib/rbt/compile/show_and_report.rb, line 324
def report_whether_a_build_directory_will_be_used_for_this_program
  opnn; e 'Will a '+teal('build directory')+' be used for the program '+
           sfancy(compile_which_program?)+'? '+
           simp(
             verbose_truth(use_build_directory?).delete('.')
           )+'.'
end
report_whether_colours_will_be_used() click to toggle source
#

report_whether_colours_will_be_used

#
# File lib/rbt/compile/colours.rb, line 74
def report_whether_colours_will_be_used
  e 'Will we use colours: '+
    royalblue(
      verbose_truth?(use_colours?)
    )
end
report_whether_porg_is_available() click to toggle source
#

report_whether_porg_is_available

#
# File lib/rbt/compile/misc.rb, line 351
def report_whether_porg_is_available
  e 'Is porg available? '+
    sfancy(verbose_truth(is_porg_available?))
end
report_whether_this_program_is_included_or_whether_it_is_not( i = program? ) click to toggle source
#

report_whether_this_program_is_included_or_whether_it_is_not

#
# File lib/rbt/compile/misc.rb, line 952
def report_whether_this_program_is_included_or_whether_it_is_not(
    i = program?
  )
  e teal(
    verbose_truth(
      is_this_program_included?(i, :be_quiet)
    )
  )
end
report_whether_we_are_on_gobolinux() click to toggle source
#

report_whether_we_are_on_gobolinux

To invoke this method, do:

rbt --is-on-gobolinux?
#
# File lib/rbt/compile/gobolinux.rb, line 72
def report_whether_we_are_on_gobolinux
  opnn; e 'Are we on GoboLinux: '+
           royalblue(
             verbose_truth(is_on_gobolinux?.to_s)
           )
end
report_whether_we_will_use_porg() click to toggle source
#

report_whether_we_will_use_porg

To invoke this method, issue:

ry --use-porg?
#
# File lib/rbt/compile/porg.rb, line 71
def report_whether_we_will_use_porg
  opne "Will RBT make use of #{teal('porg')}: "\
       "#{royalblue(verbose_truth(use_porg?.to_s))}"
end
report_which_libraries_are_missing() click to toggle source
#

report_which_libraries_are_missing

Report which libraries are missing.

Invocation example:

ry --not-found
#
# File lib/rbt/compile/misc.rb, line 1476
def report_which_libraries_are_missing
   require 'rbt/utility_scripts/not_found_libraries.rb'
   RBT::NotFoundLibraries.new
end
required_dependencies?()
Alias for: required_deps_on?
required_dependencies_on?()
Alias for: required_deps_on?
required_deps()
Alias for: required_deps_on?
required_deps?()
Alias for: required_deps_on?
required_deps_on?() click to toggle source
#

required_deps_on?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 347
def required_deps_on?
  cookbook_dataset?.required_deps_on?
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::CompileBase#reset
# File lib/rbt/compile/reset.rb, line 18
def reset
  super()
  @namespace = NAMESPACE
  disable_colours unless RBT.use_colours?
  RBT::Errors::MapLineToASpecificError.reset
  # ======================================================================= #
  # Following comes the main Hash that keeps internal data.
  # ======================================================================= #
  @internal_hash = {}
  add_default_dataset_to_the_internal_hash
  # ======================================================================= #
  # Next, prepare the stage for recording-problems. No problems are
  # known initially, on startup. That method call mMust come after
  # the internal Hash has been created.
  # ======================================================================= #
  clear_problems
  initialize_default_values
  set_cflags { :be_silent } # <- Initialize the CLFAGS here.
end
reset_compiled_n_times_counter() click to toggle source
#

reset_compiled_n_times_counter

#
# File lib/rbt/compile/reset.rb, line 415
def reset_compiled_n_times_counter
  @internal_hash[:we_tried_to_compile_this_program_n_times] = 0
end
reset_error_map_line_to_a_specific_error() click to toggle source
#

reset_error_map_line_to_a_specific_error

#
# File lib/rbt/compile/reset.rb, line 422
def reset_error_map_line_to_a_specific_error
  RBT::Errors::MapLineToASpecificError.clear
end
reset_internal_hash()
reset_the_status_file() click to toggle source
#

reset_the_status_file

This method will clear the status.yml file, aka re-set it to zero.

To invoke this method, do:

rbt --reset-the-status-file
#
# File lib/rbt/compile/misc.rb, line 3016
def reset_the_status_file
  this_file = FILE_STATUS
  dataset = {}
  dataset['currently_compiling_these_programs'] = []
  write_what_into(YAML.dump(dataset), this_file)
end
return_alias_name_for(i) click to toggle source
#

return_alias_name_for

#
# File lib/rbt/compile/misc.rb, line 496
def return_alias_name_for(i)
  ::RBT::Cookbooks::Aliases.new(i).result?
end
return_appdir_prefix( i = compile_which_program?, use_this_program_version = :default )
Alias for: appdir_prefix?
return_blfs_page_of_this_program(i) click to toggle source
#

return_blfs_page_of_this_program

#
# File lib/rbt/compile/misc.rb, line 2790
def return_blfs_page_of_this_program(i)
  RBT.return_blfs_page_of_this_program(i)
end
return_chained_programs() click to toggle source
#

return_chained_programs

#
# File lib/rbt/compile/misc.rb, line 1028
def return_chained_programs 
  RBT.return_chained_programs
end
return_compile_time_statistics() click to toggle source
#

return_compile_time_statistics

#
# File lib/rbt/compile/time.rb, line 174
def return_compile_time_statistics
  _ = RBT.file_storing_the_time_it_took_to_compile_programs
  if File.exist? _
    dataset = YAML.load_file(_)
    return dataset
  end
end
return_default_configure_command() click to toggle source
#

return_default_configure_command

#
# File lib/rbt/compile/configure.rb, line 44
def return_default_configure_command
  "configure --prefix=#{use_this_prefix?.to_s}"
end
return_default_hash_to_be_passed_into_colour_make( optional_input = nil ) click to toggle source
#

return_default_hash_to_be_passed_into_colour_make

#
# File lib/rbt/compile/misc.rb, line 31
def return_default_hash_to_be_passed_into_colour_make(
    optional_input = nil
  )
  hash = {
    use_this_make_command:            use_which_make_command?,
    append_these_options:             parameters_to_make?,
    run_make:                         run_make?,
    run_make_install:                 run_make_install?,
    use_porg:                         use_porg?,
    program_name_and_program_version: program_name_and_program_version?
  }
  if optional_input
    hash.update(optional_input)
  end
  hash 
end
return_default_internal_hash()
Alias for: internal_hash?
return_full_configure_command()
return_games()
return_games_components() click to toggle source
#

return_games_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/compile/games.rb, line 19
def return_games_components
  RBT.require 'rbt/toplevel_methods/games.rb'
end
Also aliased as: return_games
return_gem_install_options() click to toggle source
#

return_gem_install_options

#
# File lib/rbt/compile/ruby.rb, line 108
def return_gem_install_options
  _ = "#{RBT_YAML_DIRECTORY}ruby_gem_install_options.yml"
  if File.exist? _
    YAML.load_file(_).strip
  else
    ''
  end
end
return_gnome()
return_gnome1() click to toggle source
#

return_gnome1

#
# File lib/rbt/compile/gnome.rb, line 30
def return_gnome1
  string = return_chained_programs['gnome1']
  array = string.split(',').map(&:strip)
  return array
end
return_gnome2() click to toggle source
#

return_gnome2

#
# File lib/rbt/compile/gnome.rb, line 39
def return_gnome2
  string = return_chained_programs['gnome2']
  array = string.split(',').map(&:strip)
  return array
end
return_gnome3() click to toggle source
#

return_gnome3

#
# File lib/rbt/compile/gnome.rb, line 48
def return_gnome3
  string = return_chained_programs['gnome3']
  array = string.split(',').map(&:strip)
  return array
end
return_gnome4() click to toggle source
#

return_gnome4

#
# File lib/rbt/compile/gnome.rb, line 57
def return_gnome4
  string = return_chained_programs['gnome4']
  array = string.split(',').map(&:strip)
  return array
end
return_gnome5() click to toggle source
#

return_gnome5

#
# File lib/rbt/compile/gnome.rb, line 66
def return_gnome5
  string = return_chained_programs['gnome5']
  array = string.split(',').map(&:strip)
  return array
end
return_gnome_components() click to toggle source
#

return_gnome_components

This method will conveniently return the Array holding all programs that belong to the Gnome stack.

#
# File lib/rbt/compile/gnome.rb, line 17
def return_gnome_components
  array  = return_gnome1
  array << return_gnome2
  array << return_gnome3
  array << return_gnome4
  array << return_gnome5
  array.flatten!
  return array
end
Also aliased as: return_gnome
return_hash_for_the_postinstallation_step( optional_rbt_compile_object = nil ) click to toggle source
#

return_hash_for_the_postinstallation_step

This method will return a Hash that can be used as the main initializer for class RBT::PostinstallationStep.

The method accepts an argument (optional). That argument should be an instance of RBT::Compile, if it is provided. If provided we will fetch our information from that instance, rather than from the default internal one.

#
# File lib/rbt/compile/misc.rb, line 848
def return_hash_for_the_postinstallation_step(
    optional_rbt_compile_object = nil
  )
  # ======================================================================= #
  # First we will setup some local variables that will be returned
  # via the Hash.
  # ======================================================================= #
  register_the_program_or_do_not_register_the_program = false
  shall_we_run_fetch_all_m4_macros = true
  shall_we_invoke_symlink_program = false
  shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = false
  if optional_rbt_compile_object
    if optional_rbt_compile_object.continue_after_make_step? and
       optional_rbt_compile_object.make_install_stage_was_a_success? and
       optional_rbt_compile_object.no_error_has_occurred?
      register_the_program_or_do_not_register_the_program = true
    end
    if optional_rbt_compile_object.do_not_symlink?
      shall_we_run_fetch_all_m4_macros = false
    elsif !optional_rbt_compile_object.continue_after_make_step?
      shall_we_run_fetch_all_m4_macros = false
    end
    if optional_rbt_compile_object.continue_after_make_step? and
       optional_rbt_compile_object.make_install_stage_was_a_success?
      # ===================================================================== #
      # if i.include? '-' # Added this as of Jul 2014.
      #   i = i.to_s.delete('-')
      # end # ^^^ Disabled as of Sep 2017. We would have to go about
      # this via some central configuration option in RBT, rather
      # than an ad-hoc hack such as the above.
      # ===================================================================== #
      shall_we_invoke_symlink_program = true
    end unless optional_rbt_compile_object.do_not_symlink?
    if optional_rbt_compile_object.symlink_headers_into_usr_include_hierarchy? and
       optional_rbt_compile_object.uses_an_appdir_prefix? and
       File.directory?(optional_rbt_compile_object.real_prefix?.to_s+'include/') and
       !Dir["#{optional_rbt_compile_object.real_prefix?}include/**.h"].empty?
      shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true
    end
  else
    if continue_after_make_step? and
       make_install_stage_was_a_success? and
       no_error_has_occurred?
      register_the_program_or_do_not_register_the_program = true
    end
    if do_not_symlink?
      shall_we_run_fetch_all_m4_macros = false
    elsif !continue_after_make_step?
      shall_we_run_fetch_all_m4_macros = false
    end
    if continue_after_make_step? and
       make_install_stage_was_a_success?
      # ===================================================================== #
      # if i.include? '-' # Added this as of Jul 2014.
      #   i = i.to_s.delete('-')
      # end # ^^^ Disabled as of Sep 2017. We would have to go about
      # this via some central configuration option in RBT, rather
      # than an ad-hoc hack such as the above.
      # ===================================================================== #
      shall_we_invoke_symlink_program = true
    end unless do_not_symlink?
    if symlink_headers_into_usr_include_hierarchy? and
       uses_an_appdir_prefix? and
       File.directory?(real_prefix?.to_s+'include/') and
       !Dir["#{real_prefix?}include/**.h"].empty?
      shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true
    end
  end
  hash = {
    compile_which_program:            compile_which_program?,
    use_this_prefix:                  real_prefix?.to_s,
    dataset_to_use:                   cookbook_dataset?,
    use_tags:                         use_tags?,
    full_configure_command:           full_configure_command?,
    do_register_the_program:          register_the_program_or_do_not_register_the_program,
    do_run_fetch_all_m4_macros:       shall_we_run_fetch_all_m4_macros,
    shall_we_invoke_symlink_program:  shall_we_invoke_symlink_program,
    install_only_binaries:            install_only_binaries?,
    use_gobolinux_symlinkprogram:     use_gobolinux_symlinkprogram?,
    delete_libtool_files:             delete_libtool_files?,
    symlink_into_usr_lib_dir:         symlink_into_usr_lib_dir?,
    postinstall:                      postinstall?,
    shall_we_symlink_the_header_files_into_the_usr_include_hierarchy: shall_we_symlink_the_header_files_into_the_usr_include_hierarchy
  }
  return hash
end
return_kde5_applications() click to toggle source
#

return_kde5_applications

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/compile/kde.rb, line 43
def return_kde5_applications
  result = return_chained_programs['kde5_applications']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
return_kde5_foundation() click to toggle source
#

return_kde5_foundation

This method will return the Array of programs that constitute the KDE5 foundation.

#
# File lib/rbt/compile/kde.rb, line 186
def return_kde5_foundation
  result = return_chained_programs['kde5_foundation']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
return_kde5_plasma() click to toggle source
#

return_kde5_plasma

This method will return all KDE5 plasma components, via an Array. Whenever you need to obtain all KDE5-plasma components, you should use only this method.

In September 2018 there were 45 registered KDE5 plasma components.

#
# File lib/rbt/compile/kde.rb, line 68
def return_kde5_plasma
  result = return_chained_programs['kde5_plasma']
  if result.is_a? String
    result = result.split(',')
  end
  result.map!(&:strip)
  return result
end
Also aliased as: return_kde_plasma_components
return_kde5_porting_aids() click to toggle source
#

return_kde5_porting_aids

Invoke this method like so:

ry --batch-compile=kde5_porting_aids
#
# File lib/rbt/compile/kde.rb, line 172
def return_kde5_porting_aids
  result = return_chained_programs['kde5_porting_aids']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
Also aliased as: portingaids, return_porting_aids
return_kde_plasma_components()
Alias for: return_kde5_plasma
return_last_configure_command() click to toggle source
#

return_last_configure_command

#
# File lib/rbt/compile/configure.rb, line 380
def return_last_configure_command
  hash = compiled_programs? # The full dataset is assigned here.
  last_key = hash.keys.last # Grab the last key.
  dataset = hash[last_key]  # Now we have obtained the dataset.
  full_configure_command = dataset['full_configure_command']
  return full_configure_command
end
return_lxqt_components() click to toggle source
#

return_lxqt_components

This method will conveniently return the Array holding all programs that belong to the LX-QT pool.

#
# File lib/rbt/compile/lxqt.rb, line 32
def return_lxqt_components
  result = return_chained_programs['lxqt']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
return_lxqt_desktop_components()
return_mate_applications()
return_mate_desktop_components() click to toggle source
#

return_mate_desktop_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/compile/mate_desktop.rb, line 101
def return_mate_desktop_components
  result = return_chained_programs['all_of_the_mate_desktop']
  result = result.split(',') if result.is_a?(String) and result.include?(',')
  result.map!(&:strip)
  return result
end
Also aliased as: return_mate_applications
return_md5(this_file) click to toggle source
#

return_md5

md5sum support via this method. It will make use of the class Md5sum.

#
# File lib/rbt/compile/misc.rb, line 2712
def return_md5(this_file)
  _ = Md5sum.new(this_file, :dont_run_yet) # bl $RUBY_SRC/md5sum/lib/md5sum/md5sum.rb
  return _.return_md5sum(this_file)
end
return_n_processors()
return_n_processors_of_this_computer() click to toggle source
#

return_n_processors_of_this_computer

This method will return how many processors this computer has. This can then be used to automatically determine the maximum option given to the “make” binary.

#
# File lib/rbt/compile/misc.rb, line 3403
def return_n_processors_of_this_computer
  _ = FILE_CPUINFO
  if File.exist? _
    selected_dataset = File.readlines(_).select {|line|
      line.start_with? 'processor'
    }
    selected_dataset.size
  else
    0
  end
end
Also aliased as: return_n_processors
return_non_traditional_prefix( i = compile_which_program?, use_this_program_version = :default )
Alias for: appdir_prefix?
return_porting_aids()
return_possible_abbreviation_to_this_input(i) click to toggle source
#

return_possible_abbreviation_to_this_input

This method will return an abbreviation to a given input.

#
# File lib/rbt/compile/misc.rb, line 657
def return_possible_abbreviation_to_this_input(i)
  # ======================================================================= #
  # If the cookbooks-project already includes the given input at hand
  # then we do not have to do anything else.
  # ======================================================================= #
  is_the_program_included = cookbooks_include_this_program? i
  unless is_the_program_included
    # =================================================================== #
    # We have to do another check, this time including the abbreviations.
    # =================================================================== #
    is_the_program_included = cookbooks_include_this_program?(
      i, :with_abbreviations
    )
    if is_the_program_included
      abbreviation_points_to = abbreviations?[i]
      unless abbreviation_points_to == i
        # =============================================================== #
        # Notify the user that we will "re-write" the original input
        # in this case.
        # =============================================================== #
        opnn; e "The given input #{sfancy(i)} could not be "\
                "found, but an abbreviation"
        opnn; e "was found, which is now used as the new name: "\
                "#{mediumspringgreen(abbreviation_points_to)}"
        i = abbreviation_points_to.to_s.delete('_').dup
        set_is_an_abbreviation
      end
    end
  end
  return i
end
return_program_name_then_hyphen_then_the_program_version() click to toggle source
#

return_program_name_then_hyphen_then_the_program_version

#
# File lib/rbt/compile/misc.rb, line 510
def return_program_name_then_hyphen_then_the_program_version
  "#{compile_which_program?.to_s}-#{program_version?}"
end
return_proper_prefix()
Alias for: prefix?
return_proper_prefix?()
Alias for: prefix?
return_random_program() click to toggle source
#

return_random_program

#
# File lib/rbt/compile/misc.rb, line 2848
def return_random_program
  return_available_programs.sample
end
return_xfce()
return_xfce_components() click to toggle source
#

return_xfce_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/compile/xfce.rb, line 47
def return_xfce_components
  result = RBT.return_chained_programs['xfce']
  result = result.split(',') if result.is_a?(String) and result.include?(',')
  result.map!(&:strip)
  return result
end
Also aliased as: return_xfce
return_xorg()
return_xorg_apps() click to toggle source
#

return_xorg_apps

#
# File lib/rbt/compile/xorg.rb, line 122
def return_xorg_apps
  result = return_chained_programs['xorg_apps']
  result = result.split(',') if result.include? ','
  result.map!(&:strip)
  return result
end
return_xorg_components() click to toggle source
#

return_xorg_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/compile/xorg.rb, line 77
def return_xorg_components
  array  = return_xorg_protos
  array << return_xorg_utils
  array << return_xorg_libraries
  array << return_xorg_data
  array << return_xorg_apps
  array << return_xorg_fonts
  array << return_xorg_server
  array.flatten!
  return array
end
Also aliased as: return_xorg
return_xorg_data() click to toggle source
#

return_xorg_data

#
# File lib/rbt/compile/xorg.rb, line 112
def return_xorg_data
  result = return_chained_programs['xorg_data']
  result = result.split(',') if result.include? ','
  result.map!(&:strip)
  return result
end
return_xorg_fonts() click to toggle source
#

return_xorg_fonts

#
# File lib/rbt/compile/xorg.rb, line 132
def return_xorg_fonts
  result = return_chained_programs['xorg_fonts']
  result = result.split(',') if result.include? ','
  result.map!(&:strip)
  return result
end
return_xorg_libraries() click to toggle source
#

return_xorg_libraries

#
# File lib/rbt/compile/xorg.rb, line 102
def return_xorg_libraries
  result = return_chained_programs['xorg_libraries']
  result = result.split(',') if result.include? ','
  result.map!(&:strip)
  return result
end
return_xorg_protos() click to toggle source
#

return_xorg_protos

#
# File lib/rbt/compile/xorg.rb, line 92
def return_xorg_protos
  result = return_chained_programs['xorg_protos']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
return_xorg_server() click to toggle source
#

return_xorg_server

#
# File lib/rbt/compile/xorg.rb, line 142
def return_xorg_server
  result = return_chained_programs['xorg_server']
  result = result.split(',') if result.include? ','
  result.map!(&:strip)
  return result
end
return_xorg_utils() click to toggle source
#

return_xorg_utils

#
# File lib/rbt/compile/xorg.rb, line 64
def return_xorg_utils
  result = return_chained_programs['xorg_utils']
  result = result.split(',') if result.is_a? String
  result.map!(&:strip)
  return result
end
reuse_old_configure_options( use_this_program = compile_which_program? ) click to toggle source
#

reuse_old_configure_options

This method currently works only with the target program being GCC.

Perhaps it may be extended for other programs one day.

Invocation examples:

ry gcc --copy-old-version
ry gcc --use-this-version=7.1.0 --use-old-configure-options
#
# File lib/rbt/compile/misc.rb, line 407
def reuse_old_configure_options(
    use_this_program = compile_which_program?
  )
  _ = `#{use_this_program} -v 2>&1`
  options = _.scan(/^Configured .+/).first.
              sub(/^Configured with:/,'').
              sub(/\.\.\/configure /,''). 
              strip
  opne "Re-using the old configure option, which "\
       "was `#{sfancy(options)}`."
  if options.include? programs_directory?
    # ===================================================================== #
    # Next, replace the oldprefix.
    # ===================================================================== #
    programs_dir = Regexp.quote(programs_directory?)
    if dataset?.nil?
      ensure_that_the_default_dataset_exists_for_this_program(use_this_program)
    end
    if @internal_hash[:use_this_specific_program_version]
      dataset?.set_program_version(@internal_hash[:use_this_specific_program_version])
      dataset?.reassemble_program_path
    end
    regex_to_use = /(--prefix=#{programs_dir}Gcc\/\d{1,2}\.\d{1,2}\.\d{1,2})/
    options.sub!(regex_to_use, '--prefix='+return_appdir_prefix)
    options.squeeze!('/')
    # ===================================================================== #
    # Now, simply use that as configure version.
    # ===================================================================== #
    extract_to_default_directory
    set_configure_base_directory
    cd_to_the_configure_base_directory
    run_preinstall_sed_and_currently_being_compiled
    consider_creating_the_build_directory
    e "These are the #{orange('options')} that will be used:"
    e
    e "  #{simp(options)}"
    e
    set_configure_options(options)
    run_configure_make_and_make_install_with_this_configure_line(options)
    run_all_actions_after_the_make_install_step
    exit_program
  end
end
Also aliased as: use_old_configure_options
ruby_setup_config() click to toggle source
#

ruby_setup_config

#
# File lib/rbt/compile/ruby.rb, line 57
def ruby_setup_config
  system 'ruby setup.rb --quiet config'
end
ruby_setup_install() click to toggle source
#

ruby_setup_install

#
# File lib/rbt/compile/ruby.rb, line 71
def ruby_setup_install
  system 'ruby setup.rb --quiet install'
end
ruby_setup_setup() click to toggle source
#

ruby_setup_setup

#
# File lib/rbt/compile/ruby.rb, line 64
def ruby_setup_setup
  system 'ruby setup.rb --quiet setup'
end
run() click to toggle source
#

run

#
# File lib/rbt/compile/run.rb, line 38
def run
  # ======================================================================= #
  # We must always ensure that the log_directory exists.
  # ======================================================================= #
  ensure_that_the_log_directory_exists
  menu # <- Pass into the menu().
  # ======================================================================= #
  # After the menu() interface has been invoked, we can proceed to
  # compile every program.
  # ======================================================================= #
  batch_compile_the_programs
  # $stdout = @original_stdout if @original_stdout
  # ^^^ Have to re-think the above.
end
run_cmake_command() click to toggle source
#

run_cmake_command

Run the corresponding “cmake” command.

#
# File lib/rbt/compile/cmake.rb, line 60
def run_cmake_command
  cmd = ''.dup
  cmd << "cmake -DCMAKE_INSTALL_PREFIX=#{prefix?}"
  if use_configure_options?
    configure_options = configure_options?.dup
    if configure_options and !configure_options.empty?
      # =================================================================== #
      # Append additional commands to the configure-string:
      # =================================================================== #
      cmd << " #{configure_options}"
    end
  end
  cmd << ' '
  # ======================================================================= #
  # Next we have to keep the relative path in mind, which is why we
  # will simply append the configure base directory next.
  # ======================================================================= #
  cmd << configure_base_dir?
  # ======================================================================= #
  # === Check for more than one -DCMAKE_INSTALL_PREFIX entry next
  # ======================================================================= #
  if cmd.scan(/-DCMAKE_INSTALL_PREFIX=\//).size > 1
    # ===================================================================== #
    # In this case, something must be wrong. Notify the user about it.
    # ===================================================================== #
    opnewarn "There are at the least two definitions of "\
             "#{royalblue('-DCMAKE_INSTALL_PREFIX=')}"
    opnewarn 'One of them must be incorrect and/or superfluous. Please correct'
    opnewarn 'this logic-problem because RBT can continue to work.'
    e
    e 'See:'
    e
    e "  #{sfancy(cmd)}"
    e
    exit_program
  end
  opnn; e 'Next running'
  e
  e "  #{sfancy(cmd)}"
  e
  cmd.strip!
  reset_error_map_line_to_a_specific_error
  set_full_configure_command(cmd)
  # ======================================================================= #
  # We should check whether cmake exists on the host system or whether
  # it does not.
  # ======================================================================= #
  if cmake_exists?
    run_this_sys_command cmd # <- Run the sys-command here.
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
  else
    opnn; e "The program #{sfancy('cmake')} could not "\
            "be found, thus we can not"
    opnn; e 'compile the program called `'+
             orange(compile_which_program?)+'`.'
    we_can_not_continue
  end
end
run_cmake_then_make_then_make_install() click to toggle source
#

run_cmake_then_make_then_make_install

Just a convenience method to run “cmake”, then “make” and then “make install”.

#
# File lib/rbt/compile/cmake.rb, line 25
def run_cmake_then_make_then_make_install
  run_cmake_command
  run_make
  run_make_install
end
run_configure( use_these_configure_options = nil )
run_configure?()
run_configure_make_and_make_install_with_this_configure_line(i) click to toggle source
#

run_configure_make_and_make_install_with_this_configure_line

#
# File lib/rbt/compile/misc.rb, line 1516
def run_configure_make_and_make_install_with_this_configure_line(i)
  run_configure_via_system(i)
  run_make
  run_make_install
end
run_configure_script?() click to toggle source
#

run_configure_script?

Determine whether we will invoke “./configure” or whether we will not.

#
# File lib/rbt/compile/configure.rb, line 222
def run_configure_script?
  _ = @internal_hash[:run_configure_script]
  # ======================================================================= #
  # Next, fetch the entry that exists in the cookbook-dataset, and use
  # it in this case.
  # ======================================================================= #
  if _.nil? and !cookbook_dataset_run_configure_script?.nil?
    _ = cookbook_dataset_run_configure_script?
  end
  _
end
Also aliased as: run_configure?
run_configure_then_make_then_make_install() click to toggle source
#

run_configure_then_make_then_make_install

#
# File lib/rbt/compile/run.rb, line 18
def run_configure_then_make_then_make_install
  # ======================================================================= #
  # (7) Run the "configure" command or its equivalent:
  # ======================================================================= #
  run_the_configure_command
  if run_make?
    # ===================================================================== #
    # (8) Run the "make" command or its equivalent:
    # ===================================================================== #
    run_make_command
    # ===================================================================== #
    # (9) Run the "make install" command or its equivalent:
    # ===================================================================== #
    run_make_install_command
  end
end
run_configure_via_system( use_these_configure_options = nil )
run_ldconfig?() click to toggle source
#

run_ldconfig?

#
# File lib/rbt/compile/ldconfig.rb, line 14
def run_ldconfig?
  RBT.configuration?.run_ldconfig
end
run_make()
Alias for: run_make_command
run_make?() click to toggle source
#

run_make?

#
# File lib/rbt/compile/make.rb, line 16
def run_make?
  _ = cookbook_dataset_run_make?
  unless @internal_hash[:run_make_command].nil?
    _ = @internal_hash[:run_make_command]
  end
  _
end
run_make_and_make_install_command()
run_make_command() click to toggle source
#

run_make_command (make tag, Makefile tag)

This method will, in the end, delegate towards RBT.colour_make, which in turn runs the command/binary called “make”.

The specific command, in this case “make”, can also be a different one, as defined by the respective .yml file for the given program at hand.

The method will also have to ensure that a Makefile-file exists, but only for installation types that do happen to require a Makefile.

Some build systems, such as meson/ninja, may use 'make', but may also skip it and do “ninja install” instead.

#
# File lib/rbt/compile/make.rb, line 40
def run_make_command
  if exit_before_make?
    opne 'Exiting now as instructed before reaching '\
         'the "'+orange('make')+'" stage.'
    exit_program
  end
  if modify_the_makefile?
    opnn; e 'The Makefile will be modified next (PREFIX value will be changed).'
    do_use_this_makefile_here = return_pwd+'Makefile'
    RBT::ChangePrefix.new(
      use_this_makefile:          do_use_this_makefile_here,
      use_this_as_the_new_prefix: prefix?.to_s.dup
    )
  end
  if run_make?
    # ===================================================================== #
    # Clear the old buffer first:
    # ===================================================================== #
    reset_error_map_line_to_a_specific_error
    # ===================================================================== #
    # "make" is usually used, but we may also make use of "ninja" instead,
    # so we have to pass in this option towards RBT.colour_make.
    # ===================================================================== #
    if run_simulation?
      opne 'We are running a simulation, hence the following command'
      opne 'will not be run:'
      opn; efancy "  #{make_command?}"
    else
      if has_to_be_compiled?
        consider_using_maximum_speed_for_compilation
      end
      # =================================================================== #
      # We will have to make a cd-operation to the configure base directory
      # if run_configure is no/false and if we use a build directory.
      # This, however had, breaks cmake builds, so it was disabled in
      # February 2019. It may have to be changed at a later time
      # anyway.
      # =================================================================== #
      # if !run_configure? and use_build_directory?
      #   cd_to_the_configure_base_directory
      # end
      # =================================================================== #
      # Next consider running pre-make commands - but this must come
      # AFTER running GNU configure and similar build-style runs.
      # =================================================================== #
      consider_running_premake_instructions
      unless installation_steps?.empty?
        installation_steps?.each {|this_step|
          opnn; e "Next doing this step: #{sfancy(this_step)}"
          esystem this_step
        }
      end
      # =================================================================== #
      # Delegate towards RBT.colour_make next:
      # =================================================================== #
      RBT.colour_make { return_default_hash_to_be_passed_into_colour_make }
    end
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
    if automatically_create_package?
      if is_on_slackware?
        # ================================================================= #
        # Create a slackware-package in this case.
        # ================================================================= #
        opne 'Next trying to create a package for `'+royalblue('slackware')+'`.'
        # The following subsection is incomplete. The path could be used
        # to find out whether things are put in their right position.
        # path = create_slackware_description_file
        RBT.run_makepkg_command(compile_which_program?, program_version?)
      end
    end
  end
end
run_make_install()
run_make_install?() click to toggle source
#

run_make_install?

Query whether we will do the “make install” step or whether we will not. Will return a boolean value (true/false).

#
# File lib/rbt/compile/make_install.rb, line 17
def run_make_install?
  @internal_hash[:run_make_install]
end
run_make_install_command() click to toggle source
#

run_make_install_command

This method will ultimately default to run something such as “make install”. Note that some programs do not use “make install” and instead use something such as “ninja install”.

The method here thus has to remain somewhat flexible, in order to install such programs as well.

#
# File lib/rbt/compile/make_install.rb, line 31
def run_make_install_command
  # ======================================================================= #
  # Do not try to compile via make, if it does not have to be compiled.
  # ======================================================================= #
  return unless has_to_be_compiled?
  unless pre_make_install_sed.empty?
    pre_make_install_sed.each {|sed_instruction|
      run_this_sed_instruction(sed_instruction)
    }
  end
  if exit_before_make_install?
    opne 'Exiting now as instructed before reaching '\
         'the "'+orange('make install')+'" stage.'
    exit_program
  end
  if run_make_install?
    # ===================================================================== #
    # Clear the old buffer keeping track of our errors first:
    # ===================================================================== #
    reset_error_map_line_to_a_specific_error
    use_this_make_command = use_this_make_command?
    if use_this_make_install_command?
      # =================================================================== #
      # In this case we will use that make-install command instead.
      # =================================================================== #
      use_this_make_command = use_this_make_install_command?
    end
    use_porg = false
    if use_porg?
      if porg_is_available?
        use_porg = true
      else
        # ================================================================= #
        # Notify the user that porg is NOT available. We will continue
        # anyway, though.
        # ================================================================= #
        notify_the_user_that_porg_is_not_available
      end
    end
    if use_stow?
      RBT.colour_make_install {
        return_default_hash_to_be_passed_into_colour_make(
          append: " DESTDIR=/stow/#{compile_which_program?} install",
          porg:                  use_porg,
          use_this_make_command: use_this_make_command
        )
      }
    else
      RBT.colour_make_install {
        return_default_hash_to_be_passed_into_colour_make(
          porg:                  use_porg,
          use_this_make_command: use_this_make_command
        )
      }
    end
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
    if an_error_has_occurred?
      # =================================================================== #
      # Register that this step led to an error in this case.
      # =================================================================== #
      @internal_hash[:make_install_stage_was_a_success] = false
    end
    if !run_configure? and use_build_directory?
      cd_to_the_build_directory
    end
  end
end
run_make_then_make_install() click to toggle source
#

run_make_then_make_install

Run “make” and “make install” command here.

#
# File lib/rbt/compile/make.rb, line 320
def run_make_then_make_install
  run_make_command
  run_make_install_command
end
run_ninja()
Alias for: ninja_install
run_postinstall_actions?() click to toggle source
#

run_postinstall_actions?

We will default to the cookbook dataset - but this will be overruled if there is a corresponding entry in the @internal_hash variable.

#
# File lib/rbt/compile/postinstallation_step.rb, line 21
def run_postinstall_actions?
  _ = cookbook_dataset_postinstall?
  unless @internal_hash[:run_postinstall_actions].nil?
    _ = @internal_hash[:run_postinstall_actions]
  end
  _
end
Also aliased as: run_postinstall_steps?
run_postinstall_steps?()
run_preinstall_actions() click to toggle source
#

run_preinstall_actions

These actions will be run before anything else.

An example for such a preinstall action may be the following:

if is_on_32_bit_system?
  sed -r "/ifeq.*CompilerTargetArch/s#i386#i686#g" -i projects/compiler-rt/make/platform/clang_linux.mk
#
# File lib/rbt/compile/preinstall.rb, line 22
def run_preinstall_actions
  unless cookbook_dataset_preinstall?.empty?
    # ===================================================================== #
    # Next we have to handle preinstall-actions. This should typically
    # be an Array.
    # ===================================================================== #
    _ = cookbook_dataset_preinstall?
    # ===================================================================== #
    # Next output that we are doing pre-installation things, but only do
    # so IF we really do so.
    # ===================================================================== #
    first = _.first
    unless first.start_with?('if ') and (first == 'if is_on_32_bit_system?')
      cliner {
        opnn; e "Doing preinstallation actions next, from the directory "
        opnn; e "`#{sdir(return_pwd)}`:"
      }
    end
    if first.start_with? 'if ' # Ok, we assume this to be an if-conditional clause.
      case first # case tag
      when 'if is_on_32_bit_system?'
        if is_on_32_bit_system? # Ok, we are on a 32 bit system.
          _.shift
          unless _.empty?
            _ = _.first
            opnn; e 'A pre-installation instruction was found, '\
                    'which will be run next (from the directory '+sdir_return_pwd+').'
            opnn; esystem _
          end
        end
      end
    else
      opnn
      if _.is_a? Array
        _.each {|entry|
          e sfancy(entry)
          system(entry)
        }
      else
        e sfancy(_)
        system(_)
      end
    end
  end
end
run_preinstall_sed_and_currently_being_compiled() click to toggle source
#

run_preinstall_sed_and_currently_being_compiled

#
# File lib/rbt/compile/misc.rb, line 1532
def run_preinstall_sed_and_currently_being_compiled
  run_preinstall_actions
  check_for_sed_action
  register_that_this_program_is_currently_being_compiled
end
run_premake_commands( array = cookbook_dataset_pre_make_commands? ) click to toggle source
#

run_premake_commands

Here we try to run the premake commands, in case they exist.

If there are no pre_make_commands, then we will not do anything, as our array will be empty.

This method is normally run from do_compile_this_program(), via a call to its alias name consider_running_premake_instruction().

#
# File lib/rbt/compile/make.rb, line 209
def run_premake_commands(
    array = cookbook_dataset_pre_make_commands?
  )
  unless array.empty?
    opne "#{sfancy('Doing pre_make_commands next from ')}"\
         "#{sdir_return_pwd}#{sfancy('.')}"
    array.each { |cmd|
      opnn
      e "In the directory #{sdir_return_pwd}, doing the following command next:"
      e
      e "  #{slateblue(cmd)}"
      e
      e 'next.'
      custom_system(cmd)
    }
  end
end
run_python_install( i = 'setup.py' )
run_python_install1() click to toggle source
#

run_python_install1

#
# File lib/rbt/compile/python.rb, line 286
def run_python_install1
  dataset = YAML.load_file(FILE_PREDEFINED_INSTALLATION_INSTRUCTIONS)['PINSTALL1']
  if dataset.is_a?(String) and dataset.include?(';')
    dataset.split(';').each {|this_command|
      _ = this_command.strip
      e _
      run_this_sys_command(_)
    }
  end
end
run_python_install2() click to toggle source
#

run_python_install2

#
# File lib/rbt/compile/python.rb, line 300
def run_python_install2
  dataset = YAML.load_file(FILE_PREDEFINED_INSTALLATION_INSTRUCTIONS)['PINSTALL2']
  if dataset.is_a?(String) and dataset.include?(';')
    dataset.split(';').each {|this_command|
      _ = this_command.strip
      e _
      run_this_sys_command(_)
    }
  end
end
run_python_installation( i = 'setup.py' ) click to toggle source
#

run_python_installation

You should check whether setup.py exists prior to invoking this method here.

You can also pass in another file, such as configure.py. By default, the method will make use of a file called “setup.py”, though.

#
# File lib/rbt/compile/python.rb, line 50
def run_python_installation(
    i = 'setup.py'
  )
  if make_options?.nil?
    _ = cookbook_dataset_make_options?
    if _ and !_.empty?
      i = _
    end
  end
  i = [i].flatten.compact
  # ======================================================================= #
  # We work on an Array here since some make_options entries also
  # specify an Array.
  # ======================================================================= #
  i.each {|do_this_action|
    case do_this_action
    when FILE_SETUP_PY # <- This is equivalent to "setup.py".
      if does_a_python_binary_exist?
        esystem "python #{do_this_action} config"
        esystem "python #{do_this_action} build"
        esystem "python #{do_this_action} install"
      else
        notify_the_user_that_no_binary_python_could_be_found
      end
    else
      run_this_command = "#{do_this_action}".dup
      if run_this_command.start_with?('python') and !run_this_command.include?('/')
        # ================================================================= #
        # This is valid for a command line such as:
        #   "python setup.py config"
        # ================================================================= #
        splitted = run_this_command.split(' ')
        splitted[1].prepend(configure_base_dir?.dup)
        run_this_command = splitted.join(' ')
      end
      unless run_this_command.start_with? 'python'
        run_this_command.prepend('python ')
      end
      if does_a_python_binary_exist?
        esystem run_this_command
      else
        notify_the_user_that_no_binary_python_could_be_found
      end
    end
  }
  consider_renaming_the_kde_konsole_tab :clear, :do_rename
end
Also aliased as: run_python_install
run_scons() click to toggle source
#

run_scons

Invoke this method here only when we wish to use scons in order to install a program.

Scons is python-related, which is why it sits here in this file.

#
# File lib/rbt/compile/python.rb, line 275
def run_scons
  _ = 'scons'.dup
  if use_build_directory?
    _.prepend('../')
  end
  esystem _
end
Also aliased as: run_scons_based_installation
run_scons_based_installation()
Alias for: run_scons
run_the_configure_command( use_these_configure_options = nil ) click to toggle source
#

run_the_configure_command

Run the “./configure” command, with an appropriate prefix to be used.

The optional argument to this method allows us to use a different set of configure-options as-is.

#
# File lib/rbt/compile/configure.rb, line 93
def run_the_configure_command(
    use_these_configure_options = nil
  )
  if run_configure_script?
    use_this_prefix = prefix?.to_s
    RBT.set_last_prefix_used(use_this_prefix)
    _ = ''.dup # <- We will start with this here.
    _ << configure_base_directory?.dup
    # ===================================================================== #
    # Add the configure-command that is to be used next:
    # ===================================================================== #
    if cookbook_dataset_configure_command?
      _ << cookbook_dataset_configure_command?.dup
    else # This else-clause is the default.
      _ << 'configure'
    end
    # ===================================================================== #
    # The following _.include? check is valid for e. g. applications
    # such as "lsof".
    # ===================================================================== #
    _ << " --prefix=#{use_this_prefix.to_s}" unless _.include? './Configure -n linux'
    # ===================================================================== #
    # === Honour ccache
    #
    # Honour the CCACHE setting, if it has been provided.
    # ===================================================================== #
    if use_ccache?
      # =================================================================== #
      # Find out whether ccache is available or whether it is not. If
      # it is we will use it, while also specifying which compiler
      # to use.
      # =================================================================== #
      if ccache_is_available?
        if will_gcc_be_used_for_compilation?
          _.prepend 'CC="ccache gcc" ' # In this case prepend it.
        end
      else # It must be available.
        notify_the_user_that_ccache_is_not_available
      end
    end
    # ===================================================================== #
    # The following two checks are necessary, due to two reasons:
    #
    # - The user may not want to append any configure-options in
    #   the first place. Hence, we must check for this via
    #   use_configure_options?.
    #
    # - Second the user may also input a command such as "ry sed-4.5",
    #   and in this case we have to work on an existing file, rather
    #   than on the dataset in the cookbook-yaml file.
    # ===================================================================== #
    if use_configure_options? and cookbooks_dataset?
      if use_these_configure_options
        configure_options = use_these_configure_options
      else
        configure_options = configure_options?.dup
      end
      if configure_options and !configure_options.empty?
        # ================================================================= #
        # Finally, append these additional commands to the
        # configure-string:
        # ================================================================= #
        _ << ' '+configure_options
      end
    end
    _.strip! # Just ensure that there are no trailing ' ' characters.
    # ===================================================================== #
    # Next, we will append the ERROR_LINE.
    # ===================================================================== #
    _ << ERROR_LINE
    # ===================================================================== #
    # === Handle strange configuration options involving sysconfdir next
    # ===================================================================== #
    if use_appdir_prefix? and _.include?('--sysconfdir=/etc')
      regexp_quoted_old_sysconfdir_prefix = Regexp.quote('--sysconfdir=/etc')
      rewritten_sysconfdir = '--sysconfdir='+rds(use_which_prefix?.to_s+'/etc')
      opne 'An '+salmon('AppDir prefix')+' is used, but also "'+
           royalblue('--sysconfdir=/etc')+'". '\
           'This is not logical.'
      opne 'It is now assumed that the --sysconfdir=/etc is meant to target'
      opne "that #{salmon('AppDir prefix')}, so it will be rewritten"
      opne "to `#{royalblue(rewritten_sysconfdir)}`."
      _.sub!(/#{regexp_quoted_old_sysconfdir_prefix}/, rewritten_sysconfdir)
    end
    set_full_configure_command(_) # <- Keep a copy too.
    # ===================================================================== #
    # Next, output the configure command that we will use - in
    # teal, but also use dodgerblue for the actual prefix.
    # ===================================================================== #
    # ===================================================================== #
    # Colourize this in dodgerblue.
    # ===================================================================== #
    if use_colours? and RBT.konsole_available?
      use_this_colour = :konsole_dodgerblue # <- dodgerblue
      cliner(use_colour: use_this_colour)
      copy_of_configure = _.dup
      if copy_of_configure.include? '--prefix='
        # ================================================================= #
        # === Colourize the prefix, in cornflowerblue().
        # ================================================================= #
        copy_of_configure.sub!(/(--prefix=)(\/.+?)\s/, # See: http://rubular.com/r/Df8OzLqXGd
          '\1'+
          cornflowerblue('\2 ')+
          dodgerblue('')
        )
      end
      # =================================================================== #
      # Display the line we will use to the user.
      # =================================================================== #
      e dodgerblue(_)
      cliner(use_colour: use_this_colour)
    else
      cliner
      e _ # Else just display the command, without any colours.
      cliner
    end
    reset_error_map_line_to_a_specific_error
    run_this_sys_command _ # <- Run the sys-command here.
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
  end
end
run_the_strip_command_on_this_input( i = :pwd ) click to toggle source
#

run_the_strip_command_on_this_input

#
# File lib/rbt/compile/strip.rb, line 169
def run_the_strip_command_on_this_input(
    i = :pwd
  )
  case i
  when :pwd
    i = Dir['*']
  end
  [i].flatten.compact.each {|this_file|
    strip_command = 'strip '+this_file.lstrip
    esystem strip_command
  }
end
run_this_sed_instruction(sed_line)
run_this_sys_command(i) click to toggle source
#

run_this_sys_command

This currently uses IO.popen. The alternatives, system() or backticks, are not as useful, in my opinion.

The current idea is to work on a line-by-line basis, and to also display what is done, so that the user has an idea what is happening.

There is also the possibility to use colours and colourize the input; this allows us to, for example, use specific colours for directories or for files or to indicate failures.

#
# File lib/rbt/compile/system.rb, line 72
def run_this_sys_command(i)
  use_colours = use_colours?
  # ======================================================================= #
  # I still do not quite understand the second argument. Either way,
  # I have determined that this works better.
  # ffmpeg = IO.popen(cmdline + " 2>&1", "w+")
  # ======================================================================= #
  if i.start_with? 'make'
    unless is_make_available?
      opne "The program \"#{sfancy('make')}\" is "\
           "#{swarn('not available')}, at the least not as  "\
           "part of the $PATH variable."
      opne "RBT::Compile thus can not compile anything. You "\
           "may want to check the #{orange('$PATH')} variable."
      do_not_continue_and_do_not_compile(:be_quiet)
      return
    end
  end
  i = i.dup if i.frozen?
  i << ' 2>&1' unless i.end_with? ' 2>&1'
  io_object = IO.popen(i, {:err => [:child, :out]}).each { |line|
    # ======================================================================= #
    # The next line will also display what has happened.
    # ======================================================================= #
    parse_this_line_obtained_via_io_popen(line, use_colours)
  }
  io_object.close
  # ======================================================================= #
  # Next, we attempt to determine what some of the errors may be and
  # perhaps even how to resolve them.
  # ======================================================================= #
  # Handle "no configure file" next.
  # ======================================================================= #
  if array_sys_command_string? and
     array_sys_command_string?.any? {|line|
      line.include? 'sh: ./configure: No such file or directory'
    }
    problem_is :no_configure_file
  # ======================================================================= #
  # Handle missing headers next.
  # ======================================================================= #
  elsif array_sys_command_string?.any? {|line|
      line.include? 'headers are missing'
    }
    _ = array_sys_command_string?.select {|line|
      line.include? 'headers are missing'
    }
    problem_is _
  end
end
run_this_system_command(i)
run_through_the_behaviour_changes() click to toggle source
#

run_through_the_behaviour_changes

We run through the module that keeps track of the behaviour changes that out to be run in class RBT::Compile.

#
# File lib/rbt/compile/misc.rb, line 2520
def run_through_the_behaviour_changes
  RBT::Errors::MapLineToASpecificError.behaviour_changes?.each {|do_this_action|
    self.send(do_this_action)
  }
end
run_through_the_erroneous_libtool_entries( i = erroneous_libtool_entries? ) click to toggle source
#

run_through_the_erroneous_libtool_entries

The first argument should be an Array; or an object that is able to respond to :each.

#
# File lib/rbt/compile/libtool.rb, line 86
def run_through_the_erroneous_libtool_entries(
    i = erroneous_libtool_entries?
  ) 
  i.each {|do_this_action|
    if is_on_roebe? and autofix?
      # =================================================================== #
      # Register this erroneous line for now - the fixing part will
      # happen at a later time. Only on roebe-systems for now, though.
      # =================================================================== #
      try_to_autocorrect_this_erroneous_libtool_entry_later(do_this_action)
    end
  }
end
run_through_the_registered_errors() click to toggle source
#

run_through_the_registered_errors

Sync the errors towards class RBT::Compile next.

#
# File lib/rbt/compile/misc.rb, line 2508
def run_through_the_registered_errors
  RBT::Errors::MapLineToASpecificError.registered_errors?.each {|do_this_action|
    error_is do_this_action
  }
end
run_through_the_registered_problems() click to toggle source
#

run_through_the_registered_problems

Sync the problems towards class RBT::Compile next.

#
# File lib/rbt/compile/misc.rb, line 2448
def run_through_the_registered_problems
  RBT::Errors::MapLineToASpecificError.registered_problems?.each {|do_this_action|
    problem_is do_this_action
  }
end
run_through_the_registered_problems_registered_errors_and_behaviour_changes() click to toggle source
#

run_through_the_registered_problems_registered_errors_and_behaviour_changes

#
# File lib/rbt/compile/misc.rb, line 3201
def run_through_the_registered_problems_registered_errors_and_behaviour_changes
  run_through_the_registered_problems
  run_through_the_registered_errors
  run_through_the_behaviour_changes
  run_through_the_erroneous_libtool_entries
  run_through_the_required_dependencies
end
run_through_the_required_dependencies() click to toggle source
#

run_through_the_required_dependencies

We have to sync the dependencies back into class RBT::Compile.

#
# File lib/rbt/compile/misc.rb, line 2437
def run_through_the_required_dependencies
  RBT::Errors::MapLineToASpecificError.required_dependency?.each {|this_array|
    register_required_dependency(this_array.first, this_array.last)
  }
end
run_waf() click to toggle source
#

run_waf

This method can be used to install a project that uses “waf” as its build system.

#
# File lib/rbt/compile/python.rb, line 248
def run_waf
  _ = 'waf'.dup
  if use_build_directory?
    _.prepend(configure_base_directory?)
  end
  # ======================================================================= #
  # Specify which subcommands to use, e. g. 'waf configure' followed by
  # 'waf build' and so forth.
  # ======================================================================= #
  run_these_subcommands = %w(
    configure
    build
    install
  )
  run_these_subcommands.each {|this_subcommand|
    esystem _+' '+this_subcommand
  }
end
Also aliased as: run_waf_based_installation
run_waf_based_installation()
Alias for: run_waf
sanitized_data()
Alias for: cookbook_dataset?
save_into_compiled_programs( store_into = FILE_COMPILED_PROGRAMS ) click to toggle source
#

save_into_compiled_programs

This method will try to save a lot of useful data into a file called “compiled_programs.yml”.

That way we can try to figure out what happened at any moment in time (hopefully).

The variable full_configure_command will store the full configure command, whereas configure_options only shows the part afterwards, such as which parts to enable or disable and so forth.

This should also store ARCH info and such.

#
# File lib/rbt/compile/misc.rb, line 2072
def save_into_compiled_programs(
    store_into = FILE_COMPILED_PROGRAMS
  )
  what  = ''.dup # Need a non-frozen String.
  what << '# --- '+program_name?+N
  what << program_name?+':'+N
  what << ' CFLAGS: '+cflags?.to_s+N
  what << ' compiled_at: '+today?.to_s+', '+current_hour?+N
  what << ' prefix: '+real_prefix?.to_s+N
  what << ' full_configure_command: '+
          full_configure_command?.to_s+N
  what << ' configure_options: '+configure_options?.to_s+N
  what << ' successfully_compiled: true/false'+N # This line here is obviously a stub.
  what << N # Extra newline - makes reading this file easier.
  append_what_into(what, store_into)
end
scan_source_archive( shall_we_exit = true ) click to toggle source
#

scan_source_archive

Scan the complete source archive.

Invocation example:

ry --scan_source_archive
#
# File lib/rbt/compile/misc.rb, line 2495
def scan_source_archive(
    shall_we_exit = true
   )
  opne 'Scanning for source Archives now.'
  RBT::Cookbooks::ScanSourceArchive.new # bl ScanSourceArchive
  exit_program if shall_we_exit
end
scons_file?()
Alias for: scons_file_exists?
scons_file_exists?() click to toggle source
#

scons_file_exists?

#
# File lib/rbt/compile/python.rb, line 101
def scons_file_exists?
  File.exist? 'SConstruct'
end
Also aliased as: scons_file?
search_for_tag( this_tag, shall_we_exit = true ) click to toggle source
#

search_for_tag (search tag)

Use this to search for a tag.

Usage example:

ry htop --tags pdf
ry htop --tags term
#
# File lib/rbt/compile/tags.rb, line 36
def search_for_tag(
    this_tag,
    shall_we_exit = true
  )
  results = RBT::Cookbooks::SearchForTags.new(this_tag)
  exit_program if shall_we_exit
  return results
end
sed?() click to toggle source
#

sed?

Query as to whether we will use sed or not.

#
# File lib/rbt/compile/sed.rb, line 99
def sed?
  _ = cookbook_dataset?.sed?
  if @internal_hash[:sed].nil?
    # ===================================================================== #
    # In this case we will use the sed-variant given by the cookbooks
    # dataset.
    # ===================================================================== #
  else
    _ = @internal_hash[:sed]
  end
  _
end
sed_binary_is_available?() click to toggle source
#

sed_binary_is_available?

Determine whether the host-system has the “sed” binary available or whether it has not.

#
# File lib/rbt/compile/sed.rb, line 126
def sed_binary_is_available?
  result = `sed 2>&1`
  result.include? 'Usage:'
end
set_archive_type(i) click to toggle source
#

set_archive_type

#
# File lib/rbt/compile/cookbook_dataset.rb, line 242
def set_archive_type(i)
  cookbook_dataset?.set_archive_type(i)
end
set_base_dir(i) click to toggle source
#

set_base_dir

#
# File lib/rbt/compile/cookbook_dataset.rb, line 546
def set_base_dir(i)
  cookbook_dataset?.set_base_dir = i
end
set_cflags( i = default_cflags?, &block ) click to toggle source
#

set_cflags (cflags tag)

This method will enable you to set i.e. new cflags. This then also allows you to compile some programs in a different manner, such as if you wish to compile that particular program statically.

The default argument to this method will be a copy of ENV.

You can overrule this via a shortcut, if you want to, by passing true as argument, or even better, a Symol such as :static. This will then allow you to perform the static build, if the program at hand allows for this.

-static-libgcc may also be an option here.

The variable LDFLAGS may be important as well.

For instance:

make LDFLAGS=-all-static
#
# File lib/rbt/compile/cflags.rb, line 34
def set_cflags(
    i = default_cflags?,
    &block
  )
  case i # case tag
  when :clear
    i = ''
  # ======================================================================= #
  # Enable static builds for the CFLAGS at hand
  # ======================================================================= #
  when :overrule_static_build,
       :static,
       :build_static,
       true
    i = '-static -O2 -g'
  end
  # ======================================================================= #
  # Do the actual assignment next.
  # ======================================================================= #
  set_this_env_variable(
    'CFLAGS: '+i.to_s,
    :do_set_these_variables,
    &block
  )
end
set_commandline(i = [])
set_commandline_arguments(i = [])
set_commandline_options(i = []) click to toggle source
#

set_commandline_options

This will be guaranteed to be an Array.

#
# File lib/rbt/compile/commandline.rb, line 103
def set_commandline_options(i = [])
  case i
  when nil
    i = []
  end
  i = [i].flatten.compact
  @internal_hash[:commandline_arguments] = i
end
set_compile_these_programs(i) click to toggle source
#

set_compile_these_programs

This method will designate which programs are to be compiled. Typically this will be an Array of programs, such as ['htop','ruby','php'] and so forth.

#
# File lib/rbt/compile/set_compile_these_programs.rb, line 18
def set_compile_these_programs(i)
  if i.is_a? Hash
    if i.has_key? :compile_these_programs
      i = i.delete(:compile_these_programs)
    end
  end
  i = [i].flatten.compact.map {|entry| # Will always be an Array.
    entry = entry.dup if entry.frozen?
    # ===================================================================== #
    # The next line will remove '-' and '_' characters from the given
    # input. This, however had, may NOT be done when there is a
    # locally existing file with that name.
    # ===================================================================== #
    unless File.exist? entry
      entry.delete!('-_') # Don't use '-' characters.
      if entry.end_with? '.yml'
        entry.sub!(/\.yml$/,'')
      elsif entry.end_with? '.pc'
        entry.sub!(/\.pc$/,'')
      end
    end if entry.is_a? String
    # ===================================================================== #
    # Use some exceptions for "kde1" and "mate1", which will be used
    # in the next Array:
    # ===================================================================== #
    this_array = %w(
      kde mate game xfce xorg gnome plasma lxqt portingaids
    )
    if entry.respond_to?(:start_with?) and
       entry.start_with?(*this_array) and 
      (entry =~ /\d{1,4}$/) and
      !is_included?(entry) # <- We have to prioritize on any registered program here.
      menu('--'+entry.to_s)
      nil # Eliminate these lateron.
    else
      entry # <- Keep this as return value here.
    end
  }.compact
  # ========================================================================= #
  # This will always be an Array:
  # ========================================================================= #
  @internal_hash[:compile_these_programs] = i if i and !i.empty?
  # ========================================================================= #
  # We will also initialize the cookbook_dataset for the first program,
  # if possible.
  # ========================================================================= #
  first_program = i.first.to_s.downcase.delete('/')
  if first_program and RBT.is_this_program_included?(first_program)
    # ===================================================================== #
    # Set the initial seeds for the programs at hand.
    # ===================================================================== #
    set_compile_this_program(first_program)
    initialize_cookbook_dataset_for(first_program)
  end
end
set_compile_this_program(i) click to toggle source
#

set_compile_this_program

This method has to be used to register the name of the current program that is to be compiled or installed.

#
# File lib/rbt/compile/compile.rb, line 223
def set_compile_this_program(i)
  i = i.to_s.dup.downcase.delete('/_-') # <- Get rid of '/', '_' and other characters.
  i.chop! if i.end_with? ':','#' # Get rid of trailing ':' and '#'.
  i = return_possible_abbreviation_to_this_input(i)
  # ======================================================================= #
  # Keep track of the program we are compiling in the Hash called @internal_hash.
  # ======================================================================= #
  @internal_hash[:compile_this_program] = i # Must be a String.
end
Also aliased as: set_program_name
set_configure_base_dir( i = rds( "
set_configure_base_directory( i = rds( " click to toggle source
#

set_configure_base_directory

This setter-method sets the @internal_hash, which is, for example, a directory such as:

/Depot/Temp/htop-1.0.0/

Some projects, such as “xvid” / “xvidcore”, may require a specific subdirectory, though.

Another example may be the program called “nspr”, which requires the following configure base directory:

/Depot/Temp/nspr-4.10.8/nspr/

class RBT::Compile will store this in a separate variable so that it can be queried lateron.

Do note that the cookbook-dataset will also retain the original configure_base_directory.

#
# File lib/rbt/compile/set.rb, line 33
def set_configure_base_directory(
    i = rds(
      "#{extract_to?.to_s}"\
      "#{program_name_and_version?.to_s}/"\
      "#{cookbook_dataset_configure_base_directory?.to_s}"
    )
  )
  i = i.to_s.dup
  i = rds(i) # rds() is used here since as of Feb 2012.
  i << '/' unless i.end_with? '/' # It must always have a trailing '/'.
  i = i.to_s.dup
  @internal_hash[:configure_base_directory] = i # <- Finally, assign it.
end
Also aliased as: set_configure_base_dir
set_configure_command(i)
set_configure_options(i = '') click to toggle source
#

set_configure_options

#
# File lib/rbt/compile/cookbook_dataset.rb, line 121
def set_configure_options(i = '')
  cookbook_dataset?.configure_options = i
end
set_configure_options_on_internal_hash(i) click to toggle source
#

set_configure_options_on_internal_hash

#
# File lib/rbt/compile/misc.rb, line 288
def set_configure_options_on_internal_hash(i)
  @internal_hash[:configure_options] = i
end
set_cookbook_dataset_program(i) click to toggle source
#

set_cookbook_dataset_program

#
# File lib/rbt/compile/cookbook_dataset.rb, line 492
def set_cookbook_dataset_program(i)
  cookbooks_dataset?.set_program(i)
end
set_cookbook_dataset_program_path(i) click to toggle source
#

set_cookbook_dataset_program_path

#
# File lib/rbt/compile/cookbook_dataset.rb, line 499
def set_cookbook_dataset_program_path(i)
  cookbooks_dataset?.set_program_path(i)
end
set_cookbook_dataset_program_version(i) click to toggle source
#

set_cookbook_dataset_program_version

For this method to work, cookbook_dataset? must have been instantiated before.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 469
def set_cookbook_dataset_program_version(i)
  cookbook_dataset?.set_program_version(i)
end
set_delay_before_continuing(n_seconds) click to toggle source
#

set_delay_before_continuing (sleep tag)

Ensure that the argument passed to us is correct.

#
# File lib/rbt/compile/misc.rb, line 3064
def set_delay_before_continuing(n_seconds)
  sleep(n_seconds.to_i)
end
set_desc(i)
Alias for: set_description
set_description(i) click to toggle source
#

set_description

#
# File lib/rbt/compile/cookbook_dataset.rb, line 635
def set_description(i)
  cookbook_dataset?.set_description(i)
end
Also aliased as: set_desc
set_dont_keep_archive( be_verbose = true ) click to toggle source
#

set_dont_keep_archive

Use this method when you don't want to keep the extracted archive.

#
# File lib/rbt/compile/extract.rb, line 257
def set_dont_keep_archive(
    be_verbose = true
  )
  if be_verbose
    opnn; e 'We will not keep our extracted archive.'
  end
  @internal_hash[:keep_the_extracted_archive] = false
end
set_env?()
Alias for: set_env_variables?
set_env_variables?() click to toggle source
#

set_env_variables?

Determine whether we have to set any environment variable or not.

#
# File lib/rbt/compile/env.rb, line 110
def set_env_variables?
  _ = cookbook_dataset?
  if _ and _.respond_to?(:set_env_variables?)
    _.set_env_variables?
  else
    false
  end
end
Also aliased as: set_env?
set_extract_to( i = RBT.log_directory?, be_verbose = false )
set_extract_to_this_directory( i = RBT.log_directory?, be_verbose = false ) click to toggle source
#

set_extract_to_this_directory

This method can be used to keep track onto which directory archives will be extracted.

Within RBT, the target is also known as the “homedir” variable.

#
# File lib/rbt/compile/extract.rb, line 108
def set_extract_to_this_directory(
    i          = RBT.log_directory?,
    be_verbose = false
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  end
  i = i.to_s
  case i
  # ======================================================================= #
  # === pwd
  # ======================================================================= #
  when 'pwd','homedir'
    i = rds(return_pwd+'/')
  end unless File.exist? i
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  # ======================================================================= #
  # Display some information to the user, if we operate in a verbose manner.
  # ======================================================================= #
  if be_verbose
    opnn; e 'We will use '+sdir(i)+' as our directory into which '\
            'we will extract the source archive into.'
  end
  @internal_hash[:extract_to_this_directory] = i.dup
end
set_extract_to_this_directory_as_specified_by_the_user(i) click to toggle source
#

set_extract_to_this_directory_as_specified_by_the_user

#
# File lib/rbt/compile/extract.rb, line 20
def set_extract_to_this_directory_as_specified_by_the_user(i)
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = i
end
set_extracted_base_directory(i) click to toggle source
#

set_extracted_base_directory

#
# File lib/rbt/compile/extract.rb, line 284
def set_extracted_base_directory(i)
  @internal_hash[:extracted_base_directory] = i
end
set_full_configure_command(i) click to toggle source
#

set_full_configure_command

#
# File lib/rbt/compile/misc.rb, line 1908
def set_full_configure_command(i)
  i.strip! # <- This is mandatory; may be reconsidered in the future though.
  @internal_hash[:full_configure_command] = i
end
set_homedir( i = RBT.log_directory?, be_verbose = false )
set_is_an_abbreviation(i = true) click to toggle source
##

set_is_an_abbreviation

#
# File lib/rbt/compile/misc.rb, line 2154
def set_is_an_abbreviation(i = true)
  @internal_hash[:is_an_abbreviation] = i
end
set_keep_extracted(i = true)
set_keep_extracted_archive(i = true)
set_keep_the_extracted_archive(i = true) click to toggle source
#

set_keep_the_extracted_archive

This method will keep the source-archive extracted. Note that this is not the default - by default we will remove the extracted archive.

#
# File lib/rbt/compile/extract.rb, line 207
def set_keep_the_extracted_archive(i = true)
  @internal_hash[:keep_the_extracted_archive] = i
end
set_license(i) click to toggle source
#

set_license

#
# File lib/rbt/compile/cookbook_dataset.rb, line 628
def set_license(i)
  cookbook_dataset?.set_license(i)
end
set_make_command( i = 'make' ) click to toggle source
#

set_make_command

This method can be used to set which make command is to be used.

#
# File lib/rbt/compile/make.rb, line 296
def set_make_command(
    i = 'make'
  )
  i = 'make' if i.nil? # Set to the default in this case.
  @internal_hash[:make_command] = i
end
set_make_options(i)
set_name_for_the_build_directory( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, be_verbose = false ) click to toggle source
#

set_name_for_the_build_directory

#
# File lib/rbt/compile/build_directory.rb, line 80
def set_name_for_the_build_directory(
    i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY,
    be_verbose = false
  )
  case be_verbose
  when :report_back
    be_verbose = true
  end
  if be_verbose
   opne "The name of the build directory will be `#{royalblue(i)}`."
  end
  @internal_hash[:name_for_the_build_directory] = i
end
set_on_ihash( which_key_to_use = :yaml_dataset, which_dataset_to_use ) click to toggle source
#

set_on_ihash

The second argument is the dataset that you wish to use.

#
# File lib/rbt/compile/compile.rb, line 151
def set_on_ihash(
    which_key_to_use = :yaml_dataset,
    which_dataset_to_use
  )
  @internal_hash[which_key_to_use] = which_dataset_to_use
end
set_original_input(i = nil) click to toggle source
#

set_original_input

This method can be used to keep track of the original input given to RBT::Compile.

#
# File lib/rbt/compile/misc.rb, line 520
def set_original_input(i = nil)
  @internal_hash[:original_input] = i
end
set_parameters_to_make(i) click to toggle source
#

set_parameters_to_make

If we have to pass specials options to the program called “make”, then we can do so via this setter-method.

These are additional options that can be given to the program called “make”.

#
# File lib/rbt/compile/make.rb, line 131
def set_parameters_to_make(i)
  # ======================================================================= #
  # The parameters must always be kept as an Array.
  # ======================================================================= #
  i = [i].flatten.compact
  @internal_hash[:parameters_to_make] = i # Do not change them to a String via .to_s
end
Also aliased as: set_make_options
set_path(i) click to toggle source
#

set_path

Set the $PATH variable here through this setter-method.

#
# File lib/rbt/compile/path.rb, line 51
def set_path(i)
  i = i.dup # Better to always .dup it when we set it.
  ENV['PATH'] = i # Must re-enable PATH environment as it was.
end
set_permanently_extract_to( i = nil ) click to toggle source
#

set_permanently_extract_to

This method will permanently set a new directory to which we will extract to.

To invoke this method, do something such as:

ry --permanently_extract_to=/Depot
ry --permanently_extract_to=/opt
ry --permanently_extract_to=$TEMP_DIR
#
# File lib/rbt/compile/permanent.rb, line 36
def set_permanently_extract_to(
    i = nil
  )
  if i
    target = RBT.permanently_set_temp_directory(i)
    opne "The RBT scripts will henceforthwith be extracted "\
         "towards `#{sdir(target)}`."
  else
    opne 'Please provide an argument.'
  end
end
set_postinstall(i)
set_postinstallation(i) click to toggle source
#

set_postinstallation

Note that the postinstallation steps will always be stored as an Array.

#
# File lib/rbt/compile/postinstallation_step.rb, line 76
def set_postinstallation(i)
  @internal_hash[:postinstallation] = [i].flatten.compact
end
Also aliased as: set_postinstall
set_prefix( i = :use_ntrad_prefix_at_a_later_time )
Alias for: set_user_prefix
set_preinstall_action(i) click to toggle source
#

set_preinstall_action

This method can be used to set different pre-install actions.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 390
def set_preinstall_action(i)
  if i.is_a? String
    if    i.include? ','
      i = i.split(',').map(&:strip)
    elsif i.include? ';'
      i = i.split(';').map(&:strip)
    end
  end
  cookbook_dataset?.preinstall = i
end
set_program_full_name(i = :default) click to toggle source
#

set_program_full_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 266
def set_program_full_name(i = :default)
  cookbook_dataset?.set_program_full_name(i)
end
set_program_name(i)
set_program_path(i) click to toggle source
#

set_program_path

#
# File lib/rbt/compile/misc.rb, line 692
def set_program_path(i)
  @internal_hash[:program_path] = i
end
set_program_short_name(i) click to toggle source
#

set_program_short_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 322
def set_program_short_name(i)
  cookbook_dataset?.set_program_short_name(i)
end
set_program_version(i) click to toggle source
#

set_program_version

Use this method to assign to a new program version at hand.

#
# File lib/rbt/compile/version.rb, line 92
def set_program_version(i)
  # ======================================================================= #
  # The program version is presently (December 2018) not allowed
  # to include a '/' character - possibly never allowed to have
  # this character. Thus, if we encounter such a character we
  # will apply File.basename() on this input.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i).delete('/')
  end
  i.delete!('/') if i.include? '/'
  @internal_hash[:use_this_specific_program_version] = i
  # ======================================================================= #
  # The following code is semi-experimental - we will also sync onto
  # the cookbook dataset object if it exists. We do this primarily
  # so that class Infobox can show the proper prefix in use.
  # ======================================================================= #
  if cookbook_dataset?
    cookbook_dataset?.set_program_version(i)
    if use_appdir_prefix?
      cookbook_dataset?.update_appdir_prefix
      # =================================================================== #
      # We know that we wish to use a special appdir prefix, so use it.
      # =================================================================== #
      set_user_prefix(return_appdir_prefix)
    end
  end
end
set_real_short_name(i) click to toggle source
#

set_real_short_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 663
def set_real_short_name(i)
  cookbook_dataset?.set_real_short_name(i)
end
set_really_compile_this_program(i = :qt) click to toggle source
#

set_really_compile_this_program

#
# File lib/rbt/compile/misc.rb, line 221
def set_really_compile_this_program(i = :qt)
  set_compile_this_program(i)
  set_compile_these_programs(i) if compile_these_programs?.empty?
  initialize_cookbook_dataset
end
set_short_desc(i) click to toggle source
#

set_short_desc

#
# File lib/rbt/compile/cookbook_dataset.rb, line 642
def set_short_desc(i)
  cookbook_dataset?.set_short_desc(i)
end
set_short_name(i) click to toggle source
#

set_short_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 670
def set_short_name(i)
  cookbook_dataset?.set_short_name(i)
end
set_skip_extracting( be_verbose = true ) click to toggle source
#

set_skip_extracting

Use this method when we shall skip the extracting phase.

#
# File lib/rbt/compile/extract.rb, line 54
def set_skip_extracting(
    be_verbose = true
  )
  if be_verbose
    opnn; e 'We will not extract our source, thus we will skip '\
            'extracting the archive.'
  end
  @internal_hash[:skip_extracting] = true
end
Also aliased as: do_not_extract
set_standalone_compilation( optional_command_given = nil, be_verbose = true )
set_these_env_variables( hash_or_string, do_which_action = :report_only, be_verbose = true ) { || ... } click to toggle source
#

set_these_env_variables

This method can be used to modify ENV variables.

The first input argument to this method should be the Hash, consisting of the key-value pairs in the form of key being the NAME of the shell variable that is to be modified; and the corresponding value being the new VALUE that you wish to set this variable to.

The third argument to this method determines whether we will output what we do to the user. By default this is true, but sometimes we may want to be able to quietly set these environment variables, such as when we attempt to use clang.

Legitimate usage examples for this method, in ruby, would be:

set_this_env_variable 'CFLAGS = -gcc'
set_this_env_variable 'LIBS: -lpthread'
#
# File lib/rbt/compile/env.rb, line 160
def set_these_env_variables(
    hash_or_string, # We allow Hash and String as input. But String must be in a special format.
    do_which_action = :report_only,
    be_verbose      = true
  )
  if block_given?
    yielded = yield
    if yielded.is_a? Symbol
      do_which_action = yielded
    end
  end
  unless @internal_hash[:do_not_use_special_flags]
    case do_which_action
    when :be_quiet, :be_silent
      be_verbose = false
      # =================================================================== #
      # Also change the do_which_action variable.
      # =================================================================== #
      do_which_action = :do_set_these_variables
    end
    case be_verbose
    when :be_verbose
      be_verbose = true
    when :be_quiet, :be_silent
      be_verbose = false
    end
    # ===================================================================== #
    # === Next, handle Strings
    # ===================================================================== #
    if hash_or_string.is_a? String
      if hash_or_string.include?('=') or
         hash_or_string.include?(':')
        if hash_or_string.include?('=')
          use_this_as_split_token = '='
        elsif hash_or_string.include?(':')
          use_this_as_split_token = ':'
        end
        splitted = hash_or_string.sub(/^export /,'').split(use_this_as_split_token)
        this_key   = splitted.first
        this_value = splitted.last
        hash_or_string = { this_key => this_value } 
      end
    end
    # ===================================================================== #
    # === Next, handle Hashes
    # ===================================================================== #
    hash_or_string.each_pair {|key, value|
      value.strip! if value.is_a? String
      # =================================================================== #
      # Make some exceptions, e. g. for gems.
      # =================================================================== #
      return if is_a_gem?
      if be_verbose and is_compiled? and !extract_only? and not value.to_s.empty?
        # ================================================================= #
        # Notify the user as to the env-value modification. Since as of
        # November 2018 we will no longer use opnn() here.
        # ================================================================= #
        e "  #{sfancy(key)} will be set to the "\
          "value(s): #{lightblue(value.to_s)}"
      end
      if value.is_a? FalseClass or
         value.is_a? TrueClass or
         value.is_a? Integer
        value = value.to_s
      end
      case do_which_action
      when :do_set_these_variables
        # ================================================================= #
        # Next set the value to the environment variable.
        # ================================================================= #
        ENV[key] = value
      end 
    }
  end
end
Also aliased as: set_this_env_variable
set_this_env_variable( hash_or_string, do_which_action = :report_only, be_verbose = true )
set_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = @internal_hash[:rename_tab_title] )
set_url(i)
Alias for: set_url1
set_url1(i) click to toggle source
#

set_url1

#
# File lib/rbt/compile/cookbook_dataset.rb, line 568
def set_url1(i)
  cookbook_dataset?.set_url1(i)
end
Also aliased as: set_url
set_url2(i) click to toggle source
#

set_url2

#
# File lib/rbt/compile/cookbook_dataset.rb, line 575
def set_url2(i)
  cookbook_dataset?.set_url2(i)
end
set_use_this_build_directory( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, be_verbose = false )
set_use_this_build_system(i) click to toggle source
#

set_use_this_build_system

Consistently use this method when you modify the value at @internal_hash.

#
# File lib/rbt/compile/misc.rb, line 628
def set_use_this_build_system(i)
  i = i.to_sym unless i.is_a? Symbol
  @internal_hash[:use_this_build_system] = i
end
set_use_this_configure_command(i) click to toggle source
#

set_use_this_configure_command

#
# File lib/rbt/compile/cookbook_dataset.rb, line 435
def set_use_this_configure_command(i)
  @internal_hash[:configure_command] = i.to_s
end
set_use_this_make_command( i = :default ) click to toggle source
#

set_use_this_make_command

This can be used to use another make command, such as “ninja”.

#
# File lib/rbt/compile/make.rb, line 330
def set_use_this_make_command(
    i = :default
  )
  case i
  when :default
    i = :make
  end
  i = i.to_s
  @internal_hash[:use_this_make_command] = i
end
set_use_this_prefix( i = :use_ntrad_prefix_at_a_later_time )
Alias for: set_user_prefix
set_user_prefix( i = :use_ntrad_prefix_at_a_later_time ) click to toggle source
#

set_user_prefix (set_prefix tag, set prefix tag)

This method may only be modified by the user, or internally if we know what we are doing.

If set to non-nil then the input argument will become the new user_prefix - in other words, the prefix into which we will compile into.

A specialized class called RBT::Prefix will handle the prefix.

#
# File lib/rbt/compile/prefix.rb, line 282
def set_user_prefix(
    i = :use_ntrad_prefix_at_a_later_time
  )
  if i.is_a? Symbol
    # ===================================================================== #
    # This clause will handle Symbols such as :app_dir_like or
    # :use_ntrad_prefix_at_a_later_time.
    # ===================================================================== #
    case i.to_s # case tag
    # ===================================================================== #
    # === non_traditional
    # ===================================================================== #
    when /^app(_|-)?dir$/,
         /^app(_|-)?dir(_|-)?like$/,
         'non_traditional','gobolinux','ntrad','false',
         'default',
         'app_dir_like','',
         'return_appdir_path','f',
         'appdir_prefix',
         /^use(_|-)?appdir(_|-)?prefix$/i
      i = return_non_traditional_prefix(internal_program_name?) # defined in this file here.
      # =================================================================== #
      # Since as of May 2014 we get rid of all '-'
      # =================================================================== #
      i.delete!('-') if i.include? '-'
    end
  end
  if i.is_a? String
    # ===================================================================== #
    # Handle the situation when we input a String that starts with the
    # character ':'. This will be assumed to be a shortcut to an
    # environment variable.
    # ===================================================================== #
    if i.start_with?(':')
      # ===================================================================== #
      # Next, we must add the proper program_version. This is either the
      # program_version at hand - or it is an ENV variable if it exists.
      # We check for the ENV variable first.
      # ===================================================================== #
      this_key = (i.delete(':').upcase+'_PREFIX').dup
      if ENV.has_key? this_key
        # ================================================================= #
        # The environment variables must be UPCASED and have appended
        # the string '_PREFIX'.
        # ================================================================= #
        i = ENV[this_key].dup.to_s
      else
        # ================================================================= #
        # Assume a special prefix variant targetting the /Programs/
        # hierarchy.
        # ================================================================= #
        i = programs_directory?+i.to_s.delete(':').capitalize+'/'
        i << program_version?.dup.to_s
      end
    end
    # ===================================================================== #
    # === Convert environment variables, if given
    # ===================================================================== #
    if i.is_a?(String)
      if i.include?('$')
        i = convert_env_variable(i) # Replace ENV variables here.
        i << '/' unless i.end_with? '/'
      end
      if i.include? '--'
        if i.include? '--prefix=' # Input is assumed to be like '--prefix=/Depot/j'
          i = i.split('=').last # <- Obtain just the last part in this case.
        end
      end
    end
    # ===================================================================== #
    # Next, perform some sanitize operations.
    # ===================================================================== #
    case i # case tag
    # ===================================================================== #
    # === trad
    # ===================================================================== #
    when /^trad$/
      i = '/usr/'
    # ===================================================================== #
    # === --opt_prefix
    # ===================================================================== #
    when /^-?-?opt(_|-)?prefix$/,
         :opt
      i = '/opt/'
    # ===================================================================== #
    # === ULOCAL
    # ===================================================================== #
    when 'ULOCAL'
      i = '/usr/local/'
    end
    if i.empty?
      i = RBT::Prefix.new
    else
      i = RBT::Prefix.new(i)
    end
  elsif i.is_a? Symbol
    case i
    when :use_ntrad_prefix_at_a_later_time
      # ===================================================================== #
      # This is a special case, which we will leave as-is - we will
      # determine the real prefix here at a later time.
      # ===================================================================== #
    else
      i = RBT::Prefix.new(i)
    end
  end
  # ======================================================================= #
  # Unfreeze frozen Strings.
  # ======================================================================= #
  if i.is_a? String and i.frozen?
    i = i.dup # "unfreeze" it.
  end
  # ======================================================================= #
  # === Ensure trailing '/' for directories.
  # ======================================================================= #
  unless i.to_s.end_with? '/' # .to_s to protect against Symbols given.
    i << '/' if File.directory?(i.to_s)
  end
  # ======================================================================= #
  # We must rewrite the program version in the following case. The
  # input may be like this:
  #  "/Programs/Gobjectintrospection/1.53.4/"
  # ======================================================================= #
  if use_this_specific_program_version?
    if i.is_a?(String) and i.include?(programs_directory?)
      use_this_regex = /(\d{1,2}\.?\d{1,2}\.?\d{1,2}\/)$/ # See: http://rubular.com/r/PPb2Y96XfF
      i.sub!(use_this_regex, use_this_specific_program_version?)
      i << '/' unless i.end_with? '/'
    elsif i.is_a?(Symbol)
      i = use_this_specific_program_version?
    end
  end
  # ======================================================================= #
  # Next, we must check for post-install actions and modify these,
  # if they exist. We only do so if we have an AppDir-prefix.
  # ======================================================================= #
  if is_an_appdir_prefix?(i)
    consider_modifying_postinstall
  end
  @internal_hash[:user_prefix] = i
end
set_user_prefix_to_nil() click to toggle source
#

set_user_prefix_to_nil

#
# File lib/rbt/compile/prefix.rb, line 100
def set_user_prefix_to_nil
  set_user_prefix(nil)
end
short_name?()
show_all( i = internal_program_name? ) click to toggle source
#

show_all

This method will show the full content of a specific .yml file.

To invoke this method, do something like the following:

ry htop show_all
#
# File lib/rbt/compile/show_and_report.rb, line 25
def show_all(
    i = internal_program_name?
  )
  ShowAllAbout.new(i)
end
Also aliased as: show_all_about
show_all_about( i = internal_program_name? )
Alias for: show_all
show_all_about_this_dir( i = return_pwd ) click to toggle source
#

show_all_about_this_dir

#
# File lib/rbt/compile/show_and_report.rb, line 34
def show_all_about_this_dir(
    i = return_pwd
  )
  _ = File.basename(i)
  _ = ProgramInformation.return_short_name(i).delete('-')
  show_all_about(_) # Delegate to that method here.
end
show_all_binaries_of_this_program( this_program = program? ) click to toggle source
#

show_all_binaries_of_this_program

Use this method to show the registered binaries of the input-argument, the given program at hand.

#
# File lib/rbt/compile/feedback.rb, line 69
def show_all_binaries_of_this_program(
    this_program = program?
  )
  if dataset?.nil?
    ensure_that_a_dataset_exists_for_this_program(this_program)
  end
  _ = binaries?
  if _.empty?
    opne "No binaries/executables appear to be registered for "\
         "the program `#{sfancy(this_program)}`."
  else
    e; _.each_with_index {|this_binary, index| index += 1
      index = "  #{slateblue((index.to_s+') ').rjust(5))}"
      e "#{index}#{sfancy(this_binary)}"
    }; e
  end
end
Also aliased as: feedback_all_binaries
show_all_locally_available_programs( slice_n_chunks = 3 ) click to toggle source
#

show_all_locally_available_programs

Invocation example:

rbt --locally-available-programs?
#
# File lib/rbt/compile/feedback.rb, line 254
def show_all_locally_available_programs(
    slice_n_chunks = 3
  )
  programs_dir = programs_dir?
  all_dirs = Dir[programs_dir+'*'].select {|entry| File.directory? entry }
  all_dirs.map! {|entry|
    use_this_regex = /^#{programs_dir}/
    entry = entry.sub(use_this_regex,'')
    entry # .downcase # To downcase or not to downcase.
  }
  n_programs = all_dirs.size.to_s
  opne "The locally available `#{orange(n_programs)}` programs are:"
  sliced = all_dirs.each_slice(slice_n_chunks)
  result = ''.dup
  sliced.each {|inner_group_array|
    joined = inner_group_array.map {|entry|
      (entry+',').ljust(25)
    }.join
    result << '  '+sfancy(joined.strip).delete(',')+N
  }
  result = result.strip.chop.chomp.strip
  result.sub!(/,\e\[0;37$/, '.') # Reformat it.
  e
  e result
  e
end
show_available_batch_compile_options() click to toggle source
#

show_available_batch_compile_options

#
# File lib/rbt/compile/show_and_report.rb, line 215
def show_available_batch_compile_options
  this_file = RBT.file_cookbook_chained_programs
  if File.exist? this_file
    dataset = YAML.load_file(this_file)
    keys = dataset.keys
    opnn; e "These #{teal(keys.size)} entries exist:"; e
    keys.each {|this_entry_point|
      e "  #{sfancy(this_entry_point)}"
    }; e
  else
    opnn; no_such_file_exists(this_file)
  end
end
show_available_headers_of_this_program( i = compile_which_program? ) click to toggle source
#

show_available_headers_of_this_program

This method will show the available headers of the given program at hand.

Invocation example:

ry glibc --headers?
#
# File lib/rbt/compile/headers.rb, line 30
def show_available_headers_of_this_program(
    i = compile_which_program?
  )
  array_headers = cookbook_dataset_headers?
  if array_headers.empty?
    opnn; e "The program `#{sfancy(i)}` will not install any .h files."
  else
    opnn; e "The program `#{sfancy(i)}` will install these .h files:"
    e
    array_headers.each {|this_header_file|
      e "  #{sfancy(this_header_file)}"
    }
    e
  end
end
show_available_profiles( target_directory = DIRECTORY_RBT_PROFILES ) click to toggle source
#

show_available_profiles

This method will show the available (local) profiles.

To invoke this method try:

rbt --show-available-profiles
#
# File lib/rbt/compile/misc.rb, line 171
def show_available_profiles(
    target_directory = DIRECTORY_RBT_PROFILES
  )
  available_profiles = Dir[target_directory+'*.md'].map {|entry|
    File.basename(entry).sub(/.md$/,'')
  }
  if available_profiles.empty?
    opne 'No profiles could be found in the directory '+sdir(target_directory)+'.'
  else
    e 'The following profiles are available:'
    e
    available_profiles.each {|entry|
      e slateblue('  '+entry)
    }
    e
  end
end
show_build_systems_priorities() click to toggle source
#

show_build_systems_priorities

Invocation example:

rbt --prioritize?
#
# File lib/rbt/compile/misc.rb, line 812
def show_build_systems_priorities
  array = YAML.load_file(FILE_BUILD_SYSTEMS_PRIORITIES)
  e
  e lightgreen(
      'The build system priority is the following '\
      '(first one has higher priority):'
    )
  e
  array.each_with_index {|content, index| index += 1
    e slateblue(('('+index.to_s+') ').rjust(6))+
      orange(content)
  }
  e
end
show_compile_chain(i) click to toggle source
#

show_compile_chain

Show all members of a particular compile-chain.

Invocation examples:

ry --show-chain=plasma
ry --show-compile-chain-of=kde5_plasma
ry --compile-chain-of=kde5_plasma
ry --view=kde5_plasma
#
# File lib/rbt/compile/show_and_report.rb, line 79
def show_compile_chain(i)
  ShowCompileChain.of(i)
end
show_compile_time_statistics() click to toggle source
#

show_compile_time_statistics

This method will show compile-time statistics for all the programs that the user has compiled through RBT.

Invocation example:

ry --show-compile-time-statistics
#
# File lib/rbt/compile/time.rb, line 22
def show_compile_time_statistics
  _ = RBT.file_storing_the_time_it_took_to_compile_programs
  if File.exist? _
    dataset = YAML.load_file(_)
    if dataset.empty?
      opne 'The dataset is empty. Have there any programs been '\
           'compiled yet, through '+teal('rbt')+'?'
    else
      opne "Showing the compile-time statistics for the "\
           "following #{sfancy(dataset.keys.size.to_s)} programs."
      e
      # =================================================================== #
      # Need to sort this dataset by size still.
      # =================================================================== #
      sorted_longest_compilation_comes_first = dataset.sort_by {|name_of_the_program, n_seconds|
        n_seconds
      }.reverse
      # =================================================================== #
      # Show a little header explaining what this is all about.
      # =================================================================== #
      e gray('-' * 80)
      e sfancy('Name of the program'.ljust(28))+
        simp('Compile time in seconds ')+
        orange('Compile time in minutes')+
        mediumslateblue(' File size of the archive')
      e gray('-' * 80)
      sorted_longest_compilation_comes_first.each {|name_of_the_program, n_seconds|
        left_padded  = ("#{name_of_the_program.strip}:").ljust(26)
        right_padded_showing_n_seconds = (
          '%.2f' % n_seconds.to_s.strip.to_f
        ).rjust(12)
        right_padded_showing_n_seconds << ' seconds'
        n_minutes = (n_seconds.to_f / 60.0).round(2) # Rounding to 2 is better.
        n_minutes = n_minutes.to_s.ljust(4,'0')
        # ================================================================= #
        # Next count the amount of numbers before the '.' point. If there
        # are at the least two numbers, we will .ljust(5,'0') rather than
        # .ljust(4,'0').
        # ================================================================= #
        if n_minutes.include? '.'
          first_splitted = n_minutes.split('.').first
          if first_splitted.size > 1
            n_minutes = n_minutes.to_s.ljust(5,'0')
          end
        end
        # ================================================================= #
        # The program name may be upcased; since we store only downcased
        # variants for the name of the .yml file at hand, we will also
        # .downcase() on the program name in the following code.
        # ================================================================= #
        archive_size = fast_return_file_size_of_this_program(
          name_of_the_program.downcase.delete('-')
        )
        colourized_file_size = mediumslateblue(
          "#{archive_size.to_s.rjust(10)} Kb"
        )
        result = '  '+sfancy(left_padded)+' '+
          simp(right_padded_showing_n_seconds)+' '+
          orange(
            ('('+n_minutes).rjust(6)+' minutes)'
          )
        result << ' '+colourized_file_size
        e result
      }
      e
    end
  else
    opne "No file exists at `#{sfile(_)}`."
    opne 'We thus can not show any statistics.'
  end
end
show_downloadable_programs() click to toggle source
#

show_downloadable_programs

#
# File lib/rbt/compile/misc.rb, line 938
def show_downloadable_programs
  _ = available_programs?.sort
  chunked = _.each_slice(5)
  opnn; e 'The following programs can be downloaded:'
  e
  chunked.each {|this_chunk|
    e '  '+slateblue(this_chunk.join(', ').strip.chop)
  }
  e
end
show_enable_pkgconfig_symlinking_message() click to toggle source
#

show_enable_pkgconfig_symlinking_message

#
# File lib/rbt/compile/symlink.rb, line 192
def show_enable_pkgconfig_symlinking_message
  opne "Enabling pkgconfig-symlinking of .pc files into `"\
       "#{sdir('/usr/lib/pkgconfig/')}`."
end
show_gobolinux_instructions() click to toggle source
#

show_gobolinux_instructions

To invoke this method do:

rbt --show-gobo-instructions
#
# File lib/rbt/compile/show_and_report.rb, line 452
def show_gobolinux_instructions
  _ = RUBY_SRC_DIR+'rbt/doc/instructions_for_gobolinux.md'
  if File.exist? _
    e File.read(_)
  else
    opnn; no_file_exists_at(_)
  end
end
show_help_for_this_program( i = '', be_silent = false ) click to toggle source
#

show_help_for_this_program

Use this method if you wish to feedback how to use this class.

#
# File lib/rbt/compile/help.rb, line 24
def show_help_for_this_program(
    i         = '',
    be_silent = false
  )
  be_silent = true if be_silent == :be_silent
  e simp(i)+' has these options available:' unless be_silent
  display_standard_help_options # This is stored in help.rb
end
show_how_to_batch_compile() click to toggle source
#

show_how_to_batch_compile

This method will notify the user in how to batch-compile programs via RBT.

Invocation example:

rbt --show_how_to_batch_compile
#
# File lib/rbt/compile/show_and_report.rb, line 201
def show_how_to_batch_compile
  show_available_batch_compile_options
  e
  e 'In order to batch-compile one of these, issue a command such as:'
  e
  e '  rbt --batch-compile=mate'
  e '  rbt --batch-compile=vid_base'
  e '  rbt --batch-compile=terminals'
  e
end
show_how_to_compile_kde() click to toggle source
#

show_how_to_compile_kde

This method will provide some hints on the commandline as to how to batch-compile the various KDE components.

Invocation example:

ry --show-how-to-compile-kde
#
# File lib/rbt/compile/show_and_report.rb, line 129
def show_how_to_compile_kde
  e
  e '  ry --batch-compile=kde5_foundation'
  e '  ry --batch-compile=kde5_plasma'
  e '  ry --batch-compile=kde5_porting_aids'
  e '  ry --batch-compile=kde5_applications'
  e
end
show_infobox( i = compile_which_programs? ) click to toggle source
#

show_infobox

The first argument should be the dataset for the program that we are about to install/compile.

#
# File lib/rbt/compile/infobox.rb, line 32
def show_infobox(
    i = compile_which_programs?
  )
  if i.is_a? Array
    i.each {|entry| show_infobox(entry) }
  else
    if show_the_infobox?
      pass_this_dataset_into_the_infobox = cookbook_dataset_with_extended_configure_options?.dup
      pass_this_dataset_into_the_infobox.set_extract_to(
        extract_to_this_directory?
      )
      # ===================================================================== #
      # We can modify the dataset, for example, by using another prefix.
      # ===================================================================== #
      if user_prefix? and !user_prefix?.empty?
        pass_this_dataset_into_the_infobox.internal_hash?[:yaml_dataset]['prefix'] = user_prefix?.dup
      end
      # ===================================================================== #
      # Check whether the user actually makes use of any configure options
      # or not. If not, the cookbook dataset passed into Infobox will be
      # modified.
      # Keep in mind that @internal_hash[:try_to_use_configure_options]
      # is set to nil within the method reset().
      # ===================================================================== #
      unless @internal_hash[:try_to_use_configure_options].nil?
        pass_this_dataset_into_the_infobox.configure_options = nil
      end
      unless @internal_hash[:postinstallation].nil?
        pass_this_dataset_into_the_infobox.postinstallation = @internal_hash[:postinstallation]
      end
      pass_this_dataset_into_the_infobox.compiler_to_use = compiler_to_use?
      use_this_build_system = use_which_build_system?
      case use_this_build_system
      when :infer_automatically
        use_this_build_system = RBT.infer_build_system
      end
      pass_this_dataset_into_the_infobox.set_use_this_build_system(
        use_this_build_system
      )
      pass_this_dataset_into_the_infobox.set_configure_options(
        configure_options?
      )
      do_this = if extract_only?
                  'Extracting'
                elsif has_to_be_compiled?
                  'Compiling'
                else
                  'Installing'
                end
      RBT::Infobox.new(i) {{
        use_ccache:                    use_ccache?,
        show_required_dependencies_on: always_show_dependencies?,
        use_this_dataset:              pass_this_dataset_into_the_infobox,
        do_what:                       do_this
      }}
    end
  end
end
show_infobox?() click to toggle source
#

show_infobox?

#
# File lib/rbt/compile/infobox.rb, line 94
def show_infobox?
  @internal_hash[:show_the_infobox]
end
Also aliased as: show_the_infobox?
show_information_about_blfs() click to toggle source
#

show_information_about_blfs

We show some information about BLFS webpages.

To invoke this method, you can issue a command such as this here:

ry binutils --lfs
#
# File lib/rbt/compile/show_and_report.rb, line 307
def show_information_about_blfs
  if cookbook_dataset?.has_key?('blfs') and
    !cookbook_dataset?.blfs?.empty? # .empty? will assume this to be a String.
    url = cookbook_dataset?.blfs?
    if url.is_a? Array
      url = url.first
    end
    e "Url is: #{sfancy(url)}"
    set_xorg_buffer(url) if is_roebe?
  else
    opnn; e "The program #{royalblue(compile_which_program?)} has no blfs entry."
  end
end
show_installation_procedure_file( this_file = BeautifulUrl['installation_procedere'] ) click to toggle source
#

show_installation_procedure_file

Show the content of the file called installation_procedure.yml

To invoke this method, try:

rbt --installation-procedure
#
# File lib/rbt/compile/show_and_report.rb, line 390
def show_installation_procedure_file(
    this_file = BeautifulUrl['installation_procedere']
  )
  begin
    require 'beautiful_url' unless Object.const_defined? :BeautifulUrl
  rescue LoadError; end
  this_file = this_file.first if this_file.is_a? Array
  if File.exist? this_file
    e File.read(this_file)
  else
    opnn; e 'No file called '+sfile(this_file)+' was found.'
  end
end
show_instructions_for_gobolinux() click to toggle source
#

show_instructions_for_gobolinux

#
# File lib/rbt/compile/gobolinux.rb, line 43
def show_instructions_for_gobolinux
  _ = RUBY_SRC_DIR+'rbt/doc/INSTRUCTIONS_FOR_GOBOLINUX.md'
  if File.exist? _
    e File.read(_)
  end
end
show_last_compiled_program( shall_we_exit = false ) click to toggle source
#

show_last_compiled_program

Use this method to show the last compiled program.

#
# File lib/rbt/compile/misc.rb, line 3105
def show_last_compiled_program(
    shall_we_exit = false
  )
  shall_we_exit = true if shall_we_exit == :then_exit
  opne 'The last compiled program was `'+
        sfancy(last_compiled_program?)+'` (as registered'
  opne "in the file #{sfile(RBT.file_last_compiled_program)})."
  exit if shall_we_exit
end
show_last_configure_options_then_exit() click to toggle source
#

show_last_configure_options_then_exit

This method will show the last configure option that was used, then it will exit.

Invoke this like so:

rbt lconfigure?
#
# File lib/rbt/compile/configure.rb, line 313
def show_last_configure_options_then_exit
  show_last_options
  exit_program
end
show_last_options( name_of_the_program = compile_which_program? ) click to toggle source
#

show_last_options

Use this method to show the last configure options that were used in order to compile a program from source.

To grab this, try:

ry htop --last-options
#
# File lib/rbt/compile/configure.rb, line 365
def show_last_options(
    name_of_the_program = compile_which_program?
  )
  full_configure_command = return_last_configure_command
  if full_configure_command
    opne "The last configure command for `#{simp(name_of_the_program)}` was:"
    opne "  #{simp(full_configure_command)}"
  else
    opne "No configure command was used for `#{simp(name_of_the_program)}`."
  end
end
show_last_updated( shall_we_exit = true ) click to toggle source
#

show_last_updated

This method will show the last updated programs.

Invocation example:

ry --last_update
#
# File lib/rbt/compile/show_and_report.rb, line 284
def show_last_updated(
    shall_we_exit = true
  )
  require 'rbt/utility_scripts/show_last_updated.rb'
  RBT::Cookbooks::ShowLastUpdated.new # bl $RUBY_COOKBOOKS/lib/cookbooks/show_last_updated.rb
  exit_program if shall_we_exit
end
show_n_largest_local_programs( i = :default ) click to toggle source
#

show_n_largest_local_programs

Show the largest local programs with this method.

Invocation example:

ry htop --show_highest
#
# File lib/rbt/compile/show_and_report.rb, line 184
def show_n_largest_local_programs(
    i = :default
  )
  i = 50 if i == :default
  RBT::Cookbooks::Highest.new(i)
  exit_program
end
show_pc_files_installed_by_this_program( i = compile_which_program? ) click to toggle source
#

show_pc_files_installed_by_this_program

Invocation example:

ry samba --pkgconfig-files?
#
# File lib/rbt/compile/show_and_report.rb, line 261
def show_pc_files_installed_by_this_program(
    i = compile_which_program?
  )
  _ = pc_files?
  if _.empty?
    opnn; e 'The program '+simp(i)+' will not install any .pc file.'
  else
    opnn; e "The program #{gold(i)} will install "\
            "the following #{sfancy(_.size.to_s)} .pc file(s):"
    e; _.each {|this_pc_file|
      e "  #{sfancy(this_pc_file)}"
    }; e
  end
end
show_programs_with_a_blfs_entry() click to toggle source
#

show_programs_with_a_blfs_entry

Invocation example:

ry --show-all-blfs-entries
#
# File lib/rbt/compile/blfs.rb, line 67
def show_programs_with_a_blfs_entry
  _ = Dir[individual_cookbooks_dir?+'*.yml']
  matches = _.select {|file|
    dataset = File.read(file)
    dataset.include? ' blfs:'
  }.map {|entry|
    File.basename(entry).sub(/\.yml$/,'')
  }
  unless matches.empty?
    opne "The following #{sandybrown(matches.size.to_s)} programs "\
         "have a #{sfancy('blfs')} entry:"
    e
    matches.each_with_index {|name_of_the_program, index| index += 1
      index = (index.to_s+') ').rjust(5)
      remote_url = return_blfs_page_of_this_program(name_of_the_program)
      e royalblue(index)+slateblue(name_of_the_program.ljust(24))+
        lightblue(remote_url.to_s)
    }
    e
  end
end
show_rbt_intro() click to toggle source
#

show_rbt_intro

Invocation example:

ry --show-rbt-intro
ry --intro
#
# File lib/rbt/compile/show_and_report.rb, line 147
def show_rbt_intro
  e
  e 'Here are some hints to get you started with RBT.'
  e
  e "You can compile a program by issuing #{orange('rbt <name>')}."
  e
  e 'Example:'
  e
  e sfancy('  rbt php')
  e
  e 'You can also compile into a standalone app-dir:'
  e
  e sfancy('  rbt php ntrad')
  e sfancy('  rbt php --app-dir')
  e
  e 'Both variants are synonymous. If in doubt, using the variants'
  e 'that start with '+teal('--')+' is recommended.'
  e
  e 'To speed-up looking for the dataset stored in the various .yml'
  e 'files you can also issue the following command:'
  e
  e sfancy('  rbt --expand')
  e
  e 'This command will expand the dataset into a "sanitized" variant'
  e 'that requires less pre-processing before it can be used for'
  e 'compiling/installing programs from source.'
  e
end
show_registered_gems() click to toggle source
#

show_registered_gems

To invoke this method from the commandline, try:

rbt --show-registered-gems
#
# File lib/rbt/compile/ruby.rb, line 34
def show_registered_gems
  e 'These gems are available:'
  e
  RBT.array_all_rubygems.each_with_index {|this_gem, index| index += 1
    e "  #{lightgreen(index.to_s.rjust(4))} #{slateblue(this_gem)}"
  }
  e
end
show_registered_keys() click to toggle source
#

show_registered_keys

This delegates towards the Register class.

#
# File lib/rbt/compile/misc.rb, line 2328
def show_registered_keys
  RBT::RegisterProgramFilesIntoYamlDatabase.show_registered_keys
end
show_statistics_about_the_rbt_project() click to toggle source
#

show_statistics_about_the_rbt_project

To invoke this method, do:

rbt --stats?
#
# File lib/rbt/compile/statistics.rb, line 23
def show_statistics_about_the_rbt_project
  RBT::ShowStatistics.new
end
show_success_or_failure_status() click to toggle source
#

show_success_or_failure_status (success tag, failure tag, status tag)

This method will report some things, aka the success or failure status of a program.

#
# File lib/rbt/compile/show_and_report.rb, line 482
def show_success_or_failure_status
  # ======================================================================= #
  # Report the following only if the program has been installed
  # successfully.
  # ======================================================================= #
  if has_the_program_been_installed_successfully?
    opnn; e "The host system architecture was: "\
            "#{slateblue(host_system?)}"
    if is_a_gem?
      # =================================================================== #
      # If it is a .gem file then we will not report as much information.
      # =================================================================== #
      opnn; e teal('The program `')+lightgreen(compile_which_program?)+
              teal('` has been installed successfully.')
    else
      opnn; e teal('The program `')+lightgreen(compile_which_program?)+
              teal('` has been installed successfully, into the prefix')
      opnn; e plum(prefix?.to_s)+teal('). The full configure command was:')
      e
      e '  '+slateblue(return_full_configure_command)
      e
    end
  else
    # ===================================================================== #
    # Else the program has failed during compilation/installation.
    # ===================================================================== #
    opnn; e crimson('The program `')+
            teal(compile_which_program?)+
            crimson('` could not be installed.')
  end
end
Also aliased as: report_status
show_success_status?()
show_temp_directory() click to toggle source
#

show_temp_directory

To invoke this from the commandline, do:

ry --tempdir?
#
# File lib/rbt/compile/show_and_report.rb, line 116
def show_temp_directory
  opnn; e "The temp directory resides at `#{sdir(temp_directory?)}`."
end
show_the_available_profiles_for_configure_options() click to toggle source
#

show_the_available_profiles_for_configure_options

#
# File lib/rbt/compile/misc.rb, line 279
def show_the_available_profiles_for_configure_options
  Dir[DIRECTORY_RBT_PROFILES+'*.md'].each {|this_profile|
    e '  - '+royalblue(File.basename(this_profile)).sub(/\.md$/,'')
  }
end
show_the_classname?() click to toggle source
#

show_the_classname?

#
# File lib/rbt/compile/opn.rb, line 44
def show_the_classname?
  ::RBT.show_the_classname?
end
show_the_infobox?()
Alias for: show_infobox?
show_the_last_configure_option_for_this_program( this_program = compile_which_program? ) click to toggle source
#

show_the_last_configure_option_for_this_program

This method will make use of the file configure_command_database.yml. Obviously, the file has to exist in order for this to work.

Invocation example:

ry attica --show-last-configure-option-for-this-program
#
# File lib/rbt/compile/show_and_report.rb, line 422
def show_the_last_configure_option_for_this_program(
    this_program = compile_which_program?
  )
  _ = RBT.file_configure_database
  if File.exist? _
    dataset = YAML.load_file(_)
    if dataset.has_key? this_program
      result = dataset[this_program]
      opnn; e "The program #{sfancy(this_program)} has "\
              "been compiled with this command:"
      e
      e "  #{sfancy(result)}" # Display it without opnn.
      e
    else
      opnn; e "The program #{sfancy(this_program)} has not "\
              "been registered/compiled yet."
    end
  else
    opnn; e "No file exists at `#{sfile(_)}` so we can not proceed."
    opnn; e 'Nota bene: You should first compile some programs, before'
    opnn; e 'making use of this method.'
  end
end
show_the_recipes_directory() click to toggle source
#

show_the_recipes_directory

#
# File lib/rbt/compile/show_and_report.rb, line 407
def show_the_recipes_directory
  e sfancy(recipes_dir?) # In $RBT/base/base.rb
end
show_valid_system_tags() click to toggle source
#

show_valid_system_tags

Show the allowed, and thus valid, /System/Tags entries.

To invoke this method, do:

ry --valid-sys-tags?
#
# File lib/rbt/compile/tags.rb, line 55
def show_valid_system_tags
  _ = RBT.file_allowed_tags
  if File.exist? _
    # ===================================================================== #
    # Since the file exists, we can load up the dataset of it.
    # ===================================================================== #
    dataset_containing_the_allowed_tags = YAML.load_file(_).sort
    opnn; e 'The following '+sfancy(dataset_containing_the_allowed_tags.size.to_s)+' '+
            sdir('/System/Tags/')+' entries are valid:'
    e
    dataset_containing_the_allowed_tags.each_with_index {|tag, index| index += 1
      e mediumvioletred((index.to_s+') ').rjust(4))+
        sfancy(tag)
    }; e
  else
    opnn; e "No file called #{sfile(_)} exists - we thus can not show"
    opnn; e 'any allowed tags.'
  end
end
show_where_the_base_directory_can_be_found() click to toggle source
#

show_where_the_base_directory_can_be_found

To test this method, do:

ry htop base_dir?
#
# File lib/rbt/compile/show_and_report.rb, line 99
def show_where_the_base_directory_can_be_found
  e
  opnn; e 'The base directory is at: '.ljust(36)+
           sfancy(temp_directory?)
  unless extract_to?.to_s.empty?
    opnn; e "We will extract to this directory:  "\
            "#{sfancy(extract_to?.to_s)}"
  end
  e
end
show_whether_we_are_using_ccache_or_whether_we_are_not() click to toggle source
#

show_whether_we_are_using_ccache_or_whether_we_are_not

To invoke this method, try:

ry --use-ccache?
#
# File lib/rbt/compile/ccache.rb, line 109
def show_whether_we_are_using_ccache_or_whether_we_are_not
  _ = use_ccache?
  opne "Will the RBT project use ccache: "\
       "#{sfancy(verbose_truth(_))}"
end
show_which_colours_will_be_used() click to toggle source
#

show_which_colours_will_be_used

To show which colours will be used for the RBT project.

#
# File lib/rbt/compile/colours.rb, line 86
def show_which_colours_will_be_used
  opne 'These colours will be used:'
  e
  YAML.load_file(RBT_COLOURS_FILE).each_pair {|key, value|
    e "  #{key.ljust(12)} -> #{value}"
  }; e
end
show_which_compiler_will_be_used() click to toggle source
#

show_which_compiler_will_be_used

This method will show which compiler will be used.

Commandline invocation:

rbt --compiler?
#
# File lib/rbt/compile/misc.rb, line 1404
def show_which_compiler_will_be_used
  opne "The compiler that will be used for compiling "\
       "programs is `#{slateblue(use_which_compiler?)}`."
end
show_which_files_will_be_installed( i = compile_which_program? ) click to toggle source
#

show_which_files_will_be_installed

This method will show to the user which files will be installed.

Invocation examples:

ry htop ifiles
ry htop --installed-files
ry ruby --installed-files
#
# File lib/rbt/compile/compile.rb, line 130
def show_which_files_will_be_installed(
    i = compile_which_program?
  )
  file = static_appdir_prefix?+'yaml/registered_files.yml'
  if File.exist? file
    opne 'The following files will be installed by '\
         'the program `'+simp(i)+'`:'
    dataset = YAML.load_file(file).sort
    e; dataset.each {|entry| e '  '+entry }; e
  else
    opne 'The file '+sfile('registered_files.yml')+
         'could not be found,'
    opne ' thus we can not show which files are installed.'
  end
end
skip_extracting() click to toggle source
#

skip_extracting

Not every archive has to be extracted. For example, .gem files do not have to be extracted.

#
# File lib/rbt/compile/extract.rb, line 332
def skip_extracting
  @internal_hash[:extract_the_archive] = false
end
skip_extracting?() click to toggle source
#

skip_extracting?

Query-method over as to whether we will skip extracting the archive at hand. This can usually only be done when the archive has already been extracted somehow.

#
# File lib/rbt/compile/extract.rb, line 35
def skip_extracting?
  _ = @internal_hash[:skip_extracting]
  _ == true # This check prohibits nil and false.
end
Also aliased as: skip_extracting_the_archive?
skip_extracting_if_it_is_a_gem_file() click to toggle source
#

skip_extracting_if_it_is_a_gem_file

#
# File lib/rbt/compile/ruby.rb, line 20
def skip_extracting_if_it_is_a_gem_file
  if is_a_gem_file?
    skip_extracting
  end
end
skip_extracting_the_archive?()
Alias for: skip_extracting?
skip_postinstall_actions() click to toggle source
#

skip_postinstall_actions

Whether to skip postinstall actions or whether we don't.

#
sload()
Alias for: cookbook_dataset?
snapshot()
speed_up_the_compilation() click to toggle source
#

speed_up_the_compilation

We can speed up compilation via the -j option to “make”.

See:

https://www.math-linux.com/linux/tip-of-the-day/article/speedup-gnu-make-build-and-compilation-process
#
# File lib/rbt/compile/misc.rb, line 3371
def speed_up_the_compilation
  append_parameters_to_make(
    " -j#{return_n_processors.to_s}"
  )
end
start_to_compile( i = compile_these_programs? )
start_to_compile_the_programs( i = compile_these_programs? )
static_appdir_prefix?( i = compile_which_program?, use_this_program_version = :default )
Alias for: appdir_prefix?
stop_at_make_install_stage() click to toggle source
#

stop_at_make_install_stage

This method will allow us to exit once we reach the make install stage.

#
# File lib/rbt/compile/exit.rb, line 24
def stop_at_make_install_stage
  do_not_run_make_install
  do_exit_before_make_install
end
stop_at_make_stage() click to toggle source
#

stop_at_make_stage

#
# File lib/rbt/compile/exit.rb, line 14
def stop_at_make_stage
  do_not_run_make_install
  do_exit_before_make
end
stop_on_error( be_verbose = true ) click to toggle source
#

stop_on_error

Method call to stop if the user wanted to.

#
# File lib/rbt/compile/misc.rb, line 594
def stop_on_error(
    be_verbose = true
  )
  if be_verbose
    stderr return_opnn, :use_print
    stderr 'We will exit now because this behaviour is enabled'
    stderr return_opnn, :use_print
    stderr "in the configuration file (the entry: #{teal('stop_on_error')})."
  end
  exit_program if stop_on_error?
end
stop_on_error?() click to toggle source
#

stop_on_error?

#
# File lib/rbt/compile/misc.rb, line 3035
def stop_on_error?
  STOP_ON_ERROR
end
store_this_as_last_libtool_file(what) click to toggle source
#

store_this_as_last_libtool_file

We will remove “' or unhandled argument” if it is part of the given input at hand.

#
# File lib/rbt/compile/libtool.rb, line 131
def store_this_as_last_libtool_file(what)
  # ======================================================================= #
  # First sanitize the input a little bit:
  # ======================================================================= #
  if what.include? "' or unhandled argument"
    what = what.split(/' or unhandled argument/).first
  end
  unless what.empty?
    base_dir = "#{rbt_log_directory?}libtool/"
    mkdir(base_dir) unless File.directory? base_dir
    into = "#{base_dir}last_faulty_libtool_file.md"
    if is_on_roebe?
      if File.exist?(into) and File.read(into).strip.end_with? what
        # =================================================================== #
        # In this case, we will not store the same result again.
        # =================================================================== #
        return
      end
      opnn; e 'Also storing `'+royalblue(what)+'` into `'+sfile(into)+'`.'
    end 
    write_what_into(what, into)
  end
end
store_time_snapshot()
store_where?()
strip_binaries?() click to toggle source
#

strip_binaries?

#
# File lib/rbt/compile/strip.rb, line 162
def strip_binaries?
  @internal_hash[:strip_binaries]
end
strip_the_binaries_of_this_program(i) click to toggle source
#

strip_the_binaries_of_this_program

Invocation example:

rbt --strip-binaries-of=htop
#
# File lib/rbt/compile/strip.rb, line 130
def strip_the_binaries_of_this_program(i)
  [i].flatten.compact.each {|this_program|
    binaries_of_this_program = RBT.return_binaries_of_this_program(this_program)
    if binaries_of_this_program.empty?
      opnn; e "The program #{sfancy(this_program)} has no associated binaries."
      opnn; e 'Thus, "strip" can not be run on these binaries.'
    else
      opnn; e 'Now running "strip" on '+
              sfancy(binaries_of_this_program.size.to_s)+
              ' programs:'
      binaries_of_this_program.each {|this_binary|
        run_the_strip_command_on_this_input(this_binary)
      }
    end
  }
end
successfully_compiled?()
sys_command_string?()
tags()
Alias for: tags?
tags?() click to toggle source
#

tags?

Note that this method will attempt to return an Array.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 485
def tags?
  cookbook_dataset?.tags?
end
Also aliased as: tags
the_program_has_failed_to_install() click to toggle source
#

the_program_has_failed_to_install

#
# File lib/rbt/compile/problems_and_errors.rb, line 377
def the_program_has_failed_to_install
  @internal_hash[:has_the_program_been_installed_successfully] = false
end
the_program_has_to_be_compiled?()
the_program_is_included() click to toggle source
#

the_program_is_included

#
# File lib/rbt/compile/class_methods.rb, line 73
def the_program_is_included
  RBT::Compile.the_program_is_included
end
this_program?()
time_snapshot()
time_the_compilation?() click to toggle source
#

time_the_compilation?

#
# File lib/rbt/compile/time.rb, line 167
def time_the_compilation?
  @internal_hash[:time_compilation]
end
to_bash()
toggle_debug_value() click to toggle source
#

toggle_debug_value

#
# File lib/rbt/compile/debug.rb, line 29
def toggle_debug_value
  what = !DEBUG
  into = DEBUG_FILE
  opne 'Now toggling the debug value used for the RBT project into '
  opne "  #{sfile(into)}"
  save_what_into(what, into)
end
toggle_the_debug_value_then_query_the_debug_value() click to toggle source
#

toggle_the_debug_value_then_query_the_debug_value

#
# File lib/rbt/compile/debug.rb, line 21
def toggle_the_debug_value_then_query_the_debug_value
  toggle_debug_value
  query_debug_value
end
try_to_autocorrect_this_erroneous_libtool_entry(i) click to toggle source
#

try_to_autocorrect_this_erroneous_libtool_entry

This method will delegate towards class RBT::Libtool in order to fix a faulty .la file.

#
# File lib/rbt/compile/libtool.rb, line 37
def try_to_autocorrect_this_erroneous_libtool_entry(i)
  require 'rbt/libtool/class_methods/autocorrect_this_file.rb'
  opnn; e 'Now delegating towards class '+slateblue('RBT::Libtool')+
          ' to attempt to autocorrect the problem:'
  opnn; e "  #{sfancy(i)}"
  RBT::Libtool.autocorrect_this_file(i)
  # ======================================================================= #
  # The next subsection can re-compile again. We do so at maximum
  # 5 times.
  # ======================================================================= #
  if is_on_roebe? and try_to_autofix? and compiled_n_times? < 5
    increment_compiled_counter # Add +1 to the times we have tried to compile.
    clear_problems
    compile_this_program_again(program?)
  end
end
try_to_autocorrect_this_erroneous_libtool_entry_later(i) click to toggle source
#

try_to_autocorrect_this_erroneous_libtool_entry_later

Use this method to register an erroneous libtool entry. It will be fixed at a later time during the regular compile-cycle.

#
# File lib/rbt/compile/libtool.rb, line 67
def try_to_autocorrect_this_erroneous_libtool_entry_later(i)
  # ======================================================================= #
  # Store this faulty .la entry into a local file as well, next. This
  # was added in September 2018.
  # ======================================================================= #
  store_this_as_last_libtool_file(i)
  @internal_hash[:invalid_libtool_archive] = i # This is the libtool-entry that should go away.
  opnn; e 'Note that you can try to correct this error via:'
  e
  e orange('  rbt --fix-libtool-from-file')
  e
end
try_to_autofix?() click to toggle source
#

try_to_autofix?

#
# File lib/rbt/compile/obtain.rb, line 24
def try_to_autofix?
  @internal_hash[:try_to_autofix]
end
Also aliased as: autofix?, use_autofixing?
try_to_automatically_setup_the_rbt_project() click to toggle source
#

try_to_automatically_setup_the_rbt_project

This method could be used to automatically try and setup the project on a default GoboLinux system.

#
# File lib/rbt/compile/misc.rb, line 612
def try_to_automatically_setup_the_rbt_project
  if RBT.is_this_a_real_gobolinux_system?
    opnn; e 'Found a local GoboLinux system.'
    opnn; e 'Setting up some settings to make use of this as our host system.'
    target_file = log_dir?+'is_on_gobolinux.md'
    write_what_into('1', target_file)
    opnn; e 'This will be stored into the file `'+sfile(target_file)+'`.'
  end
end
try_to_batch_compile_this_stack(i) click to toggle source
#

try_to_batch_compile_this_stack

This method can be used to batch-compile several applications.

Invocation examples:

rbt --batch-compile=autotools
rbt --batch-compile=vid_suite
rbt --batch-compile=mate
rbt --batch-compile=kde5_porting_aids
#
# File lib/rbt/compile/misc.rb, line 1795
def try_to_batch_compile_this_stack(i)
  # ======================================================================= #
  # === Do some sanitizing of the input first.
  # ======================================================================= #
  case i
  # ======================================================================= #
  # === rbt --batch-compile=phonon
  # ======================================================================= #
  when 'phonon',
       /^kde(_|-)?plasma/
    i = 'kde5_plasma'
  # ======================================================================= #
  # === rbt --batch-compile=kde_apps
  # ======================================================================= #
  when /^kde(_|-)?apps/
    i = 'kde5_applications'
  # ======================================================================= #
  # === rbt --batch-compile=protos
  # ======================================================================= #
  when 'protos'
    i = 'xorg_protos'
  end
  case i # case tag
  # ======================================================================= #
  # === rbt --batch-compile=kde5_porting_aids
  # ======================================================================= #
  when /^kde5?(_|-)?porting(_|-)?aids?$/i,
       /^porting(_|-)?aids?$/i
    i = return_kde5_porting_aids
  # ======================================================================= #
  # === rbt --batch-compile=mate
  # ======================================================================= #
  when 'mate',
       /^mate(-|_)?desktop$/
    i = RBT.returned_chained_programs_of_the_mate_desktop
    opne "We will compile all #{sfancy(i.size.to_s)} programs "\
         "of the mate-desktop."
    opne 'These include:'
    e; i.each {|entry|
      e '  - '+sfancy(entry)
    }; e
  else
    hash = return_chained_programs
    i = hash[i]
  end
  if i.is_a? String and i.include? ','
    i = i.split(',').map(&:strip).flatten # Now it should be an Array.
  end
  if i.is_a? Array
    i.map! {|entry| entry.delete('-') }
  end
  return i
end
try_to_compile_this_game_component( i = 1 ) click to toggle source
#

try_to_compile_this_game_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --game1
ry --game4
#
# File lib/rbt/compile/games.rb, line 35
def try_to_compile_this_game_component(
    i = 1
  )
  result = nil
  big_array = return_games_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_games_component( i = 1 )
try_to_compile_this_gnome( i = 1 )
try_to_compile_this_gnome_component( i = 1 ) click to toggle source
#

try_to_compile_this_gnome_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --gnome1
#
# File lib/rbt/compile/gnome.rb, line 81
def try_to_compile_this_gnome_component(
    i = 1
  )
  result = nil
  big_array = return_gnome_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
Also aliased as: try_to_compile_this_gnome
try_to_compile_this_kde_component( i = 1 ) click to toggle source
#

try_to_compile_this_kde_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation examples from the commandline:

ry --kde3
ry --kde1..kde250
#
# File lib/rbt/compile/kde.rb, line 133
def try_to_compile_this_kde_component(
    i = 1
  )
  result = nil
  big_array  = return_kde5_foundation   # === KDE5 Foundation
  big_array << return_kde5_porting_aids # === KDE5 Porting Aids
  big_array << return_kde5_applications # === KDE5 Applications
  big_array << return_kde5_plasma       # === KDE5 Plasma
  big_array.flatten!
  if i.include? '..'
    # ===================================================================== #
    # First we chop away 'kde' if this string exists.
    # ===================================================================== #
    i.sub!(/kde/,'') if i.include? 'kde'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # We need numbers past this point. We also have to prevent too
    # high numbers, which the following code will do for us.
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_lxqt_component( i = 1 ) click to toggle source
#

try_to_compile_this_lxqt_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --lxqt3
#
# File lib/rbt/compile/lxqt.rb, line 48
def try_to_compile_this_lxqt_component(
    i = 1
  )
  result = nil
  big_array = return_lxqt_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_lxqt_desktop_component( i = 1 )
try_to_compile_this_mate_component( i = 1 )
try_to_compile_this_mate_desktop_component( i = 1 ) click to toggle source
#

try_to_compile_this_mate_desktop_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --mate3

On my home system I can also use aliases such as these:

mate1
mate2
mate3

And so forth.

#
# File lib/rbt/compile/mate_desktop.rb, line 53
def try_to_compile_this_mate_desktop_component(
    i = 1
  )
  result = nil
  big_array = return_mate_desktop_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_plasma_component( i = 1 ) click to toggle source
#

try_to_compile_this_plasma_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --plasma3
#
# File lib/rbt/compile/kde.rb, line 100
def try_to_compile_this_plasma_component(
    i = 1
  )
  result = nil
  big_array = return_kde5_plasma       # === KDE5 Plasma
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_portingaids_component( i = 1 ) click to toggle source
#

try_to_compile_this_portingaids_component

#
# File lib/rbt/compile/kde.rb, line 14
def try_to_compile_this_portingaids_component(
    i = 1
  )
  result = nil
  big_array = return_porting_aids
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
try_to_compile_this_xfce( i = 1 )
try_to_compile_this_xfce_component( i = 1 ) click to toggle source
#

try_to_compile_this_xfce_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --xfce1
#
# File lib/rbt/compile/xfce.rb, line 63
def try_to_compile_this_xfce_component(
    i = 1
  )
  result = nil
  big_array = return_xfce_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
Also aliased as: try_to_compile_this_xfce
try_to_compile_this_xorg( i = 1 )
try_to_compile_this_xorg_component( i = 1 ) click to toggle source
#

try_to_compile_this_xorg_component

The input to this method should typically be a number, such as 1 (or its String-variant “1”).

Invocation example from the commandline:

ry --xorg1
#
# File lib/rbt/compile/xorg.rb, line 158
def try_to_compile_this_xorg_component(
    i = 1
  )
  result = nil
  big_array = return_xorg_components
  big_array.flatten!
  if i.include? '..'
    splitted = i.split('..')
    first_number = splitted.first.to_i - 1
    last_number  = splitted.last.to_i - 1
    last_number  = (big_array.size - 1) if last_number > (big_array.size)
    result = big_array[first_number, last_number]
  else
    # ===================================================================== #
    # Prevent too high numbers next:
    # ===================================================================== #
    i = i.to_i # <- We need Integers past this point.
    i = (big_array.size - 1) if i > (big_array.size - 1)
    result = big_array[i - 1] # Find the proper result
  end
  set_compile_these_programs(result) # And assign it for compilation purposes.
end
Also aliased as: try_to_compile_this_xorg
try_to_extract_this_archive( i = cookbook_dataset_program_path?, extract_to_this_location = extract_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
try_to_find_an_alias_to_this_input_unless_the_program_exists(i) click to toggle source
#

try_to_find_an_alias_to_this_input_unless_the_program_exists

This method will either return the original input unmodified; or it will modify the input in such a way that it points to a valid, registered program.

For example, the String “ph” may become “php”.

#
# File lib/rbt/compile/misc.rb, line 1697
def try_to_find_an_alias_to_this_input_unless_the_program_exists(i)
  unless cookbooks_include_this_program? i.downcase
    is_the_program_included = cookbooks_include_this_program?(
      i.downcase, :with_abbreviations
    )
    if is_the_program_included
      i = abbreviations?[i.downcase]
    end
  end
  i
end
try_to_fix_all_shebangs() click to toggle source
#

try_to_fix_all_shebangs

Use this to fix shebangs of the RBT project.

#
# File lib/rbt/compile/misc.rb, line 3325
def try_to_fix_all_shebangs
  begin
    require 'roebe/classes/shebang_fixer.rb'
    cliner {
      opne 'Trying to fix all Shebangs now:'
      entries = Dir["#{base_directory?}**/**.rb"]
      entries.each { |file|
        file = ENV['RBT_DIR'].to_s+'/'+file
        Roebe::ShebangFixer.new(file)
      }
    }
  rescue LoadError
    e 'class Roebe::ShebangFixer is not available.'
  end
end
try_to_output_how_many_processors_this_computer_has() click to toggle source
#

try_to_output_how_many_processors_this_computer_has

To try this method on the commandline, do:

rbt --n-cores?
#
# File lib/rbt/compile/misc.rb, line 3383
def try_to_output_how_many_processors_this_computer_has
  _ = FILE_CPUINFO
  if File.exist? FILE_CPUINFO
    opne 'This computer has '+
         lightseagreen(
           return_n_processors_of_this_computer.to_s+' processors'
         )+'.'
  else
    opne 'Can not determine the number of processors as '
    opne "there is no file at #{sfile(FILE_CPUINFO)}."
  end
end
try_to_recompile_upon_error?() click to toggle source
#

try_to_recompile_upon_error?

#
# File lib/rbt/compile/obtain.rb, line 39
def try_to_recompile_upon_error?
  @internal_hash[:try_to_recompile_upon_error]
end
try_to_report_the_problem()
try_to_show_all_binary_duplicates_of_this_program( i = compile_which_program? ) click to toggle source
#

try_to_show_all_binary_duplicates_of_this_program

Use this method to show which binary duplicates exist for the given input program.

#
# File lib/rbt/compile/misc.rb, line 1596
def try_to_show_all_binary_duplicates_of_this_program(
    i = compile_which_program?
  )
  program_name = i
  if i.nil?
    opnn; e 'A nil value has been found in '+orange(__method__.to_s)+'.'
    pp caller()
  end
  capitalized_program_name = program_name.capitalize
  target = programs_directory?+capitalized_program_name+program_name.capitalize+'/Current/bin/*'
  opne 'Obtaining all files at `'+sdir(target)+'`.'
  all_binaries = Dir[target]
  all_binaries.select! {|entry|
    File.exist? '/usr/bin/'+File.basename(entry)
  }
  if all_binaries.empty?
    opne 'The '+sdir('/usr/bin/')+' hierarchy does not contain '\
         'any of the binaries'
    opne "belonging to #{sfancy(program_name)}."
  else
    n_duplicates = all_binaries.size.to_s
    opne "Found #{sfancy(n_duplicates)} binary duplicates."
    all_binaries.each {|file|
      e "/usr/bin/#{File.basename(file)}"
    }
  end
end
try_to_show_the_BLFS_content_of_this_program( i = compile_which_program? ) click to toggle source
#

try_to_show_the_BLFS_content_of_this_program

This method can be used to show the BLFS content of a program on the commandline.

Invocation example:

ry gcc --paste-blfs-page
ry libffi --paste-blfs-page
#
# File lib/rbt/compile/blfs.rb, line 21
def try_to_show_the_BLFS_content_of_this_program(
    i = compile_which_program?
  )
  # ======================================================================= #
  # First, obtain the remove URL that points to the BLFS page.
  # ======================================================================= #
  remote_url = RBT.return_blfs_page_of_this_program(i)
  if remote_url
    opne "A remote URL has been found, at `#{sfancy(remote_url)}`."
    opne 'We will next display the content of this remote page '\
         'on the commandline.'
    remote_dataset = open(remote_url).read
    opne 'The data was obtained - we will next show the STRING on'
    opne 'the commandline, but we will remove all HTML tags.'
    sanitized_dataset = remote_dataset.gsub(/<\/?[^>]*>/, '')
    sanitized_dataset = sanitized_dataset.split(N).reject {|line|
      line.strip.empty?
    }
    # ===================================================================== #
    # Some HTML entities may have to be re-formatted, for display on
    # the commandline. For example, '&amp;' is actually Ampersand aka
    # '&' token.
    # ===================================================================== #
    if sanitized_dataset.map! {|entry|
      if entry.include? '&amp;'
        entry.gsub!(/&amp;/,'&')
      end
      entry
    }
    end
    cliner {
      sanitized_dataset.each {|line|
        e  sfancy('  '+line)
      }
    }
  else
    opne "No BLFS entry is registered for the program `#{sfancy(i)}`."
  end
end
try_to_use_configure_options?() click to toggle source
#

try_to_use_configure_options?

#
# File lib/rbt/compile/misc.rb, line 268
def try_to_use_configure_options?
  _ = true # True by default.
  unless @internal_hash[:try_to_use_configure_options].nil?
    _ = @internal_hash[:try_to_use_configure_options]
  end
  _
end
Also aliased as: use_configure_options?
try_to_use_the_file_windows_cookbook()
try_to_use_the_file_windows_cookbook?() click to toggle source
#

try_to_use_the_file_windows_cookbook?

#
# File lib/rbt/compile/misc.rb, line 1525
def try_to_use_the_file_windows_cookbook?
  config?.try_to_use_the_file_windows_cookbook
end
try_to_use_this_profile(i) click to toggle source
#

try_to_use_this_profile

The .tr() operation in the method body is valid, because we will only store the filenames in a lowercased variant, such as “gcc_minimal.md” rather than “gcc-minimal.md”.

Usage example:

ry gcc --profile=gcc_lfs_pass1
ry gcc --profile=gcc_minimal
#
# File lib/rbt/compile/misc.rb, line 87
def try_to_use_this_profile(i)
  i = i.to_s.dup.tr('-','_')
  if i.start_with? '-' # This is always a mistake, for the time being, so remove it.
    i[/^-+/] = ''
  elsif i.start_with? '_' # This is always a mistake, for the time being, so remove it.
    i[/^_+/] = ''
  end
  case i
  # ======================================================================= #
  # === gcc-minimal-but-lots-of-languages
  #
  # To use this, try:
  #
  #   ry gcc trad --profile=gccp1
  #
  # ======================================================================= #
  when /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages$/i,
       /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages(-|_)?enabled$/i,
       /^language(-|_)?rich$/i,
       'gccp1',
       'gcc1'
    i = 'gcc_minimal_but_lots_of_languages_enabled'
    if no_cookbook_dataset?
      set_really_compile_this_program(:gcc)
    end
  # ======================================================================= #
  # === qt
  # ======================================================================= #
  when 'qt'
    if no_cookbook_dataset?
      set_really_compile_this_program(:qt)
    end
  # ======================================================================= #
  # === gcc_lfs_pass_1
  # ======================================================================= #
  when /^gcc(_|-)?lfs(_|-)?pass(_|-)?1$/
    i = 'gcc_lfs_pass1.md'
    if no_cookbook_dataset?
      set_really_compile_this_program(:gcc)
    end
  end
  i = i.dup if i.frozen?
  # ======================================================================= #
  # First we will have to try to find the proper profile:
  # ======================================================================= #
  i << '.md' unless i.end_with? '.md'
  target = DIRECTORY_RBT_PROFILES+i
  if File.exist? target
    opnn; e 'Making use of the profile found at this location:'
    opnn; e '  '+sfile(target)
    # ===================================================================== #
    # The file exists, so we can load it.
    # ===================================================================== #
    dataset = File.readlines(target).reject {|line|
      line.strip.start_with? '#' # Get rid of comments.
    }.join(' ').delete("\n").strip.squeeze(' ')
    clear_old_configure_options
    # ===================================================================== #
    # Store it in the internal hash next:
    # ===================================================================== #
    set_configure_options_on_internal_hash(dataset)
  else
    opnn; no_file_exists_at(target)
    opnn; e 'The current behaviour is that RBT will exit upon such an error -'
    opnn; e 'only existing profiles may be used.'
    e
    e 'The available profiles are:'
    e
    show_the_available_profiles_for_configure_options
    e
    exit
  end
end
uninstall_this_appdir( i = compile_which_program? ) click to toggle source
#

uninstall_this_appdir

Invocation example:

rbt evince --uninstall-appdir
#
# File lib/rbt/compile/misc.rb, line 2747
def uninstall_this_appdir(
    i = compile_which_program?
  )
  opne "Now trying to uninstall the program called `#{teal(i)}`."
  ::RBT::RemoveProgram.new(i)
end
update_all_gems() click to toggle source
#

update_all_gems

This method allows us to update all gems.

To invoke this method from within RBT::Compile, try this:

rbt --update-all-gems

Note that the constant ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM is used to automatically update a thus-downloaded gem.

#
# File lib/rbt/compile/ruby.rb, line 185
def update_all_gems
  require 'rbt/check_for_updates/check_for_new_release_on_rubygems.rb'
  opnn; e 'Next '+
          royalblue('updating all local gems')+'.'
  RBT.update_all_ruby_gems
  if ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM
    array_to_use = RBT.array_these_ruby_gems_were_updated?
    update_these_rubygems(array_to_use)
  end
end
update_binaries_of_this_program(i) click to toggle source
#

update_binaries_of_this_program

Invocation examples:

rbt --update-binaries-of=poppler
rbt --update-binaries-of=htop
rbt --update-binaries-of=xinelib
#
# File lib/rbt/compile/misc.rb, line 1042
def update_binaries_of_this_program(i)
  these_binaries = RBT.infer_these_binaries_will_be_installed_by(i)
  # ======================================================================= #
  # Now that we have obtained the binaries we can add it to our
  # .yml file. Note that this will always overwrite any other existing
  # entry, so the first step is to get rid of any old entries, before
  # adding the new entries.
  # ======================================================================= #
  path   = find_this_yaml_file(i)
  string = read_file_in_default_encoding(path)
  if is_on_roebe?
    opnn; e 'Creating a backup of the file first.'
    backup_directory_at = log_dir?+'backup/'
    mkdir(backup_directory_at) unless File.directory?(backup_directory_at)
    # ===================================================================== #
    # We will copy the old file, so that we could re-use it if we need to.
    # ===================================================================== #
    opnn; copy_file(
            path,
            backup_directory_at+File.basename(path),
            :be_verbose
          )
  end
  if string.include? ' binaries:'
    if is_on_roebe?
      # =================================================================== #
      # Notify only me on my home system in this case, as most users
      # won't need this information here really.
      # =================================================================== #
      opnn; e "Removing the old #{slateblue('binaries:')} entries first."
      new_string = ''.dup
      state_is_open = false
      string.split(N).each {|line|
        if line.include? ' binaries:'
          state_is_open = true
        else
          # =============================================================== #
          # Toggle it unless the next line starts with a ' - '.
          # =============================================================== #
          unless line.start_with?(' - ')
            state_is_open = false
          end
        end
        unless state_is_open
          new_string << line << N
        end
      }
      string = new_string # And re-assign it here.
    end
  end
  # ======================================================================= #
  # Ok, now we can find the proper position and simply add the binaries.
  # We will first check for a "homepage:" String; then "url2:" and
  # then "url1:". These are our "anchors".
  # ======================================================================= #
  if these_binaries.empty?
    opnn; e 'Can not store anything because no binaries could be found.'
  else
    append_this_string = ' binaries:'+N+' - '+these_binaries.join(N+' - ')+N
    splitted = string.split(N)
    array = []
    if string.include? ' blfs: '
      splitted.each {|line|
        if line.include? ' blfs: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'configure_options: '
      splitted.each {|line|
        if line.include? ' configure_options: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url2: '
      splitted.each {|line|
        if line.include? ' url2: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    else
      opnn; e 'Can not anchor it as no string '\
              'called '+slateblue('blfs:')+
              ':, '+slateblue('configure_options:')
      opnn; e 'or '+slateblue('url2:')+' could be found.'
    end
    what = array.join.chomp
    # ===================================================================== #
    # Next update the old content.
    # ===================================================================== #
    into = path
    opnn; e 'Next overwriting the file `'+sfile(into)+'`.'
    write_what_into(what, into)
    if is_on_roebe?
      # =================================================================== #
      # Also auto-updating the rbt project.
      # =================================================================== #
      opnn; e 'Since we are on roebe we will also auto-update the '\
              'rbt project next.'
      cd RUBY_SRC_DIR_AT_HOME+'rbt/'
      require 'roebe/toplevel_methods/rinstall2.rb'
      Roebe.rinstall2
    end
  end
end
update_binary_names( also_exit = false ) click to toggle source
#

update_binary_names

To invoke this method, try:

ry htop update_binary_names
ry --update-binary-names
#
# File lib/rbt/compile/misc.rb, line 2836
def update_binary_names(
    also_exit = false
  )
  also_exit = true if also_exit == :then_exit
  require 'rbt/utility_scripts/registered_binaries.rb'
  RBT::Cookbooks::RegisteredBinaries.new
  exit_program if also_exit
end
update_dataset( i, optional_arguments = nil )
update_libraries_of_this_program(i) click to toggle source
#

update_libraries_of_this_program

Invocation examples:

rbt --update-libraries-of=poppler
rbt --update-libraries-of=htop
rbt --update-libraries-of=xinelib
#
# File lib/rbt/compile/misc.rb, line 1163
def update_libraries_of_this_program(i)
  these_libraries = RBT.infer_these_libraries_will_be_installed_by(i)
  # ======================================================================= #
  # Now that we have obtained the libraries we can add it to our
  # .yml file. Note that this will always overwrite any other existing
  # entry, so the first step is to get rid of any old entries, before
  # adding the new entries.
  # ======================================================================= #
  path   = find_this_yaml_file(i)
  string = read_file_in_default_encoding(path)
  if is_on_roebe?
    opnn; e 'Creating a backup of the file first.'
    backup_directory_at = log_dir?+'backup/'
    mkdir(backup_directory_at) unless File.directory?(backup_directory_at)
    # ===================================================================== #
    # We will copy the old file, so that we could re-use it if we need to.
    # ===================================================================== #
    opnn; copy_file(
            path,
            backup_directory_at+File.basename(path),
            :be_verbose
          )
  end
  if string.include? ' libraries:'
    if is_on_roebe?
      # =================================================================== #
      # Notify only me on my home system in this case, as most users
      # won't need this information here really.
      # =================================================================== #
      opnn; e "Removing the old #{slateblue('libraries:')} entries first."
      new_string = ''.dup
      state_is_open = false
      string.split(N).each {|line|
        if line.include? ' libraries:'
          state_is_open = true
        else
          # =============================================================== #
          # Toggle it unless the next line starts with a ' - '.
          # =============================================================== #
          unless line.start_with?(' - ')
            state_is_open = false
          end
        end
        unless state_is_open
          new_string << line << N
        end
      }
      string = new_string # And re-assign it here.
    end
  end
  # ======================================================================= #
  # Ok, now we can find the proper position and simply add the libraries.
  # We will first check for a "homepage:" String; then "url2:" and
  # then "url1:". These are our "anchors".
  # ======================================================================= #
  if these_libraries.empty?
    opnn; e 'Can not store anything because no libraries could be found.'
  else
    append_this_string = ' libraries:'+N+' - '+these_libraries.join(N+' - ')+N
    splitted = string.split(N)
    array = []
    if string.include? ' homepage: '
      splitted.each {|line|
        if line.include? ' homepage: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url2: '
      splitted.each {|line|
        if line.include? ' url2: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url1: '
      splitted.each {|line|
        if line.include? ' url1: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    else
      opnn; e 'Can not anchor it as no string '\
              'called '+slateblue('homepage:')+
              ':, '+slateblue('url2:')
      opnn; e 'or '+slateblue('url1:')+' could be found.'
    end
    what = array.join.chomp
    # ===================================================================== #
    # Next update the old content.
    # ===================================================================== #
    into = path
    opnn; e 'Next overwriting the file `'+sfile(into)+'`.'
    write_what_into(what, into)
    if is_on_roebe?
      # =================================================================== #
      # Also auto-updating the rbt project.
      # =================================================================== #
      opnn; e 'Since we are on roebe we will also auto-update the '\
              'rbt project next.'
      cd RUBY_SRC_DIR_AT_HOME+'rbt/'
      require 'roebe/toplevel_methods/rinstall2.rb'
      Roebe.rinstall2
    end
  end
end
update_library_names() click to toggle source
#

update_library_names

To invoke this method, do something like:

ry htop uln
#
# File lib/rbt/compile/misc.rb, line 2676
def update_library_names
  RBT::Cookbooks::RegisteredLibraries.new
end
update_program_full_name() click to toggle source
#

update_program_full_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 235
def update_program_full_name
  cookbook_dataset?.update_program_full_name
end
update_program_name() click to toggle source
#

update_program_name

#
# File lib/rbt/compile/cookbook_dataset.rb, line 305
def update_program_name
  cookbook_dataset?.update_program_name
end
update_program_path() click to toggle source
#

update_program_path

#
# File lib/rbt/compile/cookbook_dataset.rb, line 755
def update_program_path
  cookbook_dataset?.update_program_path
end
Also aliased as: assemble_full_path
update_these_rubygems( array_to_use = RBT.array_all_rubygems ) click to toggle source
#

update_these_rubygems

This method can be used to specifically update the input-array rubygems.

By default we will feed in all registered rubygems, that is - all .gem files that are registered within the RBT project.

If you want to use another array of programs, pass in the Array of .gem files that you wish to use, into this method.

To invoke this method from the commandline, issue something like this:

rbt --install-all-rubygems
#
# File lib/rbt/compile/ruby.rb, line 214
def update_these_rubygems(
    array_to_use = RBT.array_all_rubygems
  )
  unless array_to_use.empty?
    initialize_default_values
    array_to_use.each {|this_program|
      opnn; e "Now installing the ruby gem called #{slateblue(this_program)}:"
      RBT.install_this_rubygem(this_program)
    }
  end
end
update_this_entry(i) click to toggle source
#

update_this_entry

#
# File lib/rbt/compile/misc.rb, line 2295
def update_this_entry(i)
  require 'rbt/utility_scripts/update_entry.rb'
  RBT::UpdateEntry.new(i)
end
upload_binaries?() click to toggle source
#

upload_binaries?

#
# File lib/rbt/compile/upload_and_download.rb, line 167
def upload_binaries?
  @internal_hash[:upload_binaries]
end
upload_to( upload_this_file = '/Depot/Temp/xchat.desktop', this_url = 'shevegen.square7.ch', optional_cd_into_this_directory = nil ) click to toggle source
#

upload_to

This can be used to upload a RBT file (or any other file) to a remote host, via FTP.

We will make use of the FTP-Paradise project for this.

Usage examples:

ry php upload /tmp/python-3.1.1.recipe
ry php upload
#
# File lib/rbt/compile/ftp.rb, line 30
def upload_to(
    upload_this_file = '/Depot/Temp/xchat.desktop',
    this_url         = 'shevegen.square7.ch',
    optional_cd_into_this_directory = nil
  )
  case this_url
  when :default
    this_url = 'shevegen.square7.ch'
  end
  this_recipe = '/Depot/Temp/xchat.desktop' if this_recipe.nil?
  ftp = FtpParadise::Connection.new
  ftp.login_name = 'shevegen'
  ftp.password   = ENV['MY_FTP_PASSWORD']
  ftp.url        = this_url
  if optional_cd_into_this_directory
    ftp.change_directory(optional_cd_into_this_directory)
  end
  ftp.upload(upload_this_file)
end
url1()
Alias for: url1?
url1?() click to toggle source
#

url1?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 560
def url1?
  cookbook_dataset?.url1?
end
Also aliased as: url?, url1
url?()
Alias for: url1?
use_a_build_directory( be_verbose = true )
use_a_build_directory?()
use_a_specific_program_version(i) click to toggle source
#

use_a_specific_program_version

Use this method to set to a specific program version.

Currently we will act on –version= and on –use-version=.

To check the regex, look here:

http://rubular.com/r/Wnq91wy8Nx

To test this, try any of the following:

ry gcc --version=4.5.3.tar.xz
ry gcc --use-version=4.5.3.tar.xz
ry nano --v=2.4.3
ry mesa --use-this-version=mesa-18.2.6
#
# File lib/rbt/compile/version.rb, line 30
def use_a_specific_program_version(i)
  i = i.dup
  # ======================================================================= #
  # We don't want file-extensions here.
  # ======================================================================= #
  i = remove_file_extension(i)
  if i.include?('=')
    splitted = i.split('=')
    i = splitted.last
  end
  # ======================================================================= #
  # Now we have e. g. input such as "2.4.3" or "mesa-18.2.6".
  # ======================================================================= #
  if i.include?('-') or i.include?('_')
    set_program_name(
      ProgramInformation.return_program_name(i)
    )
    set_program_short_name(
      ProgramInformation.return_program_name(i)
    )
    i = ProgramInformation.return_version(i).dup
  else
    # Else we will just use it directly as version.
  end
  # ======================================================================= #
  # In the past we used a regex, like shown here:
  #
  #   https://rubular.com/r/Z6LP2FCENzPj
  #
  # But we probably don't have to do so since January 2019.
  # ======================================================================= #
  set_program_version(i)
  opne "Setting to the specific version `#{royalblue(i)}` "\
       "now (for the program #{orange(compile_which_program?)})."
  # ======================================================================= #
  # Set it in the internal Hash - it will be synced lateron, see the
  # file sync.rb for this.
  # ======================================================================= #
  new_target_prefix = rds(
    "#{programs_directory?}/#{compile_which_program?.capitalize}/#{i}/"
  )
  # ======================================================================= #
  # We will also modify the original program_path.
  # ======================================================================= #
  set_user_prefix(
    new_target_prefix
  )
  unless archive_type?.empty?
    empty_archive_type
  end
  update_program_name
  set_program_full_name(
    cookbooks_program_name?
  )
  update_program_path
end
use_autoconf?() click to toggle source
#

use_autoconf?

This method determines as to whether we will use autoconf or whether we will not. By default the value of @internal_hash is nil. If a user modifies this value from the commandline, to either true or false, then we will use that value; otherwise we will use the value defined in the cookbook-dataset for this particular program at hand.

#
# File lib/rbt/compile/autoconf.rb, line 54
def use_autoconf?
  _ = cookbook_dataset?.use_autoconf? # <- This is the default.
  unless @internal_hash[:use_autoconf].nil?
    _ = @internal_hash[:use_autoconf]
  end
  _
end
use_autofixing?()
Alias for: try_to_autofix?
use_autogen?() click to toggle source
#

use_autogen?

Query method over as to whether we will use autogen.

#
# File lib/rbt/compile/autogen.rb, line 54
def use_autogen?
  _ = cookbook_dataset_use_autogen? 
  unless @internal_hash[:use_autogen].nil?
    _ = @internal_hash[:use_autogen]
  end
  _
end
use_build_dir?()
use_build_directory( be_verbose = true )
use_build_directory?() click to toggle source
#

use_build_directory?

Query-method over as to whether we will use a build directory or not.

This method will return a Boolean value (true or false).

#
# File lib/rbt/compile/build_directory.rb, line 130
def use_build_directory?
  _ = cookbooks_dataset?.use_build_directory
  if @internal_hash[:use_build_directory]
    _ = @internal_hash[:use_build_directory]
  end
  _
end
use_ccache?() click to toggle source
#

use_ccache?

#
# File lib/rbt/compile/ccache.rb, line 16
def use_ccache?
  @internal_hash[:use_ccache]
end
use_cmake()
Alias for: do_use_cmake
use_configure_as_build_system() click to toggle source
#

use_configure_as_build_system

#
# File lib/rbt/compile/misc.rb, line 636
def use_configure_as_build_system
  set_use_this_build_system(:configure)
end
use_configure_options?()
use_default_chroot_as_prefix( i = '/Depot/Chroot/' ) click to toggle source
#

use_default_chroot_as_prefix

Here we will use the default chroot as prefix. On my system this defaults to /Depot/Chroot/.

#
# File lib/rbt/compile/prefix.rb, line 119
def use_default_chroot_as_prefix(
    i = '/Depot/Chroot/'
  )
  set_user_prefix(i)
end
use_default_configure_command( i = 'configure' ) click to toggle source
#

use_default_configure_command

This method will hard-set the configure command.

#
# File lib/rbt/compile/cookbook_dataset.rb, line 737
def use_default_configure_command(
    i = 'configure'
  )
  cookbook_dataset?.configure_command = i
end
use_glib_schema?()
use_maximum_speed_for_compilation?() click to toggle source
#

use_maximum_speed_for_compilation?

#
# File lib/rbt/compile/misc.rb, line 1852
def use_maximum_speed_for_compilation?
  result = false
  if config?.use_maximum_speed_for_compilation
    result = config?.use_maximum_speed_for_compilation
  end
  return result
end
use_non_traditional_prefix() click to toggle source
#

use_non_traditional_prefix

This method will make use of AppDir-style prefixes, such as “/Programs/Htop/2.0.2”.

#
# File lib/rbt/compile/prefix.rb, line 19
def use_non_traditional_prefix
  do_compile_in_a_non_traditional_way(
    nil, :be_quiet
  )
end
use_old_configure_options( use_this_program = compile_which_program? )
use_opn?() click to toggle source
#

use_opn?

#
# File lib/rbt/compile/opn.rb, line 23
def use_opn?
  @internal_hash and @internal_hash[:use_opn] # Must be guarded a little.
end
use_opt_as_prefix() click to toggle source
#

use_opt_as_prefix

#
# File lib/rbt/compile/prefix.rb, line 128
def use_opt_as_prefix
  set_user_prefix('/opt/')
end
use_porg?() click to toggle source
#

use_porg?

#
# File lib/rbt/compile/porg.rb, line 14
def use_porg?
  @internal_hash[:use_porg]
end
Also aliased as: will_we_use_porg?
use_the_internal_sed_wrapper?() click to toggle source
#

use_the_internal_sed_wrapper?

Whether we will use the internal sed wrapper, aka class SedWrapper.

Since as of February 2018, we will not do so.

You can query this via the commandline like so:

rbt use-the-internal-sed-wrapper?
#
# File lib/rbt/compile/sed.rb, line 83
def use_the_internal_sed_wrapper?
  @internal_hash[:use_the_internal_sed_wrapper]
end
use_this_as_cookbook(i)
use_this_as_cookbook=(i)
use_this_as_programs_dir( i = programs_directory? ) click to toggle source
#

use_this_as_programs_dir

#
# File lib/rbt/compile/misc.rb, line 2014
def use_this_as_programs_dir(
    i = programs_directory?
  )
  i = convert_end_variable # Sanitize it.
  i << '/' unless i.end_with? '/'
  opne "Assigning a new Programs directory at: #{simp(i)}"
  RBT.configuration?.programs_directory = i
  # ======================================================================= #
  # Next we also must sync towards the main dataset.
  # ======================================================================= #
  cookbook_dataset?.programs_directory = i
  cookbook_dataset?.sanitize_prefix :appdir_path
end
use_this_build_directory( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, be_verbose = false )
use_this_build_directory=( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, be_verbose = false )
use_this_build_directory?() click to toggle source
#

use_this_build_directory?

Ask the dataset for the proper build directory to use.

This may not always be true though.

#
# File lib/rbt/compile/build_directory.rb, line 175
def use_this_build_directory?
  build_directory?.path?.to_s
end
use_this_build_system?()
use_this_compile_version(i) click to toggle source
#

use_this_compile_version

To try this, do:

ry glib --compile-version=2.16.33_ROEBE
#
# File lib/rbt/compile/version.rb, line 192
def use_this_compile_version(i)
  compile_as_appdir(nil, :be_silent)
  set_program_version(i)
  set_use_this_prefix(static_appdir_prefix?)
end
use_this_environment_variable(i) click to toggle source
#

use_this_environment_variable

This method will use a specific environment variable as the new prefix. An example follows next.

To use this, try a command invocation such as:

--use-this-environment-variable=XFCE_PREFIX
--use-this-environment-variable=MATE_DESKTOP_PREFIX
#
# File lib/rbt/compile/env.rb, line 66
def use_this_environment_variable(i)
  i = i.to_s.dup # We only want to work on unfrozen Strings.
  if i.include? '--'
    i.gsub!(/--/,'') # Only get rid of '--', not '-'.
  end
  if i.include? '$'
    i.delete!('$')
  end
  if i.include? '='
    i = i.split('=').last
    # ======================================================================= #
    # Now we assume this to be an environment variable.
    # ======================================================================= #
    if ENV.has_key? i
      i = ENV[i]
    end
  else
    i = ENV[i] if ENV.has_key? i
  end
  # ======================================================================= #
  # Finally, set the user-prefix next.
  # ======================================================================= #
  set_user_prefix(i)
end
use_this_make_command?() click to toggle source
#

use_this_make_command?

This is most commonly just “make” - but it may also be “ninja” or another build system.

#
# File lib/rbt/compile/make.rb, line 189
def use_this_make_command?
  _ = 'make' # Just some default.
  _ = cookbook_dataset_make_command? if cookbook_dataset_make_command?
  unless @internal_hash[:use_this_make_command].nil?
    _ = @internal_hash[:use_this_make_command]
  end
  _ # And return it here.
end
Also aliased as: use_which_make_command?
use_this_make_install_command?() click to toggle source
#

use_this_make_install_command?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 30
def use_this_make_install_command?
  cookbook_dataset?.use_this_make_install_command?
end
use_this_prefix?()
Alias for: prefix?
use_this_specific_program_version?() click to toggle source
#

use_this_specific_program_version?

#
# File lib/rbt/compile/version.rb, line 180
def use_this_specific_program_version?
  @internal_hash[:use_this_specific_program_version]
end
use_traditional_env_path() click to toggle source
#

use_traditional_env_path

This method will “put” /usr/bin/ at the beginning of the path.

It can be invoked from the commandline via:

ry fluxbox --traditional-path
#
# File lib/rbt/compile/path.rb, line 31
def use_traditional_env_path
  prepend_env_path_with('/usr/bin/')
end
use_url() click to toggle source
#

use_url

Usage example:

ry ffmpeg use_url
#
# File lib/rbt/compile/misc.rb, line 2250
def use_url
  dataset?.program_name = 'USE_URL' # RBT::Cookbooks::Cookbook will handle this call.
end
use_utf8_encoding_in_env() click to toggle source
#

use_utf8_encoding_in_env

#
# File lib/rbt/compile/misc.rb, line 2720
def use_utf8_encoding_in_env
  ENV['LC_ALL'] = 'en_US.utf8'
end
use_which_build_system?() click to toggle source
#

use_which_build_system?

#
# File lib/rbt/compile/misc.rb, line 718
def use_which_build_system?
  _ = cookbookset_dataset_use_which_build_system?
  unless @internal_hash[:use_this_build_system].nil?
    _ = @internal_hash[:use_this_build_system]
  end
  _
end
Also aliased as: build_system?
use_which_compiler?() click to toggle source
#

use_which_compiler?

#
# File lib/rbt/compile/misc.rb, line 1390
def use_which_compiler?
  config?.use_this_compiler
end
use_which_configure_command?() click to toggle source
#

use_which_configure_command?

#
# File lib/rbt/compile/cookbook_dataset.rb, line 428
def use_which_configure_command?
  @internal_hash[:configure_command]
end
use_which_make_command?()
use_which_prefix?()
Alias for: prefix?
user_prefix?() click to toggle source
#

user_prefix?

The user_prefix? is the one that the user may modify.

#
# File lib/rbt/compile/prefix.rb, line 109
def user_prefix?
  @internal_hash[:user_prefix]
end
uses_meson?()
uses_the_meson_build_system?() click to toggle source
#

uses_the_meson_build_system?

#
# File lib/rbt/compile/meson_and_ninja.rb, line 80
def uses_the_meson_build_system?
  use_this_build_system? == 'meson'
end
verbose_disable_ccache() click to toggle source
#

verbose_disable_ccache

#
# File lib/rbt/compile/ccache.rb, line 60
def verbose_disable_ccache
  opne 'We will not use ccache.'
  disable_ccache
end
verbose_disable_maximum_speed_for_compilation() click to toggle source
#

verbose_disable_maximum_speed_for_compilation

#
# File lib/rbt/compile/misc.rb, line 2372
def verbose_disable_maximum_speed_for_compilation
  opne 'We will not be using maximum speed.'
  configuration?.use_maximum_speed_for_compilation = false
end
verbose_disable_sed() click to toggle source
#

verbose_disable_sed

#
# File lib/rbt/compile/sed.rb, line 115
def verbose_disable_sed
  opnn; e "We will not use the #{powderblue('internal sed-wrapper')}."
  disable_internal_sed
end
verbose_do_extract_only() click to toggle source
#

verbose_do_extract_only

#
# File lib/rbt/compile/extract.rb, line 276
def verbose_do_extract_only
  opnn; e 'We will merely extract the archive, then exit.'
  @internal_hash[:extract_only] = true
end
verbose_do_not_strip_the_binaries() click to toggle source
#

verbose_do_not_strip_the_binaries

This will notify the user what we will do, and also toggle the flag that keeps track over as to whether we will run “strip” on the compiled binaries or whether we will not.

#
# File lib/rbt/compile/strip.rb, line 196
def verbose_do_not_strip_the_binaries
  opne "We will not strip the binaries (in the "\
       "#{sdir('bin/')} subdirectory)."
  do_not_strip_binaries
end
verbose_do_not_use_special_environment_flags() click to toggle source
#

verbose_do_not_use_special_environment_flags

If we do not want to use any ENV variable, this entry point will help us.

#
# File lib/rbt/compile/env.rb, line 97
def verbose_do_not_use_special_environment_flags
  opnn; e 'We will not use any '+teal('special environmental flag')+' (ENV).'
  path = query_path?
  ENV.clear
  set_path(path) # Must re-enable PATH environment as it was.
  @internal_hash[do_not_use_special_environment_flags] = true
end
verbose_do_not_use_special_flags() click to toggle source
#

verbose_do_not_use_special_flags

#
# File lib/rbt/compile/env.rb, line 33
def verbose_do_not_use_special_flags
  opnn; e 'We will not use any special ENV flags, save for PATH.'
  clear_env_variables_but_ensure_the_path_variable_works
end
verbose_enable_glib_schema() click to toggle source
#

verbose_enable_glib_schema

#
# File lib/rbt/compile/misc.rb, line 1891
def verbose_enable_glib_schema
  opne "Enabling #{slateblue('glib-schemata')} next."
  do_use_glib_schema # Enable the glib-schemata here.
end
verbose_enable_porg() click to toggle source
#

verbose_enable_porg

#
# File lib/rbt/compile/misc.rb, line 2948
def verbose_enable_porg
  opne 'We will use the program "'+plum('porg')+
       '" for the "make install" step.'
  enable_porg
end
verbose_enable_static() click to toggle source
#

verbose_enable_static

#
# File lib/rbt/compile/static.rb, line 25
def verbose_enable_static
  opne 'Trying to compile statically (no shared libraries).'
  do_enable_static_compilation
  set_cflags(:overrule_static_build)
end
verbose_find_all_keys_starting_with(i) click to toggle source
#

verbose_find_all_keys_starting_with

This method will feedback all programs that start with a given (input) letter.

#
# File lib/rbt/compile/misc.rb, line 2579
def verbose_find_all_keys_starting_with(i)
  opne 'Finding all matches starting with the letter `'+
        sfancy(i.delete('*'))+'` now:'
  e
  find_all_keys_starting_with(i)
  e
end
verbose_generate_the_pdf_tutorial() click to toggle source
#

verbose_generate_the_pdf_tutorial

#
# File lib/rbt/compile/misc.rb, line 2823
def verbose_generate_the_pdf_tutorial
  opne 'We will generate a .pdf file next which will contain the'
  opne 'instructions on how to use the RBT project.'
  RBT.generate_pdf_tutorial
end
verbose_guess_the_build_type() click to toggle source
#

verbose_guess_the_build_type

#
# File lib/rbt/compile/misc.rb, line 1677
def verbose_guess_the_build_type
  opne 'The (guessed) build type is `'+slateblue(guess_build_type.to_s)+'`.'
end
verbose_md5_checking() click to toggle source
#

verbose_md5_checking

Use this method to do md5-checksum checking.

#
# File lib/rbt/compile/misc.rb, line 2221
def verbose_md5_checking
  _ = program_path?
  opne sfancy('The md5sum of `')+simp(program_name?)+
       sfancy('` in `')+sfile(_)+sfancy('` is:')
  opne simp('  '+return_md5(_)) # This method is defined here.
end
verbose_purge_fhs_binaries_of_this_program(i) click to toggle source
#

verbose_purge_fhs_binaries_of_this_program

This method will notify the user as to what will be done, then delegate towards purge_fhs_binaries_of_this_program().

#
# File lib/rbt/compile/misc.rb, line 1642
def verbose_purge_fhs_binaries_of_this_program(i)
  i = [i].flatten.compact
  i.each {|entry|
    entry.downcase!
    opne "Now purging all #{mediumspringgreen('binaries')} of "\
         "the program `#{sfancy(entry)}`, at the #{sdir('/usr/bin/')}"\
         " hierarchy."
    purge_fhs_binaries_of_this_program(entry)
  }
end
verbose_purge_fhs_libraries_of_this_program(i) click to toggle source
#

verbose_purge_fhs_libraries_of_this_program

This method will notify the user as to what will be done, then delegate towards purge_fhs_libraries_of_this_program().

#
# File lib/rbt/compile/misc.rb, line 2315
def verbose_purge_fhs_libraries_of_this_program(i)
  i = RBT.return_alias_program_name_for(i)
  opne "Now purging all #{mediumspringgreen('lib/')} programs "\
       "of `#{sfancy(i)}` at the #{sdir('/usr/lib/')}"\
       " hierarchy."
  purge_fhs_libraries_of_this_program(i)
end
verbose_query_whether_this_program_can_be_compiled_statically( this_program = compile_which_program? ) click to toggle source
#

verbose_query_whether_this_program_can_be_compiled_statically

#
# File lib/rbt/compile/static.rb, line 14
def verbose_query_whether_this_program_can_be_compiled_statically(
    this_program = compile_which_program?
  )
  _ = cookbook_dataset?
  opnn; e 'Can the program '+sfancy(this_program)+' be compiled statically: '+
          lightgreen(verbose_truth(_.can_be_compiled_statically?))
end
verbose_query_whether_we_are_on_a_gobolinux_like_system()
verbose_query_whether_we_will_use_the_internal_sed_wrapper( shall_we_exit = :do_not_exit ) click to toggle source
#

verbose_query_whether_we_will_use_the_internal_sed_wrapper

Query whether the internal sed-wrapper will be used.

Invocation example:

rbt --use-the-internal-sed-wrapper?
#
# File lib/rbt/compile/sed.rb, line 57
def verbose_query_whether_we_will_use_the_internal_sed_wrapper(
    shall_we_exit = :do_not_exit
  )
  if use_the_internal_sed_wrapper?
    opnn; e 'Yes, the internal sed-wrapper will be used ('+
            slateblue('class SedWrapper')+').'
  else
    opnn; e 'No, the internal sed-wrapper will '+crimson('NOT')+
            ' be used (class SedWrapper).'
  end
  case shall_we_exit
  when :and_exit, :and_then_exit
    exit_program
  end
end
verbose_report_will_we_use_autogen( i = compile_which_program? ) click to toggle source
#

verbose_report_will_we_use_autogen

This method will output, in a verbose manner, whether we will use autogen or whether we will not.

#
# File lib/rbt/compile/autogen.rb, line 91
def verbose_report_will_we_use_autogen(
    i = compile_which_program?
  )
  will_we_use_autogen = use_autogen?
  if will_we_use_autogen.nil? and cookbook_dataset_use_autogen?
    will_we_use_autogen = true
  end
  if will_we_use_autogen
    opne "Yes, autogen will be used for the "\
         "program `#{sfancy(i)}`."
  else
    opne "No, autogen will #{swarn('NOT')} be used for "\
         "the program #{sfancy(i)}."
  end
end
verbose_skip_extracting() click to toggle source
#

verbose_skip_extracting

#
# File lib/rbt/compile/extract.rb, line 339
def verbose_skip_extracting
  opnn; e 'The archive will not be extracted.'
  skip_extracting
end
version?()
Alias for: program_version?
waf_file?( this_file = 'waf' )
Alias for: waf_file_exists?
waf_file_exists?( this_file = 'waf' ) click to toggle source
#

waf_file_exists?

This boolean query method will determine whether a waf-file exists.

The input-argument is used primarily so that we can use another target-directory for where the 'waf' file may exist.

The method resides in this file here because waf ultimately depends on python.

#
# File lib/rbt/compile/python.rb, line 116
def waf_file_exists?(
    this_file = 'waf'
  )
  File.exist? this_file
end
Also aliased as: waf_file?
warning_argument_was_not_found(i) click to toggle source
#

warning_argument_was_not_found

Call this method when an argument was not found.

#
# File lib/rbt/compile/warnings.rb, line 16
def warning_argument_was_not_found(i)
  cliner {
    opnn
    ewarn "Attention: The argument `#{sfancy(i.to_s)}#{swarn('` was not found.')}" 
    opnn
    ewarn 'Have a look at the spelling. Should this argument exist?'
    opnn; e
    opnn
    ewarn 'If you are convinced that this may be a bug or a missing feature,'
    opnn
    ewarn 'feel free to report this to the lead developer(s).'
    opnn; e
    report_to_developers
  } # Finish here, so we display a nice coloured line still.
  stop_on_error
end
was_the_configure_run_a_success?()
we_can_not_continue(be_verbose = false) click to toggle source
#

we_can_not_continue

#
# File lib/rbt/compile/misc.rb, line 2349
def we_can_not_continue(be_verbose = false)
  case be_verbose
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'The RBT scripts can not continue.'
  end
  @internal_hash[:can_we_continue] = false
end
Also aliased as: can_not_continue, do_not_continue
we_can_not_continue_and_we_will_not_run_make_install() click to toggle source
#

we_can_not_continue_and_we_will_not_run_make_install

#
# File lib/rbt/compile/misc.rb, line 2364
def we_can_not_continue_and_we_will_not_run_make_install
  we_can_not_continue
  do_not_run_make_install
end
we_tried_to_compile_this_program_n_times?() click to toggle source
#

we_tried_to_compile_this_program_n_times

#
# File lib/rbt/compile/misc.rb, line 1873
def we_tried_to_compile_this_program_n_times?
  @internal_hash[:we_tried_to_compile_this_program_n_times]
end
Also aliased as: compiled_n_times?
wget(i)
which_program?()
will_gcc_be_used_for_compilation?() click to toggle source
#

will_gcc_be_used_for_compilation?

#
# File lib/rbt/compile/misc.rb, line 1383
def will_gcc_be_used_for_compilation?
  use_which_compiler? == 'gcc'
end
will_we_use_porg?()
Alias for: use_porg?
yaml_dataset?()
Alias for: cookbook_dataset?
zero_this_global_flag_file(i) click to toggle source
#

zero_this_global_flag_file

#
# File lib/rbt/compile/misc.rb, line 2683
def zero_this_global_flag_file(i)
  opne "Now resetting all global flags to "\
       "zero again. (File: #{sfile(i)})"
  remove_file(i)
  touch_file(i)
end

Private Instance Methods

run_premake_make_then_make_install() click to toggle source
#

run_premake_make_then_make_install

Issue “premake commands”, then “make” and then “make install” commands.

#
# File lib/rbt/compile/make.rb, line 308
def run_premake_make_then_make_install
  if run_make?
    run_premake_commands
    run_make_then_make_install
  end
end