From 9543cf24df4c641deac88cce47c030d7562e3c39 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 24 Oct 2021 04:38:34 -0400 Subject: [PATCH] Fix compiling on older macOS ranlib errors on older macOS because of arm64 arch in code/libs/macosx/- libSDL2main.a. Use lipo to extract the library for the specific arch that is being linked. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 6a88946f..9e535559 100644 --- a/Makefile +++ b/Makefile @@ -525,6 +525,7 @@ ifeq ($(PLATFORM),darwin) CC=$(MACOSX_ARCH)-apple-darwin$(DARWIN)-cc RANLIB=$(MACOSX_ARCH)-apple-darwin$(DARWIN)-ranlib + LIPO=$(MACOSX_ARCH)-apple-darwin$(DARWIN)-lipo ifeq ($(call bin_path, $(CC)),) $(error Unable to find osxcross $(CC)) @@ -532,6 +533,10 @@ ifeq ($(PLATFORM),darwin) endif endif + ifndef LIPO + LIPO=lipo + endif + BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe ifeq ($(USE_OPENAL),1) @@ -2275,7 +2280,11 @@ endif ifneq ($(strip $(LIBSDLMAIN)),) ifneq ($(strip $(LIBSDLMAINSRC)),) $(LIBSDLMAIN) : $(LIBSDLMAINSRC) +ifeq ($(PLATFORM),darwin) + $(LIPO) -extract $(MACOSX_ARCH) $< -o $@ +else cp $< $@ +endif $(RANLIB) $@ endif endif