aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorShaun Jackman2017-12-01 16:29:50 -0800
committerShaun Jackman2017-12-03 16:22:51 -0800
commite5847b652f93744d41f45b5636e67bb2748d67c7 (patch)
treea68502820b15e73ebc589c1c10d4fef91aae65de /Library/Homebrew/extend
parent0ad42ebbcb735422612a7c6d4edc5ad88044dd4b (diff)
downloadbrew-e5847b652f93744d41f45b5636e67bb2748d67c7.tar.bz2
extend/pathname: Add os/linux/elf.rb
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/os/linux/extend/pathname.rb20
-rw-r--r--Library/Homebrew/extend/os/mac/extend/pathname.rb2
2 files changed, 4 insertions, 18 deletions
diff --git a/Library/Homebrew/extend/os/linux/extend/pathname.rb b/Library/Homebrew/extend/os/linux/extend/pathname.rb
index eb6ea409b..604351da7 100644
--- a/Library/Homebrew/extend/os/linux/extend/pathname.rb
+++ b/Library/Homebrew/extend/os/linux/extend/pathname.rb
@@ -1,19 +1,5 @@
-class Pathname
- # @private
- def elf?
- # See: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
- read(4) == "\x7fELF"
- end
+require "os/linux/elf"
- # @private
- def dynamic_elf?
- if which "readelf"
- popen_read("readelf", "-l", to_path).include?(" DYNAMIC ")
- elsif which "file"
- !popen_read("file", "-L", "-b", to_path)[/dynamic|shared/].nil?
- else
- raise StandardError, "Neither `readelf` nor `file` is available "\
- "to determine whether '#{self}' is dynamically or statically linked."
- end
- end
+class Pathname
+ prepend ELFShim
end
diff --git a/Library/Homebrew/extend/os/mac/extend/pathname.rb b/Library/Homebrew/extend/os/mac/extend/pathname.rb
index 5fd59e1e7..4ced5a094 100644
--- a/Library/Homebrew/extend/os/mac/extend/pathname.rb
+++ b/Library/Homebrew/extend/os/mac/extend/pathname.rb
@@ -1,5 +1,5 @@
require "os/mac/mach"
class Pathname
- include MachOShim
+ prepend MachOShim
end