File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change 8
8
9
9
# Set OPENSSL_PREFIX in ENV to find the OpenSSL headers
10
10
11
+ search_homebrew = -> homebrew {
12
+ if prefix = "#{ homebrew } /opt/openssl@1.1" and Dir . exist? ( prefix )
13
+ prefix
14
+ elsif prefix = "#{ homebrew } /opt/openssl" and Dir . exist? ( prefix )
15
+ prefix
16
+ end
17
+ }
18
+
11
19
macOS = RUBY_PLATFORM . include? ( 'darwin' )
12
20
13
21
if macOS && !ENV [ 'OPENSSL_PREFIX' ]
14
- homebrew = `brew --prefix 2>/dev/null` . strip
15
- unless $?. success? and !homebrew . empty? and Dir . exist? ( homebrew )
16
- homebrew = nil
22
+ if prefix = search_homebrew . call ( '/usr/local' )
23
+ # found
24
+ else
25
+ homebrew = `brew --prefix 2>/dev/null` . strip
26
+ homebrew = nil unless $?. success? and !homebrew . empty? and Dir . exist? ( homebrew )
27
+
28
+ if homebrew and prefix = search_homebrew . call ( homebrew )
29
+ # found
30
+ elsif Dir . exist? ( '/opt/local/include/openssl' ) # MacPorts
31
+ prefix = '/opt/local'
32
+ end
17
33
end
18
34
19
- if homebrew and prefix = "#{ homebrew } /opt/openssl@1.1" and Dir . exist? ( prefix )
20
- ENV [ 'OPENSSL_PREFIX' ] = prefix
21
- elsif homebrew and prefix = "#{ homebrew } /opt/openssl" and Dir . exist? ( prefix )
35
+ if prefix
22
36
ENV [ 'OPENSSL_PREFIX' ] = prefix
23
- elsif Dir . exist? ( '/opt/local/include/openssl' ) # MacPorts
24
- ENV [ 'OPENSSL_PREFIX' ] = '/opt/local'
25
37
else
26
38
abort 'Could not find OpenSSL headers, install via Homebrew or MacPorts or set OPENSSL_PREFIX'
27
39
end
You can’t perform that action at this time.
0 commit comments