Skip to content

Commit f2f1795

Browse files
committed
fix: check PKG_CONFIG_PATH
1 parent da3088a commit f2f1795

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: compiler/internal/build/build.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ func setDepsPC(ctx *context, pkg *packages.Package) {
318318
}
319319

320320
if len(pcDir) > 0 {
321-
pcDir = append(pcDir, os.Getenv("PKG_CONFIG_PATH"))
321+
if pkgPath, ok := os.LookupEnv("PKG_CONFIG_PATH"); ok {
322+
pcDir = append(pcDir, pkgPath)
323+
}
322324
os.Setenv("PKG_CONFIG_PATH", strings.Join(pcDir, ":"))
323325
}
324326
}

Diff for: compiler/internal/pc/env.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"os/exec"
77
)
88

9-
func AppendPCPath(path string) string {
9+
func appendPCPath(path string) string {
1010
if env, ok := os.LookupEnv("PKG_CONFIG_PATH"); ok {
1111
return path + ":" + env
1212
}
1313
return path
1414
}
1515

1616
func SetPath(cmd *exec.Cmd, path string) {
17-
pcPath := fmt.Sprintf("PKG_CONFIG_PATH=%s", AppendPCPath(path))
17+
pcPath := fmt.Sprintf("PKG_CONFIG_PATH=%s", appendPCPath(path))
1818
cmd.Env = append(os.Environ(), pcPath)
1919
}

0 commit comments

Comments
 (0)