Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #100 from gz-c/asmflags
Browse files Browse the repository at this point in the history
Support -asmflags [fixes #91]
  • Loading branch information
mattfarina authored Jan 2, 2018
2 parents b48e090 + a94a2a1 commit 50c78f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type CompileOpts struct {
OutputTpl string
Ldflags string
Gcflags string
Asmflags string
Tags string
Cgo bool
Rebuild bool
Expand Down Expand Up @@ -109,6 +110,7 @@ func GoCrossCompile(opts *CompileOpts) error {
args = append(args,
"-gcflags", opts.Gcflags,
"-ldflags", opts.Ldflags,
"-asmflags", opts.Asmflags,
"-tags", opts.Tags,
"-o", outputPathReal,
opts.PackagePath)
Expand Down
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func realMain() int {
var platformFlag PlatformFlag
var tags string
var verbose bool
var flagGcflags string
var flagGcflags, flagAsmflags string
var flagCgo, flagRebuild, flagListOSArch bool
var flagGoCmd string
flags := flag.NewFlagSet("gox", flag.ExitOnError)
Expand All @@ -41,6 +41,7 @@ func realMain() int {
flags.BoolVar(&flagRebuild, "rebuild", false, "")
flags.BoolVar(&flagListOSArch, "osarch-list", false, "")
flags.StringVar(&flagGcflags, "gcflags", "", "")
flags.StringVar(&flagAsmflags, "asmflags", "", "")
flags.StringVar(&flagGoCmd, "gocmd", "go", "")
if err := flags.Parse(os.Args[1:]); err != nil {
flags.Usage()
Expand Down Expand Up @@ -130,6 +131,7 @@ func realMain() int {
OutputTpl: outputTpl,
Ldflags: ldflags,
Gcflags: flagGcflags,
Asmflags: flagAsmflags,
Tags: tags,
Cgo: flagCgo,
Rebuild: flagRebuild,
Expand All @@ -140,6 +142,7 @@ func realMain() int {
// GOOS/GOARCH combo and override the defaults if so.
envOverride(&opts.Ldflags, platform, "LDFLAGS")
envOverride(&opts.Gcflags, platform, "GCFLAGS")
envOverride(&opts.Asmflags, platform, "ASMFLAGS")

if err := GoCrossCompile(opts); err != nil {
errorLock.Lock()
Expand Down Expand Up @@ -182,6 +185,7 @@ Options:
-cgo Sets CGO_ENABLED=1, requires proper C toolchain (advanced)
-gcflags="" Additional '-gcflags' value to pass to go build
-ldflags="" Additional '-ldflags' value to pass to go build
-asmflags="" Additional '-asmflags' value to pass to go build
-tags="" Additional '-tags' value to pass to go build
-os="" Space-separated list of operating systems to build for
-osarch="" Space-separated list of os/arch pairs to build for
Expand Down Expand Up @@ -220,11 +224,12 @@ Platforms (OS/Arch):
Platform Overrides:
The "-gcflags" and "-ldflags" options can be overridden per-platform
The "-gcflags", "-ldflags" and "-asmflags" options can be overridden per-platform
by using environment variables. Gox will look for environment variables
in the following format and use those to override values if they exist:
GOX_[OS]_[ARCH]_GCFLAGS
GOX_[OS]_[ARCH]_LDFLAGS
GOX_[OS]_[ARCH]_ASMFLAGS
`

0 comments on commit 50c78f8

Please sign in to comment.