aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-01 16:47:55 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-03-02 17:43:06 +0800
commitf972691eea59a631ac78a9cfc1170cfce615cc66 (patch)
tree9a062757d8aca95ea4d31a7b00defd6b608d90d0
parent230cf2ec9142b6a8f421cb8873deb5df1566e89c (diff)
downloadgo-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar.gz
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar.bz2
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar.lz
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar.xz
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.tar.zst
go-tangerine-f972691eea59a631ac78a9cfc1170cfce615cc66.zip
travis: support building mips32 and mips64 too
-rw-r--r--.travis.yml26
-rw-r--r--Makefile34
-rw-r--r--build/ci.go41
3 files changed, 78 insertions, 23 deletions
diff --git a/.travis.yml b/.travis.yml
index 8ea8704ff..7f7168854 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -66,6 +66,32 @@ matrix:
# - CC=aarch64-linux-gnu-gcc go run build/ci.go install -arch arm64
# - go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
+ # This builder does the Linux Azure MIPS xgo uploads
+ - os: linux
+ dist: trusty
+ sudo: required
+ services:
+ - docker
+ go: 1.8
+ env:
+ - azure-linux-mips
+ script:
+ - go run build/ci.go xgo --alltools -- --targets=linux/mips --ldflags '-extldflags "-static"' -v
+ - for bin in build/bin/*-linux-mips; do mv -f "${bin}" "${bin/-linux-mips/}"; done
+ - go run build/ci.go archive -arch mips -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
+
+ - go run build/ci.go xgo --alltools -- --targets=linux/mipsle --ldflags '-extldflags "-static"' -v
+ - for bin in build/bin/*-linux-mipsle; do mv -f "${bin}" "${bin/-linux-mipsle/}"; done
+ - go run build/ci.go archive -arch mipsle -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
+
+ - go run build/ci.go xgo --alltools -- --targets=linux/mips64 --ldflags '-extldflags "-static"' -v
+ - for bin in build/bin/*-linux-mips64; do mv -f "${bin}" "${bin/-linux-mips64/}"; done
+ - go run build/ci.go archive -arch mips64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
+
+ - go run build/ci.go xgo --alltools -- --targets=linux/mips64le --ldflags '-extldflags "-static"' -v
+ - for bin in build/bin/*-linux-mips64le; do mv -f "${bin}" "${bin/-linux-mips64le/}"; done
+ - go run build/ci.go archive -arch mips64le -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
+
# This builder is a temporary fallback for building ARM64 while Go 1.8 is fixed
- os: linux
dist: trusty
diff --git a/Makefile b/Makefile
index a1bc1cef4..4bd5612be 100644
--- a/Makefile
+++ b/Makefile
@@ -51,12 +51,12 @@ geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 get
@ls -ld $(GOBIN)/geth-linux-*
geth-linux-386:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/386 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
@echo "Linux 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep 386
geth-linux-amd64:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/amd64 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
@echo "Linux amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep amd64
@@ -65,32 +65,42 @@ geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-ar
@ls -ld $(GOBIN)/geth-linux-* | grep arm
geth-linux-arm-5:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-5 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
@echo "Linux ARMv5 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-5
geth-linux-arm-6:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-6 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
@echo "Linux ARMv6 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-6
geth-linux-arm-7:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-7 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
@echo "Linux ARMv7 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-7
geth-linux-arm64:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/arm64 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
@echo "Linux ARM64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm64
+geth-linux-mips:
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
+ @echo "Linux MIPS cross compilation done:"
+ @ls -ld $(GOBIN)/geth-linux-* | grep mips
+
+geth-linux-mipsle:
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
+ @echo "Linux MIPSle cross compilation done:"
+ @ls -ld $(GOBIN)/geth-linux-* | grep mipsle
+
geth-linux-mips64:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/mips64 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
@echo "Linux MIPS64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mips64
geth-linux-mips64le:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=linux/mips64le -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
@echo "Linux MIPS64le cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mips64le
@@ -99,12 +109,12 @@ geth-darwin: geth-darwin-386 geth-darwin-amd64
@ls -ld $(GOBIN)/geth-darwin-*
geth-darwin-386:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=darwin/386 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
@echo "Darwin 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-darwin-* | grep 386
geth-darwin-amd64:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=darwin/amd64 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
@echo "Darwin amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-darwin-* | grep amd64
@@ -113,11 +123,11 @@ geth-windows: geth-windows-386 geth-windows-amd64
@ls -ld $(GOBIN)/geth-windows-*
geth-windows-386:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=windows/386 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
@echo "Windows 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-windows-* | grep 386
geth-windows-amd64:
- build/env.sh go run build/ci.go xgo -- --go=$(GO) --dest=$(GOBIN) --targets=windows/amd64 -v ./cmd/geth
+ build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
@echo "Windows amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-windows-* | grep amd64
diff --git a/build/ci.go b/build/ci.go
index d8c76567c..8b6d2d5e0 100644
--- a/build/ci.go
+++ b/build/ci.go
@@ -23,15 +23,15 @@ Usage: go run ci.go <command> <command flags/arguments>
Available commands are:
- install [-arch architecture] [ packages... ] -- builds packages and executables
- test [ -coverage ] [ -vet ] [ -misspell ] [ packages... ] -- runs the tests
- archive [-arch architecture] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
- importkeys -- imports signing keys from env
- debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
- nsis -- creates a Windows NSIS installer
- aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
- xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
- xgo [ options ] -- cross builds according to options
+ install [ -arch architecture ] [ packages... ] -- builds packages and executables
+ test [ -coverage ] [ -vet ] [ -misspell ] [ packages... ] -- runs the tests
+ archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
+ importkeys -- imports signing keys from env
+ debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
+ nsis -- creates a Windows NSIS installer
+ aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
+ xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
+ xgo [ -alltools ] [ options ] -- cross builds according to options
For all commands, -n prevents execution of external programs (dry run mode).
@@ -917,6 +917,9 @@ func newPodMetadata(env build.Environment, archive string) podMetadata {
// Cross compilation
func doXgo(cmdline []string) {
+ var (
+ alltools = flag.Bool("alltools", false, `Flag whether we're building all known tools, or only on in particular`)
+ )
flag.CommandLine.Parse(cmdline)
env := build.Env()
@@ -924,8 +927,24 @@ func doXgo(cmdline []string) {
gogetxgo := goTool("get", "github.com/karalabe/xgo")
build.MustRun(gogetxgo)
- // Execute the actual cross compilation
- xgo := xgoTool(append(buildFlags(env), flag.Args()...))
+ // If all tools building is requested, build everything the builder wants
+ args := append(buildFlags(env), flag.Args()...)
+ args = append(args, []string{"--dest", GOBIN}...)
+
+ if *alltools {
+ for _, res := range allToolsArchiveFiles {
+ if strings.HasPrefix(res, GOBIN) {
+ // Binary tool found, cross build it explicitly
+ args = append(args, "./"+filepath.Join("cmd", filepath.Base(res)))
+ xgo := xgoTool(args)
+ build.MustRun(xgo)
+ args = args[:len(args)-1]
+ }
+ }
+ return
+ }
+ // Otherwise xxecute the explicit cross compilation
+ xgo := xgoTool(args)
build.MustRun(xgo)
}