Compile 386 builds with "GO386=387" for maximum compatibility #437

This commit is contained in:
Nick Craig-Wood 2017-05-09 11:58:29 +01:00
parent 58a82cd578
commit 5135ff73cb

View File

@ -49,6 +49,11 @@ var osarches = []string{
"solaris/amd64", "solaris/amd64",
} }
// Special environment flags for a given arch
var archFlags = map[string][]string{
"386": {"GO386=387"},
}
// runEnv - run a shell command with env // runEnv - run a shell command with env
func runEnv(args, env []string) { func runEnv(args, env []string) {
if *debug { if *debug {
@ -60,6 +65,9 @@ func runEnv(args, env []string) {
if env != nil { if env != nil {
cmd.Env = append(os.Environ(), env...) cmd.Env = append(os.Environ(), env...)
} }
if *debug {
log.Printf("args = %v, env = %v\n", args, cmd.Env)
}
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
log.Fatalf("Failed to run %v: %v", args, err) log.Fatalf("Failed to run %v: %v", args, err)
@ -94,6 +102,9 @@ func compileArch(version, goos, goarch, dir string) {
"GOARCH=" + goarch, "GOARCH=" + goarch,
"CGO_ENABLED=0", "CGO_ENABLED=0",
} }
if flags, ok := archFlags[goarch]; ok {
env = append(env, flags...)
}
runEnv(args, env) runEnv(args, env)
// Now build the zip // Now build the zip
run("cp", "-a", "../MANUAL.txt", filepath.Join(dir, "README.txt")) run("cp", "-a", "../MANUAL.txt", filepath.Join(dir, "README.txt"))