1
mirror of https://github.com/rclone/rclone synced 2024-12-22 13:03:02 +01:00

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