File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -46,21 +46,21 @@ extension String: Error {
4646}
4747
4848func 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 "
5055 let pkgConfigDir = URL ( fileURLWithPath: pkgConfigPath)
5156
52- // Make /usr/local /lib/pkgconfig if it doesn't already exist
57+ // Make <brew-prefix> /lib/pkgconfig if it doesn't already exist
5358 if !FileManager. default. fileExists ( atPath: pkgConfigPath) {
5459 try FileManager . default. createDirectory ( at: pkgConfigDir,
5560 withIntermediateDirectories: true )
5661 }
5762 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 " ) }
6464
6565 /// Ensure we have llvm-config in the PATH
6666 guard let llvmConfig = which ( " llvm-config-11 " ) ?? which ( " llvm-config " ) ?? brewLLVMConfig ( ) else {
You can’t perform that action at this time.
0 commit comments