cmd/gogio: add -tags flag for supplying extra tags to the build

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-22 20:57:35 +02:00
parent 342c0da320
commit 5bd0ecea5e
5 changed files with 8 additions and 1 deletions
+1
View File
@@ -203,6 +203,7 @@ func compileAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err erro
"build",
"-ldflags=-w -s "+bi.ldflags,
"-buildmode=c-shared",
"-tags", bi.tags,
"-o", libFile,
bi.pkg,
)
+2
View File
@@ -34,6 +34,8 @@ and archive. Buildmode exe outputs an .ipa file for iOS or tvOS, an .apk file
for Android or a directory with the WebAssembly module and support files for
a browser.
The -ldflags and -tags flags pass extra linker flags and tags to the go tool.
As a special case for iOS or tvOS, specifying a path that ends with ".app"
will output an app directory suitable for a simulator.
+1 -1
View File
@@ -411,7 +411,7 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
"-ldflags=-s -w "+bi.ldflags,
"-buildmode=c-archive",
"-o", lib,
"-tags", "ios",
"-tags", "ios "+bi.tags,
bi.pkg,
)
lipo.Args = append(lipo.Args, lib)
+1
View File
@@ -22,6 +22,7 @@ func buildJS(bi *buildInfo) error {
"go",
"build",
"-ldflags="+bi.ldflags,
"-tags="+bi.tags,
"-o", filepath.Join(out, "main.wasm"),
bi.pkg,
)
+3
View File
@@ -33,12 +33,14 @@ var (
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
extraLdflags = flag.String("ldflags", "", "extra flags to the Go linker")
extraTags = flag.String("tags", "", "extra tags to the Go tool")
)
type buildInfo struct {
name string
pkg string
ldflags string
tags string
target string
appID string
version int
@@ -96,6 +98,7 @@ func mainErr() error {
dir: dir,
version: *version,
minsdk: *minsdk,
tags: *extraTags,
}
if bi.appID == "" {
bi.appID = appIDFromPackage(pkgPath)