Merge branch 'zlib-split' into 'master'

Makefile: Split zlib and libpng

See merge request STJr/SRB2!285
This commit is contained in:
Monster Iestyn 2018-10-08 07:20:27 -04:00
commit 1115f41f8e
3 changed files with 25 additions and 22 deletions

View file

@ -66,6 +66,7 @@
# Compile without 3D sound support, add 'NOHS=1' # Compile without 3D sound support, add 'NOHS=1'
# Compile with GDBstubs, add 'RDB=1' # Compile with GDBstubs, add 'RDB=1'
# Compile without PNG, add 'NOPNG=1' # Compile without PNG, add 'NOPNG=1'
# Compile without zlib, add 'NOZLIB=1'
# #
# Addon for SDL: # Addon for SDL:
# To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config'
@ -119,6 +120,7 @@ include Makefile.cfg
ifdef DUMMY ifdef DUMMY
NOPNG=1 NOPNG=1
NOZLIB=1
NONET=1 NONET=1
NOHW=1 NOHW=1
NOHS=1 NOHS=1
@ -199,6 +201,7 @@ endif
ifdef NDS ifdef NDS
NOPNG=1 NOPNG=1
NOZLIB=1
NONET=1 NONET=1
#NOHW=1 #NOHW=1
NOHS=1 NOHS=1
@ -325,13 +328,6 @@ LIBS+=$(PNG_LDFLAGS)
CFLAGS+=$(PNG_CFLAGS) CFLAGS+=$(PNG_CFLAGS)
endif endif
ZLIB_PKGCONFIG?=zlib
ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
LIBS+=$(ZLIB_LDFLAGS)
CFLAGS+=$(ZLIB_CFLAGS)
ifdef HAVE_LIBGME ifdef HAVE_LIBGME
OPTS+=-DHAVE_LIBGME OPTS+=-DHAVE_LIBGME
@ -343,6 +339,18 @@ LIBS+=$(LIBGME_LDFLAGS)
CFLAGS+=$(LIBGME_CFLAGS) CFLAGS+=$(LIBGME_CFLAGS)
endif endif
ifndef NOZLIB
OPTS+=-DHAVE_ZLIB
ZLIB_PKGCONFIG?=zlib
ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
LIBS+=$(ZLIB_LDFLAGS)
CFLAGS+=$(ZLIB_CFLAGS)
else
NOPNG=1
endif
ifdef STATIC ifdef STATIC
LIBS:=-static $(LIBS) LIBS:=-static $(LIBS)
endif endif

View file

@ -38,10 +38,8 @@
#include "gme/gme.h" #include "gme/gme.h"
#define GME_TREBLE 5.0 #define GME_TREBLE 5.0
#define GME_BASS 1.0 #define GME_BASS 1.0
#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng
#define HAVE_ZLIB
#ifdef HAVE_ZLIB
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE #ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE
@ -57,8 +55,8 @@
#endif #endif
#include "zlib.h" #include "zlib.h"
#endif #endif // HAVE_ZLIB
#endif #endif // HAVE_LIBGME
UINT8 sound_started = false; UINT8 sound_started = false;
@ -362,7 +360,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
} }
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
#else #else
//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); return NULL; // No zlib support
#endif #endif
} }
// Try to read it as a GME sound // Try to read it as a GME sound
@ -645,7 +643,8 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
} }
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
#else #else
//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
return true;
#endif #endif
} }
else if (!gme_open_data(data, len, &gme, 44100)) else if (!gme_open_data(data, len, &gme, 44100))

View file

@ -17,17 +17,13 @@
#include "gme/gme.h" #include "gme/gme.h"
#define GME_TREBLE 5.0 #define GME_TREBLE 5.0
#define GME_BASS 1.0 #define GME_BASS 1.0
#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng
#define HAVE_ZLIB
#ifdef HAVE_ZLIB
#ifndef _MSC_VER #ifndef _MSC_VER
#ifndef _WII
#ifndef _LARGEFILE64_SOURCE #ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE
#endif #endif
#endif #endif
#endif
#ifndef _LFS64_LARGEFILE #ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE #define _LFS64_LARGEFILE
@ -38,8 +34,8 @@
#endif #endif
#include "zlib.h" #include "zlib.h"
#endif #endif // HAVE_ZLIB
#endif #endif // HAVE_LIBGME
static FMOD_SYSTEM *fsys; static FMOD_SYSTEM *fsys;
static FMOD_SOUND *music_stream; static FMOD_SOUND *music_stream;