mage: build ppc64 binaries

This commit is contained in:
Cadey Ratio 2017-12-02 15:45:56 -08:00
parent 877ea527ab
commit 884cf5a0e2
1 changed files with 12 additions and 13 deletions

25
mage.go
View File

@ -88,22 +88,20 @@ func goBuildPlugin(ctx context.Context, dir, pkgname, fname string) {
qod.Printlnf("built %s for %s", fname, runtime.GOOS) qod.Printlnf("built %s for %s", fname, runtime.GOOS)
} }
func buildBins(goos string) { func buildBins(goos, goarch string) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
d := filepath.Join(wd, "./bin") d := filepath.Join(wd, "./bin")
os.Mkdir(filepath.Join(d, goos), 0777) os.Mkdir(filepath.Join(d, goos, goarch), 0777)
for _, pkg := range []string{"route-httpagent", "route-cli", "routed"} { for _, pkg := range []string{"route-httpagent", "route-cli", "routed", "terraform-provider-route"} {
goBuild(ctx, []string{"GOOS=" + goos}, filepath.Join(d, goos), "cmd/"+pkg) env := []string{"GOOS=" + goos, "GOARCH=" + goarch}
goBuild(ctx, env, filepath.Join(d, goos, goarch), "cmd/"+pkg)
goInstall(ctx, env, "cmd/"+pkg)
if goos == runtime.GOOS { qod.Printlnf("built binary for %s for %s/%s", pkg, goos, goarch)
goInstall(ctx, nil, "cmd/"+pkg)
}
qod.Printlnf("built binary for %s for os %s", pkg, goos)
} }
} }
@ -122,23 +120,24 @@ func Docker() {
// Linux builds binaries for linux // Linux builds binaries for linux
func Linux() { func Linux() {
buildBins("linux") buildBins("linux", "amd64")
buildBins("linux", "ppc64")
Plugin() Plugin()
} }
// Windows builds binaries for windows // Windows builds binaries for windows
func Windows() { func Windows() {
buildBins("windows") buildBins("windows", "amd64")
} }
// Darwin builds binaries for darwin // Darwin builds binaries for darwin
func Darwin() { func Darwin() {
buildBins("darwin") buildBins("darwin", "amd64")
} }
// Build builds the binaries for route and routed. // Build builds the binaries for route and routed.
func Build() { func Build() {
buildBins(runtime.GOOS) buildBins(runtime.GOOS, runtime.GOARCH)
if runtime.GOOS == "linux" { if runtime.GOOS == "linux" {
Plugin() Plugin()