Module: Tebako::Stripper

Defined in:
lib/tebako/stripper.rb

Overview

Tebako packaging support (stripper)

Constant Summary collapse

DELETE_EXTENSIONS =
%w[o lo obj a la lib].freeze
BIN_FILES =
%w[
  bundle bundler rbs erb gem irb racc racc2y
  rake rdoc ri y2racc rdbg syntax_suggest typeprof
].freeze
CMD_SUFFIX =
".cmd"
BAT_SUFFIX =
".bat"

Class Method Summary collapse

Class Method Details

.strip(scm, src_dir) ⇒ Object

Strip Removes build artefacts, strip shared objects



48
49
50
51
52
53
# File 'lib/tebako/stripper.rb', line 48

def strip(scm, src_dir)
  puts "   ... stripping the output"
  strip_bs(src_dir)
  strip_fi(scm, src_dir)
  strip_li(scm, src_dir)
end

.strip_file(file_in, file_out = nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/tebako/stripper.rb', line 55

def strip_file(file_in, file_out = nil)
  params = ["strip", "-S", file_in]
  params << "-o" << file_out unless file_out.nil?
  out, st = Open3.capture2e(*params)

  # Some gems (well, libmspack) has bundled extensions for several architectures)
  # Getting something like:
  # strip: Unable to recognise the format of the input file
  # `/tmp/cirrus-ci-build/o/s/lib/ruby/gems/3.1.0/gems/libmspack-0.11.0/ext/x86_64-linux/libmspack.so'
  # on aarch64

  puts "Warning: could not strip #{file_in}:\n #{out}" unless st.exitstatus.zero?
end