build: fix buildpkg

This commit is contained in:
visualfc
2024-07-11 11:37:55 +08:00
parent 222e58e76e
commit e192f01dc3

View File

@@ -254,7 +254,7 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs
cl.ParsePkgSyntax(ctx.prog, pkg.Types, pkg.Syntax)
pkg.ExportFile = ""
case cl.PkgLinkIR, cl.PkgLinkExtern, cl.PkgPyModule:
if isPkgInLLGo(pkg.PkgPath) {
if len(pkg.GoFiles) > 0 {
buildPkg(ctx, aPkg, verbose)
pkg.ExportFile = " " + concatPkgLinkFiles(pkg, verbose) + " " + pkg.ExportFile
} else {
@@ -648,22 +648,6 @@ func clFile(cFile, expFile string, procFile func(linkFile string), verbose bool)
procFile(llFile)
}
const (
llgoModPath = "github.com/goplus/llgo"
)
func isPkgInLLGo(pkgPath string) bool {
return isPkgInMod(pkgPath, llgoModPath)
}
func isPkgInMod(pkgPath, modPath string) bool {
if strings.HasPrefix(pkgPath, modPath) {
suffix := pkgPath[len(modPath):]
return suffix == "" || suffix[0] == '/'
}
return false
}
func pkgExists(initial []*packages.Package, pkg *packages.Package) bool {
for _, v := range initial {
if v == pkg {