build: PkgLinkExtern
This commit is contained in:
@@ -167,12 +167,12 @@ func buildAllPkgs(prog llssa.Program, initial []*packages.Package, mode Mode, ve
|
||||
}
|
||||
for _, aPkg := range pkgs {
|
||||
pkg := aPkg.Package
|
||||
switch kind := cl.PkgKindOf(pkg.Types); kind {
|
||||
switch kind, param := cl.PkgKindOf(pkg.Types); kind {
|
||||
case cl.PkgDeclOnly:
|
||||
// skip packages that only contain declarations
|
||||
// and set no export file
|
||||
pkg.ExportFile = ""
|
||||
case cl.PkgLinkIR: // cl.PkgLinkBitCode:
|
||||
case cl.PkgLinkIR:
|
||||
// skip packages that don't need to be compiled but need to be linked
|
||||
pkgPath := pkg.PkgPath
|
||||
if isPkgInLLGo(pkgPath) {
|
||||
@@ -180,6 +180,15 @@ func buildAllPkgs(prog llssa.Program, initial []*packages.Package, mode Mode, ve
|
||||
} else {
|
||||
panic("todo")
|
||||
}
|
||||
case cl.PkgLinkExtern:
|
||||
// skip packages that don't need to be compiled but need to be linked with external library
|
||||
linkFile := os.ExpandEnv(strings.TrimSpace(param))
|
||||
dir, lib := filepath.Split(linkFile)
|
||||
command := " -l " + lib
|
||||
if dir != "" {
|
||||
command += " -L " + dir
|
||||
}
|
||||
pkg.ExportFile = command
|
||||
default:
|
||||
buildPkg(prog, aPkg, mode, verbose)
|
||||
if prog.NeedRuntime() {
|
||||
|
||||
Reference in New Issue
Block a user