From 8bfd247eac0c5f4ad5040e6b4f47837ab0041f6f Mon Sep 17 00:00:00 2001 From: bnnm Date: Thu, 26 Aug 2021 22:16:31 +0200 Subject: [PATCH] build: autotools cleanup and log fixes --- audacious/plugin.cc | 10 ++++++---- bootstrap | 29 +++++++++++------------------ configure.ac | 3 --- src/Makefile.autotools.am | 7 +++++-- src/coding/Makefile.autotools.am | 31 ------------------------------- src/layout/Makefile.autotools.am | 31 ------------------------------- src/meta/Makefile.autotools.am | 31 ------------------------------- 7 files changed, 22 insertions(+), 120 deletions(-) delete mode 100644 src/coding/Makefile.autotools.am delete mode 100644 src/layout/Makefile.autotools.am delete mode 100644 src/meta/Makefile.autotools.am diff --git a/audacious/plugin.cc b/audacious/plugin.cc index 31d0b6f6..b44847fb 100644 --- a/audacious/plugin.cc +++ b/audacious/plugin.cc @@ -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; } diff --git a/bootstrap b/bootstrap index b708b306..729404b4 100755 --- a/bootstrap +++ b/bootstrap @@ -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 diff --git a/configure.ac b/configure.ac index e7d84e85..94583272 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) diff --git a/src/Makefile.autotools.am b/src/Makefile.autotools.am index 65fc0d9c..4377ecb1 100644 --- a/src/Makefile.autotools.am +++ b/src/Makefile.autotools.am @@ -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 diff --git a/src/coding/Makefile.autotools.am b/src/coding/Makefile.autotools.am deleted file mode 100644 index 67fa13c6..00000000 --- a/src/coding/Makefile.autotools.am +++ /dev/null @@ -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 diff --git a/src/layout/Makefile.autotools.am b/src/layout/Makefile.autotools.am deleted file mode 100644 index 0f2d0102..00000000 --- a/src/layout/Makefile.autotools.am +++ /dev/null @@ -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 diff --git a/src/meta/Makefile.autotools.am b/src/meta/Makefile.autotools.am deleted file mode 100644 index 480b15c4..00000000 --- a/src/meta/Makefile.autotools.am +++ /dev/null @@ -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