File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -46,21 +46,21 @@ extension String: Error {
46
46
}
47
47
48
48
func makeFile( ) throws {
49
- let pkgConfigPath = " /usr/local/lib/pkgconfig "
49
+ let brewPrefix = {
50
+ guard let brew = which ( " brew " ) else { return nil }
51
+ return run ( brew, args: [ " --prefix " ] )
52
+ } ( ) ?? " /usr/local "
53
+
54
+ let pkgConfigPath = " \( brewPrefix) /lib/pkgconfig "
50
55
let pkgConfigDir = URL ( fileURLWithPath: pkgConfigPath)
51
56
52
- // Make /usr/local /lib/pkgconfig if it doesn't already exist
57
+ // Make <brew-prefix> /lib/pkgconfig if it doesn't already exist
53
58
if !FileManager. default. fileExists ( atPath: pkgConfigPath) {
54
59
try FileManager . default. createDirectory ( at: pkgConfigDir,
55
60
withIntermediateDirectories: true )
56
61
}
57
62
let cllvmPath = pkgConfigDir. appendingPathComponent ( " cllvm.pc " )
58
-
59
- let brewLLVMConfig : ( ) -> String ? = {
60
- guard let brew = which ( " brew " ) else { return nil }
61
- guard let brewPrefix = run ( brew, args: [ " --prefix " ] ) else { return nil }
62
- return which ( brewPrefix + " /opt/llvm/bin/llvm-config " )
63
- }
63
+ let brewLLVMConfig = { which ( " \( brewPrefix) /opt/llvm/bin/llvm-config " ) }
64
64
65
65
/// Ensure we have llvm-config in the PATH
66
66
guard let llvmConfig = which ( " llvm-config-11 " ) ?? which ( " llvm-config " ) ?? brewLLVMConfig ( ) else {
You can’t perform that action at this time.
0 commit comments