diff --git a/Makefile b/Makefile index 2800b9605f..9efb7447cd 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,7 @@ # with Go source code. If you know what GOPATH is then you probably # don't need to bother with make. -.PHONY: XDC XDC-cross evm all test clean -.PHONY: XDC-linux XDC-linux-386 XDC-linux-amd64 XDC-linux-mips64 XDC-linux-mips64le -.PHONY: XDC-darwin XDC-darwin-386 XDC-darwin-amd64 +.PHONY: XDC evm all test clean GOBIN = $(shell pwd)/build/bin GO ?= 1.25.1 @@ -94,62 +92,3 @@ help: Makefile @echo '' @echo 'Targets:' @sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /' - -# Cross Compilation Targets (xgo) - -XDC-cross: XDC-windows-amd64 XDC-darwin-amd64 XDC-linux - @echo "Full cross compilation done:" - @ls -ld $(GOBIN)/XDC-* - -XDC-linux: XDC-linux-386 XDC-linux-amd64 XDC-linux-mips64 XDC-linux-mips64le - @echo "Linux cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* - -XDC-linux-386: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/XDC - @echo "Linux 386 cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep 386 - -XDC-linux-amd64: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/XDC - @echo "Linux amd64 cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep amd64 - -XDC-linux-mips: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/XDC - @echo "Linux MIPS cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep mips - -XDC-linux-mipsle: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/XDC - @echo "Linux MIPSle cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep mipsle - -XDC-linux-mips64: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/XDC - @echo "Linux MIPS64 cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep mips64 - -XDC-linux-mips64le: - go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/XDC - @echo "Linux MIPS64le cross compilation done:" - @ls -ld $(GOBIN)/XDC-linux-* | grep mips64le - -XDC-darwin: XDC-darwin-386 XDC-darwin-amd64 - @echo "Darwin cross compilation done:" - @ls -ld $(GOBIN)/XDC-darwin-* - -XDC-darwin-386: - go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/XDC - @echo "Darwin 386 cross compilation done:" - @ls -ld $(GOBIN)/XDC-darwin-* | grep 386 - -XDC-darwin-amd64: - go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/XDC - @echo "Darwin amd64 cross compilation done:" - @ls -ld $(GOBIN)/XDC-darwin-* | grep amd64 - -XDC-windows-amd64: - go run build/ci.go xgo -- --go=$(GO) -buildmode=mode -x --targets=windows/amd64 -v ./cmd/XDC - @echo "Windows amd64 cross compilation done:" - @ls -ld $(GOBIN)/XDC-windows-* | grep amd64 diff --git a/build/ci.go b/build/ci.go index a977088668..8456ac5ca4 100644 --- a/build/ci.go +++ b/build/ci.go @@ -105,8 +105,6 @@ func main() { doGenerate() case "baddeps": doBadDeps() - case "xgo": - doXgo(os.Args[2:]) default: log.Fatal("unknown command ", os.Args[1]) } @@ -529,55 +527,3 @@ func downloadProtoc(cachedir string) string { } return extractDest } - -// 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() - - // Make sure xgo is available for cross compilation - tc := build.GoToolchain{} - gogetxgo := tc.Go("get", "github.com/karalabe/xgo") - build.MustRun(gogetxgo) - - // If all tools building is requested, build everything the builder wants - args := append(buildFlags(env, false, nil), flag.Args()...) - - if *alltools { - args = append(args, []string{"--dest", GOBIN}...) - 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 - path := args[len(args)-1] - args = append(args[:len(args)-1], []string{"--dest", GOBIN, path}...) - - xgo := xgoTool(args) - build.MustRun(xgo) -} - -func xgoTool(args []string) *exec.Cmd { - cmd := exec.Command(filepath.Join(GOBIN, "xgo"), args...) - cmd.Env = []string{ - "GOPATH=" + build.GOPATH(), - "GOBIN=" + GOBIN, - } - for _, e := range os.Environ() { - if strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "GOBIN=") { - continue - } - cmd.Env = append(cmd.Env, e) - } - return cmd -} diff --git a/internal/build/util.go b/internal/build/util.go index 8d36c36961..efce327069 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -249,13 +249,3 @@ func FindAllPackages(tc *GoToolchain) []string { } return result } - -// GOPATH returns the value that the GOPATH environment -// variable should be set to. -func GOPATH() string { - gopath := os.Getenv("GOPATH") - if gopath == "" { - log.Fatal("GOPATH is not set") - } - return gopath -}