1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
From: Simon McVittie <smcv@debian.org>
Date: Sun, 15 Feb 2015 23:51:23 +0000
Subject: Add support for DP_LINK_VORBIS make variable
Like the existing DP_LINK_TO_JPEG, this links libvorbisfile in the
normal way instead of dlopening it. Linux distributions like Debian
strongly prefer normal library linking: we have a lot of infrastructure for
tracking correct versioned dependencies in this mode of linking and
avoiding incompatible versions, and package systems like apt mean that
it's trivial to install dependencies.
This uses the existing support for linking to libvorbisfile in the normal
way, which is used on Android and iOS. The default on other platforms
is the current behaviour: dlopen libvorbisfile.
Origin: vendor, Debian
Forwarded: no
---
BSDmakefile | 12 ++++++++++++
makefile | 19 +++++++++++++++++++
makefile.inc | 4 ++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/BSDmakefile b/BSDmakefile
index b6cebea..0dfeae2 100644
--- a/BSDmakefile
+++ b/BSDmakefile
@@ -28,6 +28,7 @@ DP_LINK_JPEG?=shared
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+DP_LINK_VORBIS?=dlopen
###### Optional features #####
DP_VIDEO_CAPTURE?=enabled
@@ -112,6 +113,17 @@ LIB_CRYPTO_RIJNDAEL=
CFLAGS_CRYPTO_RIJNDAEL=
.endif
+# vorbis
+PKG_CONFIG?=pkg-config
+
+.if $(DP_LINK_VORBIS) == "shared"
+CFLAGS_LIBVORBIS=-DLINK_TO_LIBVORBIS `$(PKG_CONFIG) --cflags vorbisfile`
+LIB_VORBIS=`$(PKG_CONFIG) --libs vorbisfile`
+.else
+CFLAGS_LIBVORBIS=
+LIB_VORBIS=
+.endif
+
.endif
diff --git a/makefile b/makefile
index d7f3e6d..b235ba5 100644
--- a/makefile
+++ b/makefile
@@ -106,6 +106,7 @@ ifeq ($(DP_MAKE_TARGET), linux)
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+ DP_LINK_VORBIS?=dlopen
endif
# Mac OS X configuration
@@ -134,6 +135,7 @@ ifeq ($(DP_MAKE_TARGET), macosx)
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+ DP_LINK_VORBIS?=dlopen
# on OS X, we don't build the CL by default because it uses deprecated
# and not-implemented-in-64bit Carbon
@@ -168,6 +170,7 @@ ifeq ($(DP_MAKE_TARGET), sunos)
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+ DP_LINK_VORBIS?=dlopen
endif
# BSD configuration
@@ -193,6 +196,7 @@ ifeq ($(DP_MAKE_TARGET), bsd)
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+ DP_LINK_VORBIS?=dlopen
endif
# Win32 configuration
@@ -239,6 +243,7 @@ ifeq ($(DP_MAKE_TARGET), mingw)
DP_LINK_ODE?=dlopen
DP_LINK_CRYPTO?=dlopen
DP_LINK_CRYPTO_RIJNDAEL?=dlopen
+ DP_LINK_VORBIS?=dlopen
endif
# set these to "" if you want to use dynamic loading instead
@@ -291,6 +296,20 @@ ifeq ($(DP_LINK_CRYPTO_RIJNDAEL), dlopen)
CFLAGS_CRYPTO_RIJNDAEL=
endif
+ifndef PKG_CONFIG
+ PKG_CONFIG=pkg-config
+endif
+
+# vorbis
+ifeq ($(DP_LINK_VORBIS), shared)
+ CFLAGS_LIBVORBIS=-DLINK_TO_LIBVORBIS `$(PKG_CONFIG) --cflags vorbisfile`
+ LIB_VORBIS=`$(PKG_CONFIG) --libs vorbisfile`
+endif
+ifeq ($(DP_LINK_VORBIS), dlopen)
+ CFLAGS_LIBVORBIS=
+ LIB_VORBIS=
+endif
+
##### Extra CFLAGS #####
CFLAGS_MAKEDEP?=-MMD
diff --git a/makefile.inc b/makefile.inc
index 326e3a4..02a61a5 100644
--- a/makefile.inc
+++ b/makefile.inc
@@ -166,7 +166,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMM
# Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_LIBVORBIS) $(CFLAGS_D3D) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
CFLAGS_CLIENT=-DCONFIG_MENU $(CFLAGS_VIDEO_CAPTURE)
CFLAGS_SERVER=
CFLAGS_DEBUG=-ggdb
@@ -207,7 +207,7 @@ LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
-LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
+LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_VORBIS)
EXE_UNIXSV=darkplaces-dedicated
EXE_UNIXSDL=darkplaces-sdl
EXE_UNIXSVNEXUIZ=nexuiz-dedicated
|