class RBT::Toolchain

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::Toolchain[]

#
# File lib/rbt/utility_scripts/toolchain.rb, line 163
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/toolchain.rb, line 38
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/toolchain.rb, line 52
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @use_this_prefix
  # ======================================================================= #
  @use_this_prefix = "#{programs_dir?}Toolchain/"
  # ======================================================================= #
  # === @compile
  # ======================================================================= #
  @compile = nil
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/toolchain.rb, line 68
def run
  ENV['LFS'] = @use_this_prefix
  this_program = first_argument?
  optional_use_these_configure_options = nil
  # ======================================================================= #
  # Next we will pass through several components that are necessary
  # for our toolchain.
  # ======================================================================= #
  case this_program.to_s
  # ======================================================================= #
  # === toolchain glibc_first_pass
  # ======================================================================= #
  when /^glibc(_|-)?first(_|-)?pass$/i,
       '1'
    optional_use_these_configure_options = '
      --host=$LFS_TGT
      --build=$(../scripts/config.guess)
      --enable-kernel=3.2
      --with-headers='+@use_this_prefix+'include'.tr(N,' ').squeeze(' ')
    this_program = 'glibc'
  # ======================================================================= #
  # === toolchain binutils_first_pass
  # ======================================================================= #
  when /^binutils(_|-)?first(_|-)?pass$/i,
       '2' 
    optional_use_these_configure_options = '
      --with-sysroot=$LFS
      --with-lib-path='+@use_this_prefix+'lib
      --target=$LFS_TGT
      --disable-nls
      --disable-werror'.tr(N,' ').squeeze(' ')
    this_program = 'binutils'
  end
  opne "#{rev}Compiling the program #{steelblue(this_program)} #{rev}next."
  @compile = action(:Installer, this_program) { :do_not_run_yet }
  if @compile
    @compile.set_user_prefix(@use_this_prefix)
    if @compile.can_be_compiled_statically?
      @compile.enable_static_compilation
    end
    @compile.do_not_symlink_after_compilation
    @compile.do_not_create_the_appdir_skeleton
    RBT.register_program_files_into_yaml_database = false
    case this_program
    # ===================================================================== #
    # === tar
    #
    # Ad-hoc "fix" - tar should not be statically compiled.
    # ===================================================================== #
    when 'tar'
      @compile.do_not_compile_statically
      @compile.run
    # ===================================================================== #
    # === linux
    #
    # See:
    #
    #   http://www.linuxfromscratch.org/lfs/view/development/chapter05/linux-headers.html
    #
    # ===================================================================== #
    when 'linux'
      @compile.do_not_run_configure
      @compile.do_extract
      @compile.cd_to_the_extracted_directory
      @compile.run_this_command 'make mrproper'
      @compile.run_this_command 'make headers'
      esystem "cp -rv usr/include/* #{@use_this_prefix}include"
    # ===================================================================== #
    # === ncurses
    #
    # toolchain ncurses
    # ===================================================================== #
    when 'ncurses'
      @compile.set_use_these_configure_options '
        --with-shared --without-debug --without-ada
        --enable-widec --enable-overwrite
      '.delete(N).squeeze(' ')
      @compile.set_use_this_sed_line 'sed -i s/mawk// configure'
      @compile.run
      @compile.run_this_command 'ln -s libncursesw.so '+@use_this_prefix+'lib/libncurses.so'
    else
      if optional_use_these_configure_options
        @compile.set_configure_options = optional_use_these_configure_options
      end
      @compile.run
    end
  else
    opne "#{rev}The program #{steelblue(this_program)} #{rev}does not appear"
    opne 'to be registered.'
  end
end