Improved stripping.
parent
33f7ddc263
commit
e9bf79964f
|
@ -299,21 +299,22 @@ class Package::Recipe
|
||||||
private def do_strip
|
private def do_strip
|
||||||
@context.info "Stripping binaries"
|
@context.info "Stripping binaries"
|
||||||
|
|
||||||
@context.prefixes.each do |prefix|
|
FileUtils.find_files(fake_root_directory) do |path|
|
||||||
directory = "#{fake_root_directory}/#{prefix}/lib"
|
file_output = `file #{path}`
|
||||||
|
strip_opt = nil : String?
|
||||||
|
|
||||||
unless Dir.exists? directory
|
if file_output.match /ELF.*executable.*not stripped/
|
||||||
next
|
strip_opt = "--strip-all"
|
||||||
|
elsif file_output.match /ELF.*shared object.*not stripped/
|
||||||
|
strip_opt = "--strip-unneeded"
|
||||||
|
elsif file_output.match /current ar archive/
|
||||||
|
strip_opt = "--strip-debug"
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.find_files(directory) do |path|
|
if strip_opt
|
||||||
file_output = `file #{path}`
|
@context.detail "stripping #{path}"
|
||||||
|
|
||||||
if file_output.match /not stripped/
|
Process.run "strip", [strip_opt, path]
|
||||||
@context.detail "stripping #{path}"
|
|
||||||
|
|
||||||
Process.run "strip", [path]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue