From 4d50d5fe24d6396dfe5b58ebc8d759fe70512465 Mon Sep 17 00:00:00 2001 From: olebeck <31539311+olebeck@users.noreply.github.com> Date: Sun, 14 Aug 2022 16:12:33 +0200 Subject: [PATCH] add multi arch builds --- Makefile | 33 +++++++++++++++++---------------- utils.go | 6 ++++++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 1eb5fe9..74f27a4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GC = go build -ldflags "-s -w" TAG = $(shell git describe --tags) -NAME = bedrocktool_${TAG} +NAME = bedrocktool-${TAG} SRCS = $(wildcard *.go) @@ -18,26 +18,27 @@ GC += -overlay overlay.json endif - -all: windows linux - -.PHONY: all clean windows linux mac - -windows: $(NAME).exe -linux: $(NAME)-linux -mac: $(NAME)-mac +BUILDS=\ + windows_amd64.exe\ + windows_arm64.exe\ + darwin_amd64\ + darwin_arm64\ + linux_amd64\ + linux_arm64 -$(NAME).exe: $(SRCS) - echo TAG: ${TAG} - GOOS=windows $(GC) -o $@ +DISTS=$(BUILDS:%=$(NAME)_%) -$(NAME)-linux: $(SRCS) - GOOS=linux $(GC) -o $@ +all: $(DISTS) -$(NAME)-mac: $(SRCS) - GOOS=darwin $(GC) -o $@ +.PHONY: all clean $(DISTS) +$(DISTS): OS = $(word 2,$(subst _, ,$@)) +$(DISTS): ARCH = $(word 1,$(subst ., ,$(word 3,$(subst _, ,$@)))) + +$(DISTS): $(SRCS) + @echo "building: $@" + GOOS=$(OS) GOARCH=$(ARCH) $(GC) -o $@ clean: rm $(NAME).exe $(NAME)-linux $(NAME)-mac \ No newline at end of file diff --git a/utils.go b/utils.go index c340f83..7b124dc 100644 --- a/utils.go +++ b/utils.go @@ -134,6 +134,12 @@ func spawn_conn(ctx context.Context, clientConn *minecraft.Conn, serverConn *min } func create_proxy(ctx context.Context, server_address string) (l *minecraft.Listener, clientConn, serverConn *minecraft.Conn, err error) { + /* + if strings.HasSuffix(server_address, ".pcap") { + return create_replay_connection(server_address) + } + */ + _status := minecraft.NewStatusProvider("Server") listener, err := minecraft.ListenConfig{ StatusProvider: _status,