Skip to content

Commit da3088a

Browse files
committed
fix: remove AppendPCPath in build
1 parent 35a1198 commit da3088a

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

compiler/internal/build/build.go

+13-15
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import (
4444
"github.com/goplus/llgo/compiler/internal/mockable"
4545
"github.com/goplus/llgo/compiler/internal/mod"
4646
"github.com/goplus/llgo/compiler/internal/packages"
47-
"github.com/goplus/llgo/compiler/internal/pc"
4847
"github.com/goplus/llgo/compiler/internal/typepatch"
4948
"github.com/goplus/llgo/compiler/ssa/abi"
5049
xenv "github.com/goplus/llgo/xtool/env"
@@ -308,22 +307,19 @@ type context struct {
308307
// the pc for the deps of each package should be unique
309308
// consider duplicate clib but different version
310309
// exmaple: A requires zlib/1.3.1, B requires zlib/1.3.0
311-
func setDepsPC(ctx *context, p *packages.Package) {
310+
func setDepsPC(ctx *context, pkg *packages.Package) {
312311
var pcDir []string
313-
for _, pkg := range p.Imports {
314-
if !isLLPkg(pkg) {
315-
continue
316-
}
317-
ver := module.Version{
318-
Path: pkg.Module.Path,
319-
Version: pkg.Module.Version,
320-
}
321-
if dir := ctx.llpkgMod[ver]; dir != "" {
322-
pcDir = append(pcDir, dir)
323-
}
312+
ver := module.Version{
313+
Path: pkg.Module.Path,
314+
Version: pkg.Module.Version,
324315
}
316+
if dir := ctx.llpkgMod[ver]; dir != "" {
317+
pcDir = append(pcDir, dir)
318+
}
319+
325320
if len(pcDir) > 0 {
326-
os.Setenv("PKG_CONFIG_PATH", pc.AppendPCPath(strings.Join(pcDir, ":")))
321+
pcDir = append(pcDir, os.Getenv("PKG_CONFIG_PATH"))
322+
os.Setenv("PKG_CONFIG_PATH", strings.Join(pcDir, ":"))
327323
}
328324
}
329325

@@ -348,7 +344,9 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs
348344
}
349345
built[pkg.ID] = none{}
350346

351-
setDepsPC(ctx, pkg)
347+
if isLLPkg(pkg) {
348+
setDepsPC(ctx, pkg)
349+
}
352350

353351
switch kind, param := cl.PkgKindOf(pkg.Types); kind {
354352
case cl.PkgDeclOnly:

0 commit comments

Comments
 (0)