From 0e01f06caf942502fa402a95e79c42faa0597cdf Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 6 Oct 2021 09:13:02 -0400 Subject: [PATCH] add m1 support --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5222062..ddb90fd 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ endif ifeq ($(detected_OS),Darwin) LIB_EXT := dylib + ifeq ("$(shell sysctl -nq hw.optional.arm64)","1") + # Building on M1 is still not supported, so in the meantime we crosscompile to amd64 + CGOFLAGS=CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 + endif else ifeq ($(detected_OS),Windows) LIB_EXT:= dll LIBKEYCARD_EXT := dll @@ -20,6 +24,6 @@ endif build-lib: mkdir -p $(BUILD)/libkeycard @echo "Building static library..." - go build -buildmode=c-shared -o $(BUILD)/libkeycard/libkeycard.$(LIB_EXT) . + $(CGOFLAGS) go build -buildmode=c-shared -o $(BUILD)/libkeycard/libkeycard.$(LIB_EXT) . @echo "Static library built:" @ls -la $(BUILD)/libkeycard/*