build: support packages out of llgo
This commit is contained in:
@@ -200,7 +200,9 @@ func buildAllPkgs(prog llssa.Program, initial []*packages.Package, mode Mode, ve
|
|||||||
if isPkgInLLGo(pkgPath) {
|
if isPkgInLLGo(pkgPath) {
|
||||||
pkg.ExportFile = concatPkgLinkFiles(pkgPath)
|
pkg.ExportFile = concatPkgLinkFiles(pkgPath)
|
||||||
} else {
|
} else {
|
||||||
panic("todo")
|
// panic("todo")
|
||||||
|
// TODO(xsw): support packages out of llgo
|
||||||
|
pkg.ExportFile = ""
|
||||||
}
|
}
|
||||||
if kind == cl.PkgLinkExtern { // need to be linked with external library
|
if kind == cl.PkgLinkExtern { // need to be linked with external library
|
||||||
linkFile := os.ExpandEnv(strings.TrimSpace(param))
|
linkFile := os.ExpandEnv(strings.TrimSpace(param))
|
||||||
@@ -209,10 +211,10 @@ func buildAllPkgs(prog llssa.Program, initial []*packages.Package, mode Mode, ve
|
|||||||
if dir != "" {
|
if dir != "" {
|
||||||
command += " -L " + dir
|
command += " -L " + dir
|
||||||
}
|
}
|
||||||
if isMultiLinkFiles(pkg.ExportFile) {
|
if isSingleLinkFile(pkg.ExportFile) {
|
||||||
pkg.ExportFile = command + pkg.ExportFile
|
|
||||||
} else {
|
|
||||||
pkg.ExportFile = command + " " + pkg.ExportFile
|
pkg.ExportFile = command + " " + pkg.ExportFile
|
||||||
|
} else {
|
||||||
|
pkg.ExportFile = command + pkg.ExportFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -454,14 +456,14 @@ func llgoRoot() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func appendLinkFiles(args []string, file string) []string {
|
func appendLinkFiles(args []string, file string) []string {
|
||||||
if isMultiLinkFiles(file) {
|
if isSingleLinkFile(file) {
|
||||||
return append(args, strings.Split(file[1:], " ")...)
|
return append(args, file)
|
||||||
}
|
}
|
||||||
return append(args, file)
|
return append(args, strings.Split(file[1:], " ")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isMultiLinkFiles(ret string) bool {
|
func isSingleLinkFile(ret string) bool {
|
||||||
return len(ret) > 0 && ret[0] == ' '
|
return len(ret) > 0 && ret[0] != ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
func concatPkgLinkFiles(pkgPath string) string {
|
func concatPkgLinkFiles(pkgPath string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user