main: add support for -tags flags

Этот коммит содержится в:
Ayke van Laethem 2019-05-22 17:11:41 +02:00 коммит произвёл Ron Evans
родитель 16201c41dc
коммит fa5855bff5

Просмотреть файл

@ -53,6 +53,7 @@ type BuildConfig struct {
printSizes string printSizes string
cFlags []string cFlags []string
ldFlags []string ldFlags []string
tags string
wasmAbi string wasmAbi string
testConfig compiler.TestConfig testConfig compiler.TestConfig
} }
@ -92,6 +93,9 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
for i := 1; i <= minor; i++ { for i := 1; i <= minor; i++ {
tags = append(tags, fmt.Sprintf("go1.%d", i)) tags = append(tags, fmt.Sprintf("go1.%d", i))
} }
if extraTags := strings.Fields(config.tags); len(extraTags) != 0 {
tags = append(tags, extraTags...)
}
compilerConfig := compiler.Config{ compilerConfig := compiler.Config{
Triple: spec.Triple, Triple: spec.Triple,
CPU: spec.CPU, CPU: spec.CPU,
@ -584,6 +588,7 @@ func main() {
printIR := flag.Bool("printir", false, "print LLVM IR") printIR := flag.Bool("printir", false, "print LLVM IR")
dumpSSA := flag.Bool("dumpssa", false, "dump internal Go SSA") dumpSSA := flag.Bool("dumpssa", false, "dump internal Go SSA")
target := flag.String("target", "", "LLVM target") target := flag.String("target", "", "LLVM target")
tags := flag.String("tags", "", "a space-separated list of extra build tags")
printSize := flag.String("size", "", "print sizes (none, short, full)") printSize := flag.String("size", "", "print sizes (none, short, full)")
nodebug := flag.Bool("no-debug", false, "disable DWARF debug symbol generation") nodebug := flag.Bool("no-debug", false, "disable DWARF debug symbol generation")
ocdOutput := flag.Bool("ocd-output", false, "print OCD daemon output during debug") ocdOutput := flag.Bool("ocd-output", false, "print OCD daemon output during debug")
@ -608,6 +613,7 @@ func main() {
dumpSSA: *dumpSSA, dumpSSA: *dumpSSA,
debug: !*nodebug, debug: !*nodebug,
printSizes: *printSize, printSizes: *printSize,
tags: *tags,
wasmAbi: *wasmAbi, wasmAbi: *wasmAbi,
} }