-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
/
Copy pathinstall.rb
50 lines (42 loc) · 1.37 KB
/
install.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true
module Homebrew
module Install
module_function
DYNAMIC_LINKERS = [
"/lib64/ld-linux-x86-64.so.2",
"/lib64/ld64.so.2",
"/lib/ld-linux.so.3",
"/lib/ld-linux.so.2",
"/lib/ld-linux-aarch64.so.1",
"/lib/ld-linux-armhf.so.3",
"/system/bin/linker64",
"/system/bin/linker",
].freeze
def check_cpu
return if (Hardware::CPU.intel? && Hardware::CPU.is_64_bit?) || Hardware::CPU.arm?
message = "Sorry, Homebrew does not support your computer's CPU architecture!"
if Hardware::CPU.ppc64le?
message += <<~EOS
For OpenPOWER Linux (PPC64LE) support, see:
#{Formatter.url("https://github.com/homebrew-ppc64le/brew")}
EOS
end
abort message
end
def symlink_ld_so
brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
return if brew_ld_so.readable?
ld_so = HOMEBREW_PREFIX/"opt/glibc/lib/ld-linux-x86-64.so.2"
unless ld_so.readable?
ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s }
raise "Unable to locate the system's dynamic linker" unless ld_so
end
FileUtils.mkdir_p HOMEBREW_PREFIX/"lib"
FileUtils.ln_sf ld_so, brew_ld_so
end
def perform_preinstall_checks(all_fatal: false)
generic_perform_preinstall_checks(all_fatal: all_fatal)
symlink_ld_so
end
end
end