mage: support ppc64, arm, 386 and arm64 binaries
This commit is contained in:
parent
ef62f2782e
commit
71e9986283
44
mage.go
44
mage.go
|
@ -19,12 +19,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var wd string
|
var wd string
|
||||||
|
var arches []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
lwd, err := os.Getwd()
|
lwd, err := os.Getwd()
|
||||||
qod.ANE(err)
|
qod.ANE(err)
|
||||||
|
|
||||||
wd = lwd
|
wd = lwd
|
||||||
|
|
||||||
|
arches = []string{"amd64", "ppc64", "386", "arm", "arm64"}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pkgBase = "git.xeserv.us/xena/route/"
|
const pkgBase = "git.xeserv.us/xena/route/"
|
||||||
|
@ -120,8 +123,9 @@ func Docker() {
|
||||||
|
|
||||||
// Linux builds binaries for linux
|
// Linux builds binaries for linux
|
||||||
func Linux() {
|
func Linux() {
|
||||||
buildBins("linux", "amd64")
|
for _, arch := range arches {
|
||||||
buildBins("linux", "ppc64")
|
buildBins("linux", arch)
|
||||||
|
}
|
||||||
Plugin()
|
Plugin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,22 +171,30 @@ func Package() {
|
||||||
ver, err := gitTag()
|
ver, err := gitTag()
|
||||||
qod.ANE(err)
|
qod.ANE(err)
|
||||||
|
|
||||||
for _, osname := range []string{"linux", "windows", "darwin"} {
|
for _, arch := range arches {
|
||||||
dir, err := ioutil.TempDir("", "route-package-"+osname)
|
for _, osname := range []string{"linux", "windows", "darwin"} {
|
||||||
qod.ANE(err)
|
if arch != "amd64" && osname != "linux" {
|
||||||
qod.Printlnf("%s", dir)
|
continue
|
||||||
|
|
||||||
for _, file := range []string{"route-cli", "route-httpagent", "routed"} {
|
|
||||||
if osname == "windows" {
|
|
||||||
file = file + ".exe"
|
|
||||||
}
|
}
|
||||||
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)), ".")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue