From 71e9986283be0bcca84da77d6f15e2b130738182 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 2 Dec 2017 18:44:20 -0800 Subject: [PATCH] mage: support ppc64, arm, 386 and arm64 binaries --- mage.go | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/mage.go b/mage.go index e350fa5..49fcac0 100644 --- a/mage.go +++ b/mage.go @@ -19,12 +19,15 @@ import ( ) var wd string +var arches []string func init() { lwd, err := os.Getwd() qod.ANE(err) wd = lwd + + arches = []string{"amd64", "ppc64", "386", "arm", "arm64"} } const pkgBase = "git.xeserv.us/xena/route/" @@ -120,8 +123,9 @@ func Docker() { // Linux builds binaries for linux func Linux() { - buildBins("linux", "amd64") - buildBins("linux", "ppc64") + for _, arch := range arches { + buildBins("linux", arch) + } Plugin() } @@ -167,22 +171,30 @@ func Package() { ver, err := gitTag() qod.ANE(err) - for _, osname := range []string{"linux", "windows", "darwin"} { - dir, err := ioutil.TempDir("", "route-package-"+osname) - qod.ANE(err) - qod.Printlnf("%s", dir) - - for _, file := range []string{"route-cli", "route-httpagent", "routed"} { - if osname == "windows" { - file = file + ".exe" + for _, arch := range arches { + for _, osname := range []string{"linux", "windows", "darwin"} { + if arch != "amd64" && osname != "linux" { + continue } - shouldWork(ctx, nil, filepath.Join(wd, "bin", osname), "cp", "-rf", file, dir) + + dir, err := ioutil.TempDir("", "route-package-"+osname+"-"+arch) + qod.ANE(err) + qod.Printlnf("%s", dir) + + for _, file := range []string{"route-cli", "route-httpagent", "routed"} { + if osname == "windows" { + file = file + ".exe" + } + shouldWork(ctx, nil, filepath.Join(wd, "bin", osname, arch), "cp", "-rf", file, dir) + } + + shouldWork(ctx, nil, wd, "cp", "-rf", "doc", dir) + shouldWork(ctx, nil, wd, "cp", "-rf", "README.md", dir) + shouldWork(ctx, nil, wd, "cp", "-rf", "LICENSE", dir) + shouldWork(ctx, nil, wd, "cp", "-rf", "Gopkg.lock", dir) + + shouldWork(ctx, nil, dir, "tar", "czf", filepath.Join(wd, "bin", fmt.Sprintf("route-%s-%s-%s.tar.gz", ver, osname, arch)), ".") } - - shouldWork(ctx, nil, wd, "cp", "-rf", "doc", dir) - shouldWork(ctx, nil, wd, "cp", "-rf", "README.md", dir) - - shouldWork(ctx, nil, dir, "tar", "czf", filepath.Join(wd, "bin", fmt.Sprintf("route-%s-%s.tar.gz", ver, osname)), ".") } }