Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ var targets = []tuple{
{"windows", "amd64"},
}

var pie = map[tuple]bool{
{"darwin", "amd64"}: true,
{"darwin", "arm64"}: true,
{"linux", "amd64"}: true,
{"linux", "arm64"}: true,
{"windows", "386"}: true,
{"windows", "amd64"}: true,
}

type dist struct {
dist string
relver string
Expand Down Expand Up @@ -286,8 +295,12 @@ func readassetpath(builddir string, prog string) string {
func build(tool, builddir, goos, arch, ldflags string) {
exe := exeName(tool, goos)
out := filepath.Join("..", "bin", goos+"-"+arch, exe)
buildmode := "-buildmode=exe"
if pie[tuple{goos, arch}] {
buildmode = "-buildmode=pie"
}
log.Printf("build: %s", out[3:]) // trim off leading "../"
gocmd(goos, arch, builddir, "build", "-trimpath", "-tags", tags, "-o", out, "-ldflags", ldflags, tool)
gocmd(goos, arch, builddir, "build", "-trimpath", "-tags", tags, "-o", out, "-ldflags", ldflags, buildmode, tool)
}

func gocmd(goos, arch, builddir string, args ...string) {
Expand Down