quakespasm: fix darwin build
This commit is contained in:
parent
2a172dcba9
commit
aeb77ea9bd
|
@ -1,6 +1,6 @@
|
||||||
{ lib, stdenv, SDL, SDL2, fetchurl, gzip, libvorbis, libmad
|
{ lib, stdenv, SDL, SDL2, fetchurl, gzip, libvorbis, libmad, flac, libopus, opusfile, libogg, libxmp
|
||||||
, Cocoa, CoreAudio, CoreFoundation, IOKit, OpenGL
|
, Cocoa, CoreAudio, CoreFoundation, IOKit, OpenGL
|
||||||
, copyDesktopItems, makeDesktopItem
|
, copyDesktopItems, makeDesktopItem, pkg-config
|
||||||
, useSDL2 ? stdenv.isDarwin # TODO: CoreAudio fails to initialize with SDL 1.x for some reason.
|
, useSDL2 ? stdenv.isDarwin # TODO: CoreAudio fails to initialize with SDL 1.x for some reason.
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -20,9 +20,14 @@ stdenv.mkDerivation rec {
|
||||||
./quakespasm-darwin-makefile-improvements.patch
|
./quakespasm-darwin-makefile-improvements.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ copyDesktopItems ];
|
nativeBuildInputs = [
|
||||||
|
copyDesktopItems
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gzip libvorbis libmad (if useSDL2 then SDL2 else SDL)
|
gzip libvorbis libmad flac libopus opusfile libogg libxmp
|
||||||
|
(if useSDL2 then SDL2 else SDL)
|
||||||
] ++ lib.optionals stdenv.isDarwin [
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
Cocoa CoreAudio IOKit OpenGL
|
Cocoa CoreAudio IOKit OpenGL
|
||||||
] ++ lib.optionals (stdenv.isDarwin && useSDL2) [
|
] ++ lib.optionals (stdenv.isDarwin && useSDL2) [
|
||||||
|
@ -35,10 +40,11 @@ stdenv.mkDerivation rec {
|
||||||
"USE_CODEC_WAVE=1"
|
"USE_CODEC_WAVE=1"
|
||||||
"USE_CODEC_MP3=1"
|
"USE_CODEC_MP3=1"
|
||||||
"USE_CODEC_VORBIS=1"
|
"USE_CODEC_VORBIS=1"
|
||||||
"USE_CODEC_FLAC=0"
|
"USE_CODEC_FLAC=1"
|
||||||
"USE_CODEC_OPUS=0"
|
"USE_CODEC_OPUS=1"
|
||||||
"USE_CODEC_MIKMOD=0"
|
"USE_CODEC_MIKMOD=0"
|
||||||
"USE_CODEC_UMX=0"
|
"USE_CODEC_UMX=0"
|
||||||
|
"USE_CODEC_XMP=1"
|
||||||
"MP3LIB=mad"
|
"MP3LIB=mad"
|
||||||
"VORBISLIB=vorbis"
|
"VORBISLIB=vorbis"
|
||||||
] ++ lib.optionals useSDL2 [
|
] ++ lib.optionals useSDL2 [
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
--- a/Makefile.darwin 2021-09-12 14:42:51.000000000 +0300
|
diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin
|
||||||
+++ b/Makefile.darwin 2021-09-12 15:09:16.000000000 +0300
|
index 6a08e6d..4e320cd 100644
|
||||||
@@ -49,6 +49,7 @@
|
--- a/Makefile.darwin
|
||||||
|
+++ b/Makefile.darwin
|
||||||
|
@@ -50,6 +50,7 @@ LINKER = $(CC)
|
||||||
LIPO ?= lipo
|
LIPO ?= lipo
|
||||||
|
|
||||||
STRIP ?= strip
|
STRIP ?= strip -S
|
||||||
+PKG_CONFIG ?= pkg-config
|
+PKG_CONFIG ?= pkg-config
|
||||||
|
|
||||||
CPUFLAGS=
|
CPUFLAGS=
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
@@ -84,9 +85,6 @@
|
@@ -86,9 +87,6 @@ USE_RPATH=1
|
||||||
USE_RPATH=1
|
|
||||||
endif
|
endif
|
||||||
|
CFLAGS += $(call check_gcc,-std=gnu11,)
|
||||||
CFLAGS += $(CPUFLAGS)
|
CFLAGS += $(CPUFLAGS)
|
||||||
-ifeq ($(USE_RPATH),1)
|
-ifeq ($(USE_RPATH),1)
|
||||||
-LDFLAGS+=-Wl,-rpath,@executable_path/../Frameworks
|
-LDFLAGS+=-Wl,-rpath,@executable_path/../Frameworks
|
||||||
-endif
|
-endif
|
||||||
|
|
||||||
ifneq ($(DEBUG),0)
|
ifneq ($(DEBUG),0)
|
||||||
DFLAGS += -DDEBUG
|
DFLAGS += -DDEBUG
|
||||||
@@ -115,19 +113,14 @@
|
CFLAGS += -g
|
||||||
|
@@ -117,19 +115,14 @@ CFLAGS += -DGL_SILENCE_DEPRECATION=1
|
||||||
# not relying on sdl-config command and assuming
|
# not relying on sdl-config command and assuming
|
||||||
# /Library/Frameworks/SDL.framework is available
|
# /Library/Frameworks/SDL.framework is available
|
||||||
SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE
|
SDL_CFLAGS =-D_GNU_SOURCE=1 -D_THREAD_SAFE
|
||||||
|
@ -34,42 +36,49 @@
|
||||||
-ifneq ($(SDL_FRAMEWORK_PATH),)
|
-ifneq ($(SDL_FRAMEWORK_PATH),)
|
||||||
-SDL_LIBS +=-F$(SDL_FRAMEWORK_PATH)
|
-SDL_LIBS +=-F$(SDL_FRAMEWORK_PATH)
|
||||||
-SDL_CFLAGS+=-F$(SDL_FRAMEWORK_PATH)
|
-SDL_CFLAGS+=-F$(SDL_FRAMEWORK_PATH)
|
||||||
+SDL_CONFIG ?= sdl2-config
|
+SDL_CONFIG ?= sdl-config
|
||||||
endif
|
endif
|
||||||
-SDL_LIBS +=-Wl,-framework,$(SDL_FRAMEWORK_NAME) -Wl,-framework,Cocoa
|
-SDL_LIBS +=-Wl,-framework,$(SDL_FRAMEWORK_NAME) -Wl,-framework,Cocoa
|
||||||
+SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
+SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
||||||
+SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
|
+SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
|
||||||
+SDL_LIBS += -Wl,-framework,Cocoa
|
+SDL_LIBS += -Wl,-framework,Cocoa
|
||||||
|
|
||||||
NET_LIBS :=
|
NET_LIBS :=
|
||||||
|
|
||||||
@@ -164,38 +157,26 @@
|
@@ -165,45 +158,31 @@ ifeq ($(USE_CODEC_WAVE),1)
|
||||||
|
CFLAGS+= -DUSE_CODEC_WAVE
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_FLAC),1)
|
ifeq ($(USE_CODEC_FLAC),1)
|
||||||
CFLAGS+= -DUSE_CODEC_FLAC
|
-CFLAGS+= -DUSE_CODEC_FLAC
|
||||||
-CODEC_INC = -I../MacOSX/codecs/include
|
-CODEC_INC = -I../MacOSX/codecs/include
|
||||||
-CODEC_LINK= -L../MacOSX/codecs/lib
|
-CODEC_LINK= -L../MacOSX/codecs/lib
|
||||||
CODECLIBS+= -lFLAC
|
-CODECLIBS+= -lFLAC
|
||||||
|
+CFLAGS+= -DUSE_CODEC_FLAC $(shell $(PKG_CONFIG) --cflags flac)
|
||||||
|
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs flac)
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_OPUS),1)
|
ifeq ($(USE_CODEC_OPUS),1)
|
||||||
-CFLAGS+= -DUSE_CODEC_OPUS
|
-CFLAGS+= -DUSE_CODEC_OPUS
|
||||||
-CODEC_INC = -I../MacOSX/codecs/include
|
-CODEC_INC = -I../MacOSX/codecs/include
|
||||||
-CODEC_LINK= -L../MacOSX/codecs/lib
|
-CODEC_LINK= -L../MacOSX/codecs/lib
|
||||||
-CODECLIBS+= -lopusfile -lopus -logg
|
-CODECLIBS+= -lopusfile -lopus -logg
|
||||||
+CFLAGS+= -DUSE_CODEC_OPUS $(shell $(PKG_CONFIG) --cflags opusfile)
|
+CFLAGS+= -DUSE_CODEC_OPUS $(shell $(PKG_CONFIG) --cflags ogg opus opusfile)
|
||||||
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs opusfile)
|
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs ogg opus opusfile)
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_VORBIS),1)
|
ifeq ($(USE_CODEC_VORBIS),1)
|
||||||
CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
|
-CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
|
||||||
-CODEC_INC = -I../MacOSX/codecs/include
|
-CODEC_INC = -I../MacOSX/codecs/include
|
||||||
-CODEC_LINK= -L../MacOSX/codecs/lib
|
-CODEC_LINK= -L../MacOSX/codecs/lib
|
||||||
CODECLIBS+= $(lib_vorbisdec)
|
-CODECLIBS+= $(lib_vorbisdec)
|
||||||
|
+CFLAGS+= -DUSE_CODEC_VORBIS $(shell $(PKG_CONFIG) --cflags ogg vorbis vorbisfile)
|
||||||
|
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs ogg vorbis vorbisfile)
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_MP3),1)
|
ifeq ($(USE_CODEC_MP3),1)
|
||||||
CFLAGS+= -DUSE_CODEC_MP3
|
-CFLAGS+= -DUSE_CODEC_MP3
|
||||||
-CODEC_INC = -I../MacOSX/codecs/include
|
-CODEC_INC = -I../MacOSX/codecs/include
|
||||||
-CODEC_LINK= -L../MacOSX/codecs/lib
|
-CODEC_LINK= -L../MacOSX/codecs/lib
|
||||||
CODECLIBS+= $(lib_mp3dec)
|
-CODECLIBS+= $(lib_mp3dec)
|
||||||
|
+CFLAGS+= -DUSE_CODEC_MP3 $(shell $(PKG_CONFIG) --cflags $(MP3LIB))
|
||||||
|
+CODECLIBS+= $(shell $(PKG_CONFIG) --libs $(MP3LIB))
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_MIKMOD),1)
|
ifeq ($(USE_CODEC_MIKMOD),1)
|
||||||
CFLAGS+= -DUSE_CODEC_MIKMOD
|
CFLAGS+= -DUSE_CODEC_MIKMOD
|
||||||
|
@ -78,15 +87,25 @@
|
||||||
CODECLIBS+= -lmikmod
|
CODECLIBS+= -lmikmod
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_XMP),1)
|
ifeq ($(USE_CODEC_XMP),1)
|
||||||
CFLAGS+= -DUSE_CODEC_XMP
|
-CFLAGS+= -DUSE_CODEC_XMP
|
||||||
-CODEC_INC = -I../MacOSX/codecs/include
|
-CODEC_INC = -I../MacOSX/codecs/include
|
||||||
-CODEC_LINK= -L../MacOSX/codecs/lib
|
-CODEC_LINK= -L../MacOSX/codecs/lib
|
||||||
CODECLIBS+= -lxmp
|
-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
|
||||||
|
CODECLIBS+= -lmodplug
|
||||||
endif
|
endif
|
||||||
ifeq ($(USE_CODEC_UMX),1)
|
ifeq ($(USE_CODEC_UMX),1)
|
||||||
@@ -332,3 +313,5 @@
|
@@ -333,4 +312,7 @@ debug:
|
||||||
clean:
|
clean:
|
||||||
rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print)
|
$(RM) *.o *.d $(DEFAULT_TARGET)
|
||||||
|
|
||||||
+install: quakespasm
|
+install: quakespasm
|
||||||
+ install -D -m 755 quakespasm /usr/local/games/quake
|
+ install -D -m 755 quakespasm /usr/local/games/quake
|
||||||
|
+
|
||||||
|
sinclude $(OBJS:.o=.d)
|
||||||
|
|
Loading…
Reference in a new issue