nixpkgs/pkgs/games/quakespasm/quakespasm-darwin-makefile-improvements.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
3.3 KiB
Diff
Raw Normal View History

2022-08-07 16:49:55 +00:00
diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin
index 6a08e6d..4e320cd 100644
--- a/Makefile.darwin
+++ b/Makefile.darwin
@@ -50,6 +50,7 @@ LINKER = $(CC)
LIPO ?= lipo
2022-08-07 16:49:55 +00:00
STRIP ?= strip -S
+PKG_CONFIG ?= pkg-config
CPUFLAGS=
LDFLAGS =
2022-08-07 16:49:55 +00:00
@@ -86,9 +87,6 @@ USE_RPATH=1
endif
2022-08-07 16:49:55 +00:00
CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
-ifeq ($(USE_RPATH),1)
-LDFLAGS+=-Wl,-rpath,@executable_path/../Frameworks
-endif
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
2022-08-07 16:49:55 +00:00
CFLAGS += -g
@@ -117,19 +115,14 @@ CFLAGS += -DGL_SILENCE_DEPRECATION=1
# not relying on sdl-config command and assuming
# /Library/Frameworks/SDL.framework is available
SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE
-SDL_CFLAGS+=-DSDL_FRAMEWORK -DNO_SDL_CONFIG
ifeq ($(USE_SDL2),1)
-SDL_FRAMEWORK_NAME = SDL2
+SDL_CONFIG ?= sdl2-config
else
-SDL_FRAMEWORK_NAME = SDL
-endif
-# default to our local SDL[2].framework for build
-SDL_FRAMEWORK_PATH ?=../MacOSX
-ifneq ($(SDL_FRAMEWORK_PATH),)
-SDL_LIBS +=-F$(SDL_FRAMEWORK_PATH)
-SDL_CFLAGS+=-F$(SDL_FRAMEWORK_PATH)
2022-08-07 16:49:55 +00:00
+SDL_CONFIG ?= sdl-config
endif
-SDL_LIBS +=-Wl,-framework,$(SDL_FRAMEWORK_NAME) -Wl,-framework,Cocoa
+SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
+SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
2022-08-07 16:49:55 +00:00
+SDL_LIBS += -Wl,-framework,Cocoa
NET_LIBS :=
2022-08-07 16:49:55 +00:00
@@ -165,45 +158,31 @@ ifeq ($(USE_CODEC_WAVE),1)
CFLAGS+= -DUSE_CODEC_WAVE
endif
ifeq ($(USE_CODEC_FLAC),1)
2022-08-07 16:49:55 +00:00
-CFLAGS+= -DUSE_CODEC_FLAC
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
2022-08-07 16:49:55 +00:00
-CODECLIBS+= -lFLAC
+CFLAGS+= -DUSE_CODEC_FLAC $(shell $(PKG_CONFIG) --cflags flac)
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs flac)
endif
ifeq ($(USE_CODEC_OPUS),1)
-CFLAGS+= -DUSE_CODEC_OPUS
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
-CODECLIBS+= -lopusfile -lopus -logg
2022-08-07 16:49:55 +00:00
+CFLAGS+= -DUSE_CODEC_OPUS $(shell $(PKG_CONFIG) --cflags ogg opus opusfile)
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs ogg opus opusfile)
endif
ifeq ($(USE_CODEC_VORBIS),1)
2022-08-07 16:49:55 +00:00
-CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
2022-08-07 16:49:55 +00:00
-CODECLIBS+= $(lib_vorbisdec)
+CFLAGS+= -DUSE_CODEC_VORBIS $(shell $(PKG_CONFIG) --cflags ogg vorbis vorbisfile)
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs ogg vorbis vorbisfile)
endif
ifeq ($(USE_CODEC_MP3),1)
2022-08-07 16:49:55 +00:00
-CFLAGS+= -DUSE_CODEC_MP3
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
2022-08-07 16:49:55 +00:00
-CODECLIBS+= $(lib_mp3dec)
+CFLAGS+= -DUSE_CODEC_MP3 $(shell $(PKG_CONFIG) --cflags $(MP3LIB))
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs $(MP3LIB))
endif
ifeq ($(USE_CODEC_MIKMOD),1)
CFLAGS+= -DUSE_CODEC_MIKMOD
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
CODECLIBS+= -lmikmod
endif
ifeq ($(USE_CODEC_XMP),1)
2022-08-07 16:49:55 +00:00
-CFLAGS+= -DUSE_CODEC_XMP
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
-CODECLIBS+= -lxmp
+CFLAGS+= -DUSE_CODEC_XMP $(shell $(PKG_CONFIG) --cflags libxmp)
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs libxmp)
endif
ifeq ($(USE_CODEC_MODPLUG),1)
CFLAGS+= -DUSE_CODEC_MODPLUG
-CODEC_INC = -I../MacOSX/codecs/include
-CODEC_LINK= -L../MacOSX/codecs/lib
2022-08-07 16:49:55 +00:00
CODECLIBS+= -lmodplug
endif
ifeq ($(USE_CODEC_UMX),1)
2022-08-07 16:49:55 +00:00
@@ -333,4 +312,7 @@ debug:
clean:
2022-08-07 16:49:55 +00:00
$(RM) *.o *.d $(DEFAULT_TARGET)
2022-08-07 16:49:55 +00:00
+install: quakespasm
+ install -D -m 755 quakespasm /usr/local/games/quake
2022-08-07 16:49:55 +00:00
+
sinclude $(OBJS:.o=.d)