build: autotools cleanup and log fixes

This commit is contained in:
bnnm 2021-08-26 22:16:31 +02:00
parent 374e1d3c32
commit 8bfd247eac
7 changed files with 22 additions and 120 deletions

View File

@ -133,11 +133,13 @@ bool VgmstreamPlugin::is_our_file(const char * filename, VFSFile & file) {
return vgmstream_ctx_is_valid(filename, &cfg) > 0 ? true : false;
}
static void log_callback(int level, const char* str) {
/* default output in audacious is: "INFO/DEBUG plugin.cc:xxx [(fn name)]: (msg)" */
static void vgmstream_log(int level, const char* str) {
if (level == VGM_LOG_LEVEL_DEBUG)
AUDDBG("vgmstream: %s", str);
AUDDBG("%s", str);
else
AUDINFO("vgmstream: %s", str);
AUDINFO("%s", str);
}
// called on startup (main thread)
@ -146,7 +148,7 @@ bool VgmstreamPlugin::init() {
vgmstream_settings_load();
vgmstream_set_log_callback(VGM_LOG_LEVEL_ALL, log_callback);
vgmstream_set_log_callback(VGM_LOG_LEVEL_ALL, &log_callback);
return true;
}

View File

@ -4,26 +4,19 @@
# gets all files and updates .am scripts to avoid having to do manually (frowned upon by automake, whatevs)
# maybe there is a better way or place for this
VGMSTREAM_SRCS=`(cd ./src/ && ls *.c) | tr '\n' ' '`
VGMSTREAM_HDRS=`(cd ./src/ && ls *.h) | tr '\n' ' '`
CODING_SRCS=`(cd ./src/coding/ && ls *.c) | tr '\n' ' '`
CODING_HDRS=`(cd ./src/coding/ && ls *.h) | tr '\n' ' '`
LAYOUT_SRCS=`(cd ./src/layout/ && ls *.c) | tr '\n' ' '`
LAYOUT_HDRS=`(cd ./src/layout/ && ls *.h) | tr '\n' ' '`
META_SRCS=`(cd ./src/meta/ && ls *.c) | tr '\n' ' '`
META_HDRS=`(cd ./src/meta/ && ls *.h) | tr '\n' ' '`
VGMSTREAM_SRCS=`(cd ./src/ && ls *.c coding/*.c layout/*.c meta/*.c util/*.c) | tr '\n' ' '`
VGMSTREAM_HDRS=`(cd ./src/ && ls *.h coding/*.h layout/*.h meta/*.h util/*.h) | tr '\n' ' '`
AUDACIOUS_SRCS=`(cd ./audacious/ && ls *.cc) | tr '\n' ' '`
AUDACIOUS_HDRS=`(cd ./audacious/ && ls *.h) | tr '\n' ' '`
sed -i -e "s/libvgmstream_la_SOURCES =.*/libvgmstream_la_SOURCES = $VGMSTREAM_SRCS/g" ./src/Makefile.autotools.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $VGMSTREAM_HDRS/g" ./src/Makefile.autotools.am
sed -i -e "s/libcoding_la_SOURCES =.*/libcoding_la_SOURCES = $CODING_SRCS/g" ./src/coding/Makefile.autotools.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $CODING_HDRS/g" ./src/coding/Makefile.autotools.am
sed -i -e "s/liblayout_la_SOURCES =.*/liblayout_la_SOURCES = $LAYOUT_SRCS/g" ./src/layout/Makefile.autotools.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $LAYOUT_HDRS/g" ./src/layout/Makefile.autotools.am
sed -i -e "s/libmeta_la_SOURCES =.*/libmeta_la_SOURCES = $META_SRCS/g" ./src/meta/Makefile.autotools.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $META_HDRS/g" ./src/meta/Makefile.autotools.am
sed -i -e "s/libvgmstream_la_SOURCES =.*/libvgmstream_la_SOURCES = $AUDACIOUS_SRCS/g" ./audacious/Makefile.autotools.am
sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $AUDACIOUS_HDRS/g" ./audacious/Makefile.autotools.am
# in case some distro sed doesn't support | separator and must use /, all slashes need to be escaped first
#VGMSTREAM_SRCS=$(echo "$VGMSTREAM_SRCS" | sed 's/\//\\\//g')
sed -i -e "s|libvgmstream_la_SOURCES =.*|libvgmstream_la_SOURCES = $VGMSTREAM_SRCS|g" ./src/Makefile.autotools.am
sed -i -e "s|EXTRA_DIST =.*|EXTRA_DIST = $VGMSTREAM_HDRS|g" ./src/Makefile.autotools.am
sed -i -e "s|libvgmstream_la_SOURCES =.*|libvgmstream_la_SOURCES = $AUDACIOUS_SRCS|g" ./audacious/Makefile.autotools.am
sed -i -e "s|EXTRA_DIST =.*|EXTRA_DIST = $AUDACIOUS_HDRS|g" ./audacious/Makefile.autotools.am
# make version to show in about dialogs
# again, not very pretty

View File

@ -88,9 +88,6 @@ AC_PATH_XTRA
AC_OUTPUT([
Makefile.autotools
src/Makefile.autotools
src/coding/Makefile.autotools
src/layout/Makefile.autotools
src/meta/Makefile.autotools
audacious/Makefile.autotools
cli/Makefile.autotools
])

View File

@ -1,18 +1,21 @@
## vgmstream autotools script
#noinst_LTLIBRARIES = libvgmstream.la
lib_LTLIBRARIES = libvgmstream.la
AM_CFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.autotools
SUBDIRS = coding layout meta
SUBDIRS =
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la
libvgmstream_la_LDFLAGS =
libvgmstream_la_SOURCES = (auto-updated)
libvgmstream_la_LIBADD = -lm
EXTRA_DIST = (auto-updated)
AM_CFLAGS += -DVGM_LOG_OUTPUT
AM_CFLAGS += -DVGM_USE_G7221
if HAVE_VORBIS

View File

@ -1,31 +0,0 @@
## vgmstream autotools script
noinst_LTLIBRARIES = libcoding.la
AM_CFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.autotools
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libcoding_la_LDFLAGS =
libcoding_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)
AM_CFLAGS += -DVGM_USE_G7221
if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
endif
if HAVE_LIBSPEEX
AM_CFLAGS += -DVGM_USE_SPEEX
endif
if HAVE_FFMPEG
AM_CFLAGS += -DVGM_USE_FFMPEG
endif

View File

@ -1,31 +0,0 @@
## vgmstream autotools script
noinst_LTLIBRARIES = liblayout.la
AM_CFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.autotools
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
liblayout_la_LDFLAGS =
liblayout_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)
AM_CFLAGS += -DVGM_USE_G7221
if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
endif
if HAVE_LIBSPEEX
AM_CFLAGS += -DVGM_USE_SPEEX
endif
if HAVE_FFMPEG
AM_CFLAGS += -DVGM_USE_FFMPEG
endif

View File

@ -1,31 +0,0 @@
## vgmstream autotools script
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -DVAR_ARRAYS -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/
AM_MAKEFLAGS=-f Makefile.autotools
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)
libmeta_la_LDFLAGS =
libmeta_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)
AM_CFLAGS += -DVGM_USE_G7221
if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
endif
if HAVE_LIBSPEEX
AM_CFLAGS += -DVGM_USE_SPEEX
endif
if HAVE_FFMPEG
AM_CFLAGS += -DVGM_USE_FFMPEG
endif