allow building shared library on M1 Macs

Seems like this wasn't supported in the past, but should work now.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-01-25 14:59:54 +01:00
parent 1d9d7343c3
commit 4a4ae4c264
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 2 additions and 6 deletions

View File

@ -17,14 +17,10 @@ endif
ifeq ($(detected_OS),Darwin)
GOBIN_SHARED_LIB_EXT := dylib
# Building on M1 is still not supported, so in the meantime we crosscompile by default to amd64
ifeq ("$(shell sysctl -nq hw.optional.arm64)","1")
FORCE_ARCH ?= amd64
GOBIN_SHARED_LIB_CFLAGS=CGO_ENABLED=1 GOOS=darwin GOARCH=$(FORCE_ARCH)
endif
GOBIN_SHARED_LIB_CFLAGS := CGO_ENABLED=1 GOOS=darwin
else ifeq ($(detected_OS),Windows)
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS=""
GOBIN_SHARED_LIB_EXT := dll
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS=""
else
GOBIN_SHARED_LIB_EXT := so
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS="-Wl,-soname,libstatus.so.0"