Skip to content

Commit

Permalink
use gcc for macOS builds
Browse files Browse the repository at this point in the history
fixes #26
  • Loading branch information
sauerbraten committed May 23, 2021
1 parent 9c7ac12 commit 4cb4c65
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ bin_unix/*
sauerbraten.app/Contents/MacOS/*
!/**/.gitkeep
data/p1xbraten/*gz
.vscode
32 changes: 30 additions & 2 deletions patches/macos_builds.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
Index: src/Makefile
===================================================================
--- src/Makefile (revision 6346)
--- src/Makefile (revision 6502)
+++ src/Makefile (working copy)
@@ -232,6 +232,9 @@
@@ -57,6 +57,8 @@
STRIP= $(TOOLCHAIN)strip
endif
endif
+CC= gcc-8 # gcc because of https://github.com/sauerbraten/p1xbraten/issues/26, 8 because that's the latest version available on AppVeyor
+CXX= gcc-8
OSXMIN= 10.9
override CC+= -arch x86_64 -mmacosx-version-min=$(OSXMIN)
override CXX+= -arch x86_64 -mmacosx-version-min=$(OSXMIN)
@@ -63,7 +65,7 @@
CLIENT_INCLUDES= $(INCLUDES) -Iinclude
CLIENT_LIBS= -F../sauerbraten.app/Contents/Frameworks/ -framework SDL2 -framework SDL2_image
CLIENT_LIBS+= -framework SDL2_mixer -framework CoreAudio -framework AudioToolbox
-CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet
+CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet -lc++
else
CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl2-config --cflags`
CLIENT_LIBS= -Lenet -lenet -L/usr/X11R6/lib -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL
@@ -142,6 +144,9 @@
else
SERVER_INCLUDES= -DSTANDALONE $(INCLUDES)
SERVER_LIBS= -Lenet -lenet -lz
+ifneq (,$(findstring DARWIN,$(PLATFORM)))
+SERVER_LIBS+= -lc++
+endif
MASTER_LIBS= $(SERVER_LIBS)
endif
SERVER_OBJS= \
@@ -221,6 +226,9 @@
ifneq (,$(findstring DARWIN,$(PLATFORM)))
install: client
cp sauer_client ../sauerbraten.app/Contents/MacOS/sauerbraten_universal
Expand Down
7 changes: 6 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ ifneq (,$(STRIP))
STRIP= $(TOOLCHAIN)strip
endif
endif
CC= gcc-8 # gcc because of https://github.com/sauerbraten/p1xbraten/issues/26, 8 because that's the latest version available on AppVeyor
CXX= gcc-8
OSXMIN= 10.9
override CC+= -arch x86_64 -mmacosx-version-min=$(OSXMIN)
override CXX+= -arch x86_64 -mmacosx-version-min=$(OSXMIN)
CLIENT_INCLUDES= $(INCLUDES) -Iinclude
CLIENT_LIBS= -F../sauerbraten.app/Contents/Frameworks/ -framework SDL2 -framework SDL2_image
CLIENT_LIBS+= -framework SDL2_mixer -framework CoreAudio -framework AudioToolbox
CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet
CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet -lc++
else
CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl2-config --cflags`
CLIENT_LIBS= -Lenet -lenet -L/usr/X11R6/lib -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL
Expand Down Expand Up @@ -146,6 +148,9 @@ MASTER_LIBS= $(STD_LIBS) -L$(WINBIN) -L$(WINLIB) -lzlib1 -lenet -lws2_32 -lwinmm
else
SERVER_INCLUDES= -DSTANDALONE $(INCLUDES)
SERVER_LIBS= -Lenet -lenet -lz
ifneq (,$(findstring DARWIN,$(PLATFORM)))
SERVER_LIBS+= -lc++
endif
MASTER_LIBS= $(SERVER_LIBS)
endif
SERVER_OBJS= \
Expand Down

0 comments on commit 4cb4c65

Please sign in to comment.