add multi arch builds

This commit is contained in:
olebeck 2022-08-14 16:12:33 +02:00
parent 8c8892abb7
commit 4d50d5fe24
2 changed files with 23 additions and 16 deletions

View File

@ -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

View File

@ -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,