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.
This commit is contained in:
Zack Middleton 2021-10-24 04:38:34 -04:00
parent 75ae9119e6
commit 9543cf24df

View file

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