Merge pull request #919 from bnnm/build4

- build: misc version tweaks
This commit is contained in:
bnnm 2021-08-15 22:03:21 +02:00 committed by GitHub
commit da9c04551b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 196 additions and 128 deletions

View File

@ -4,16 +4,11 @@
ifeq ($(VGMSTREAM_VERSION),) ifeq ($(VGMSTREAM_VERSION),)
# for current dir (expanded later) # for current dir (expanded later)
VGMSTREAM_VERSION_CURR=`./version-get.sh` VGMSTREAM_VERSION=`sh ./version-get.sh`
# for subdirs (expanded later)
VGMSTREAM_VERSION_PREV=`../version-get.sh`
else else
VGMSTREAM_VERSION_CURR=$(VGMSTREAM_VERSION) VGMSTREAM_VERSION=$(VGMSTREAM_VERSION)
VGMSTREAM_VERSION_PREV=$(VGMSTREAM_VERSION)
endif endif
DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO
export VGMSTREAM_VERSION_PREV
############################################################################### ###############################################################################
### external defs ### external defs
@ -98,6 +93,7 @@ endif
### external libs ### external libs
# (call "make VGM_xxx = 0/1" to override 0/1 defaults, as Make does) # (call "make VGM_xxx = 0/1" to override 0/1 defaults, as Make does)
ifeq ($(TARGET_OS),Windows_NT) ifeq ($(TARGET_OS),Windows_NT)
# enabled by default on Windows # enabled by default on Windows
VGM_VORBIS = 1 VGM_VORBIS = 1
ifneq ($(VGM_VORBIS),0) ifneq ($(VGM_VORBIS),0)
@ -222,14 +218,22 @@ export DEF_CFLAGS LIBS_CFLAGS LIBS_LDFLAGS LIBS_TARGET_EXT_LIBS
############################################################################### ###############################################################################
### internal defs ### internal defs
ZIP_FILES = COPYING ifeq ($(TARGET_OS),Windows_NT)
ZIP_FILES+= README.md ZIP_FILES = COPYING
ZIP_FILES+= cli/test.exe ZIP_FILES += README.md
ZIP_FILES+= winamp/in_vgmstream.dll ZIP_FILES += cli/test.exe
ZIP_FILES+= xmplay/xmp-vgmstream.dll ZIP_FILES += winamp/in_vgmstream.dll
ZIP_FILES+= ext_libs/*.dll ZIP_FILES += xmplay/xmp-vgmstream.dll
ZIP_FILES+= ext_libs/libspeex/*.dll ZIP_FILES += ext_libs/*.dll
ZIP_FILES_AO = $(LIBAO_DLL_PATH)/*.dll ZIP_FILES += ext_libs/libspeex/*.dll
ZIP_FILES_AO = cli/vgmstream123.exe
ZIP_FILES_AO += $(LIBAO_DLL_PATH)/*.dll
else
ZIP_FILES = COPYING
ZIP_FILES += README.md
ZIP_FILES += cli/vgmstream-cli
ZIP_FILES_AO = cli/vgmstream123
endif
############################################################################### ###############################################################################
### targets ### targets
@ -240,33 +244,38 @@ buildrelease-ex: clean bin-ex
buildfullrelease: clean sourceball bin buildfullrelease: clean sourceball bin
sourceball: sourceball:
rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR) rm -rf vgmstream-$(VGMSTREAM_VERSION)
git checkout-index -f -a --prefix=vgmstream-$(VGMSTREAM_VERSION_CURR)/ git checkout-index -f -a --prefix=vgmstream-$(VGMSTREAM_VERSION)/
# git archive --format zip --output vgmstream-$(VGMSTREAM_VERSION_CURR).zip master # git archive --format zip --output vgmstream-$(VGMSTREAM_VERSION).zip master
echo "#!/bin/sh" > vgmstream-$(VGMSTREAM_VERSION_CURR)/version-get.sh echo "#!/bin/sh" > vgmstream-$(VGMSTREAM_VERSION)/version-get.sh
echo "echo \"$(VGMSTREAM_VERSION_CURR)\"" >> vgmstream-$(VGMSTREAM_VERSION_CURR)/version-get.sh echo "echo \"$(VGMSTREAM_VERSION)\"" >> vgmstream-$(VGMSTREAM_VERSION)/version-get.sh
tar cvzf "vgmstream-$(VGMSTREAM_VERSION_CURR).tar.gz" vgmstream-$(VGMSTREAM_VERSION_CURR)/* tar cvzf "vgmstream-$(VGMSTREAM_VERSION)-src.tar.gz" vgmstream-$(VGMSTREAM_VERSION)/*
rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR) rm -rf vgmstream-$(VGMSTREAM_VERSION)
bin mingwbin: vgmstream_cli winamp xmplay bin: vgmstream_cli winamp xmplay
zip -FS -j "vgmstream-$(VGMSTREAM_VERSION_CURR)-test.zip" $(ZIP_FILES) mkdir -p bin
zip -FS -j "bin/vgmstream-$(VGMSTREAM_VERSION).zip" $(ZIP_FILES)
#separate since vgmstream123 is kinda untested #separate since vgmstream123 is kinda untested
bin-ex mingwbin-ex: vgmstream_cli winamp xmplay vgmstream123 bin-ex: vgmstream_cli winamp xmplay vgmstream123
zip -FS -j "vgmstream-$(VGMSTREAM_VERSION_CURR)-test.zip" $(ZIP_FILES) $(ZIP_FILES_AO) mkdir -p bin
zip -FS -j "bin/vgmstream-$(VGMSTREAM_VERSION).zip" $(ZIP_FILES) $(ZIP_FILES_AO)
vgmstream_cli mingw_test: vgmstream_cli: version
$(MAKE) -C cli vgmstream_cli $(MAKE) -C cli vgmstream_cli
vgmstream123: vgmstream123: version
$(MAKE) -C cli vgmstream123 $(MAKE) -C cli vgmstream123
winamp mingw_winamp: winamp: version
$(MAKE) -C winamp in_vgmstream $(MAKE) -C winamp in_vgmstream
xmplay mingw_xmplay: xmplay: version
$(MAKE) -C xmplay xmp_vgmstream $(MAKE) -C xmplay xmp_vgmstream
version:
sh version-make.sh
clean: clean:
$(RMF) vgmstream-*.zip $(RMF) vgmstream-*.zip
$(MAKE) -C src clean $(MAKE) -C src clean
@ -275,6 +284,4 @@ clean:
$(MAKE) -C xmplay clean $(MAKE) -C xmplay clean
$(MAKE) -C ext_libs clean $(MAKE) -C ext_libs clean
.PHONY: clean buildfullrelease buildrelease sourceball bin vgmstream_cli winamp xmplay mingwbin mingw_test mingw_winamp mingw_xmplay .PHONY: clean buildfullrelease buildrelease sourceball bin vgmstream_cli winamp
#deprecated: buildfullrelease sourceball mingwbin mingw_test mingw_winamp mingw_xmplay

View File

@ -6,7 +6,7 @@ inputplugindir = $(plugindir)/$(INPUT_PLUGIN_DIR)
inputplugin_LTLIBRARIES = libvgmstream.la inputplugin_LTLIBRARIES = libvgmstream.la
AM_MAKEFLAGS=-f Makefile.autotools AM_MAKEFLAGS=-f Makefile.autotools
AM_CXXFLAGS = -DVGMSTREAM_VERSION=\"VGMSTREAM_VERSION\" -Wall -std=c++11 -fpermissive -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AUDACIOUS_CFLAGS) $(GTK_CFLAGS) AM_CXXFLAGS = -DVGMSTREAM_VERSION_AUTO -Wall -std=c++11 -fpermissive -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AUDACIOUS_CFLAGS) $(GTK_CFLAGS)
AM_LIBS = AM_LIBS =
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though) # sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)

View File

@ -24,9 +24,13 @@ extern "C" {
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown-version)" #define VGMSTREAM_VERSION "unknown version " __DATE__
#endif #endif
#define PLUGIN_NAME "vgmstream plugin " VGMSTREAM_VERSION
#define PLUGIN_INFO PLUGIN_NAME " (" __DATE__ ")"
#define CFG_ID "vgmstream" // ID for storing in audacious #define CFG_ID "vgmstream" // ID for storing in audacious
#define MIN_BUFFER_SIZE 576 #define MIN_BUFFER_SIZE 576
@ -62,15 +66,15 @@ const char *const VgmstreamPlugin::defaults[] = {
// N_(...) for i18n but not much point here // N_(...) for i18n but not much point here
const char VgmstreamPlugin::about[] = const char VgmstreamPlugin::about[] =
"vgmstream plugin " VGMSTREAM_VERSION " " __DATE__ "\n" PLUGIN_INFO "\n"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n" "by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm, Nicknine, Thealexbarney, CyberBotX, and many others\n"
"\n" "\n"
"Audacious plugin:\n" "Audacious plugin:\n"
"ported to Audacious 3.6 by Brandon Whitehead\n" "- ported to Audacious 3.6 by Brandon Whitehead\n"
"adopted from Audacious 3 port by Thomas Eppers\n" "- adopted from Audacious 3 port by Thomas Eppers\n"
"originally written by Todd Jeffreys (http://voidpointer.org/)\n" "- originally written by Todd Jeffreys (http://voidpointer.org/)\n"
"\n" "\n"
"https://github.com/kode54/vgmstream/\n" "https://github.com/vgmstream/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)"; "https://sourceforge.net/projects/vgmstream/ (original)";
/* widget config: {min, max, step} */ /* widget config: {min, max, step} */

View File

@ -25,11 +25,9 @@ sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $META_HDRS/g" ./src/meta/Makefile.autot
sed -i -e "s/libvgmstream_la_SOURCES =.*/libvgmstream_la_SOURCES = $AUDACIOUS_SRCS/g" ./audacious/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 sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $AUDACIOUS_HDRS/g" ./audacious/Makefile.autotools.am
# get version to show in about dialogs # make version to show in about dialogs
# again, not very pretty # again, not very pretty
VGMSTREAM_VERSION=`./version-get.sh` sh version-make.sh
sed -i -e "s/VGMSTREAM_VERSION/$VGMSTREAM_VERSION/g" ./audacious/Makefile.autotools.am
sed -i -e "s/VGMSTREAM_VERSION/$VGMSTREAM_VERSION/g" ./cli/Makefile.autotools.am
# create fake files expected by automake and process # create fake files expected by automake and process
touch README AUTHORS NEWS ChangeLog touch README AUTHORS NEWS ChangeLog

View File

@ -44,11 +44,11 @@ export CFLAGS LDFLAGS
### targets ### targets
vgmstream_cli: libvgmstream.a $(TARGET_EXT_LIBS) vgmstream_cli: libvgmstream.a $(TARGET_EXT_LIBS)
$(CC) $(CFLAGS) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" vgmstream_cli.c $(LDFLAGS) -o $(OUTPUT_CLI) $(CC) $(CFLAGS) vgmstream_cli.c $(LDFLAGS) -o $(OUTPUT_CLI)
$(STRIP) $(OUTPUT_CLI) $(STRIP) $(OUTPUT_CLI)
vgmstream123: libvgmstream.a $(TARGET_EXT_LIBS) vgmstream123: libvgmstream.a $(TARGET_EXT_LIBS)
$(CC) $(CFLAGS) $(LIBAO_INC) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" vgmstream123.c $(LDFLAGS) $(LIBAO_LIB) -o $(OUTPUT_123) $(CC) $(CFLAGS) $(LIBAO_INC) vgmstream123.c $(LDFLAGS) $(LIBAO_LIB) -o $(OUTPUT_123)
$(STRIP) $(OUTPUT_123) $(STRIP) $(OUTPUT_123)
libvgmstream.a: libvgmstream.a:

View File

@ -6,7 +6,7 @@ if HAVE_LIBAO
bin_PROGRAMS += vgmstream123 bin_PROGRAMS += vgmstream123
endif endif
AM_CFLAGS = -DVGMSTREAM_VERSION=\"VGMSTREAM_VERSION\" -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AO_CFLAGS) AM_CFLAGS = -DVGMSTREAM_VERSION_AUTO -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AO_CFLAGS)
AM_MAKEFLAGS = -f Makefile.autotools AM_MAKEFLAGS = -f Makefile.autotools
vgmstream_cli_SOURCES = vgmstream_cli.c vgmstream_cli_SOURCES = vgmstream_cli.c

View File

@ -39,10 +39,13 @@
#include "../src/vgmstream.h" #include "../src/vgmstream.h"
#include "../src/plugins.h" #include "../src/plugins.h"
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
# define VGMSTREAM_VERSION "(unknown version)" #define VGMSTREAM_VERSION "unknown version " __DATE__
#endif #endif
#define APP_NAME "vgmstream123 player " VGMSTREAM_VERSION
#define APP_INFO APP_NAME " (" __DATE__ ")"
//TODO: improve WIN32 builds (some features/behaviors are missing but works) //TODO: improve WIN32 builds (some features/behaviors are missing but works)
@ -122,9 +125,9 @@ static int record_interrupt(void) {
return ret; return ret;
} }
static void usage(const char *progname) { static void usage(const char* progname) {
song_settings_t default_par = DEFAULT_PARAMS; song_settings_t default_par = DEFAULT_PARAMS;
const char *default_driver = "???"; const char* default_driver = "???";
{ {
ao_info *info = ao_driver_info(driver_id); ao_info *info = ao_driver_info(driver_id);
@ -132,10 +135,8 @@ static void usage(const char *progname) {
default_driver = info->short_name; default_driver = info->short_name;
} }
printf("vgmstream123 " VGMSTREAM_VERSION ", built " __DATE__ "\n" printf(APP_INFO "\n"
"\n" "Usage: %s [options] <infile> ...\n"
"Usage: %s [options] INFILE ...\n"
"Play streamed audio from video games.\n"
"\n" "\n"
"Options:\n" "Options:\n"
" -d DRV Use output driver DRV [%s]; available drivers:\n" " -d DRV Use output driver DRV [%s]; available drivers:\n"
@ -175,7 +176,7 @@ static void usage(const char *progname) {
" -E Really force loop (repeat file)\n" " -E Really force loop (repeat file)\n"
" -p Play forever (loops file until stopped)\n" " -p Play forever (loops file until stopped)\n"
"\n" "\n"
"INFILE can be any stream file type supported by vgmstream, or an .m3u/.m3u8\n" "<infile> can be any stream file type supported by vgmstream, or an .m3u/.m3u8\n"
"playlist referring to same. This program supports the \"EXT-X-VGMSTREAM\" tag\n" "playlist referring to same. This program supports the \"EXT-X-VGMSTREAM\" tag\n"
"in playlists, and files compressed with gzip/bzip2/xz.\n", "in playlists, and files compressed with gzip/bzip2/xz.\n",
buffer_size_kb, buffer_size_kb,
@ -254,11 +255,11 @@ static void apply_config(VGMSTREAM* vgmstream, song_settings_t* cfg) {
vgmstream_apply_config(vgmstream, &vcfg); vgmstream_apply_config(vgmstream, &vcfg);
} }
static int play_vgmstream(const char *filename, song_settings_t *cfg) { static int play_vgmstream(const char* filename, song_settings_t* cfg) {
int ret = 0; int ret = 0;
STREAMFILE* sf; STREAMFILE* sf;
VGMSTREAM *vgmstream; VGMSTREAM* vgmstream;
FILE *save_fps[4]; FILE* save_fps[4];
size_t buffer_size; size_t buffer_size;
int32_t max_buffer_samples; int32_t max_buffer_samples;
int i; int i;

View File

@ -1,9 +1,16 @@
/**
* vgmstream CLI decoder
*/
#define POSIXLY_CORRECT #define POSIXLY_CORRECT
#include <getopt.h> #include <getopt.h>
#include "../src/vgmstream.h" #include "../src/vgmstream.h"
#include "../src/plugins.h" #include "../src/plugins.h"
#include "../src/util.h" #include "../src/util.h"
//todo use <>?
#ifdef HAVE_JSON
#include "jansson/jansson.h"
#endif
#ifdef WIN32 #ifdef WIN32
#include <io.h> #include <io.h>
@ -16,14 +23,14 @@
#define STDOUT_FILENO 1 #define STDOUT_FILENO 1
#endif #endif
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)" #define VGMSTREAM_VERSION "unknown version " __DATE__
#endif #endif
#define APP_NAME "vgmstream CLI decoder " VGMSTREAM_VERSION
#define APP_INFO APP_NAME " (" __DATE__ ")"
#ifdef HAVE_JSON
#include "jansson/jansson.h"
#endif
/* low values are ok as there is very little performance difference, but higher /* low values are ok as there is very little performance difference, but higher
* may improve write I/O in some systems as this*channels doubles as output buffer */ * may improve write I/O in some systems as this*channels doubles as output buffer */
@ -37,8 +44,8 @@
static size_t make_wav_header(uint8_t* buf, size_t buf_size, int32_t sample_count, int32_t sample_rate, int channels, int smpl_chunk, int32_t loop_start, int32_t loop_end); static size_t make_wav_header(uint8_t* buf, size_t buf_size, int32_t sample_count, int32_t sample_rate, int channels, int smpl_chunk, int32_t loop_start, int32_t loop_end);
static void usage(const char* name, int is_full) { static void usage(const char* name, int is_full) {
fprintf(stderr,"vgmstream CLI decoder " VGMSTREAM_VERSION " " __DATE__ "\n" fprintf(stderr, APP_INFO "\n"
"Usage: %s [-o <outfile.wav>] [options] <infile>\n" "Usage: %s [-o <outfile.wav>] [options] <infile> ...\n"
"Options:\n" "Options:\n"
" -o <outfile.wav>: name of output .wav file, default <infile>.wav\n" " -o <outfile.wav>: name of output .wav file, default <infile>.wav\n"
" <outfile> wildcards can be ?s=subsong, ?n=stream name, ?f=infile\n" " <outfile> wildcards can be ?s=subsong, ?n=stream name, ?f=infile\n"

View File

@ -48,7 +48,7 @@ Generating done
Before that you'll see what options are enabled and disabled, what is going to be built and where they will be installed to. Before that you'll see what options are enabled and disabled, what is going to be built and where they will be installed to.
You may need to select a Generator first, depending on your installed tools (for example, Visual Studio 16 2019 or MingW Make on Windows). If you need to change it later, select *File > Delete Cache*. You may need to select a Generator first, depending on your installed tools (for example, Visual Studio 16 2019 or MingW Make on Windows). If you need to change it later, select *File > Delete Cache*. You may need to include those tools in the *Path* variable, inside *Environment...* options.
If you decided to build for a project-based GUI, you can click on Open Project to open that. (NOTE: Only Visual Studio has been tested as a project-based GUI.) If you decided to build for a command line build system, you can open up the command line for the build directory and run your build system. If you decided to build for a project-based GUI, you can click on Open Project to open that. (NOTE: Only Visual Studio has been tested as a project-based GUI.) If you decided to build for a command line build system, you can open up the command line for the build directory and run your build system.

View File

@ -19,20 +19,21 @@ extern "C" {
#include "foo_vgmstream.h" #include "foo_vgmstream.h"
#include "foo_filetypes.h" #include "foo_filetypes.h"
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
#define PLUGIN_VERSION __DATE__ #define VGMSTREAM_VERSION "unknown version " __DATE__
#else
#define PLUGIN_VERSION VGMSTREAM_VERSION
#endif #endif
#define APP_NAME "vgmstream plugin" #define PLUGIN_NAME "vgmstream plugin"
#define PLUGIN_DESCRIPTION "vgmstream plugin " VGMSTREAM_VERSION " " __DATE__ "\n" \ #define PLUGIN_VERSION VGMSTREAM_VERSION
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n" \ #define PLUGIN_INFO PLUGIN_NAME " " PLUGIN_VERSION " (" __DATE__ ")"
#define PLUGIN_DESCRIPTION PLUGIN_INFO "\n" \
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm, Nicknine, Thealexbarney, CyberBotX, and many others\n" \
"\n" \ "\n" \
"foobar2000 plugin by Josh W, kode54\n" \ "foobar2000 plugin by Josh W, kode54, others\n" \
"\n" \ "\n" \
"https://github.com/kode54/vgmstream/\n" \ "https://github.com/vgmstream/vgmstream/\n" \
"https://sourceforge.net/projects/vgmstream/ (original)" "https://sourceforge.net/projects/vgmstream/ (original)"
#define PLUGIN_FILENAME "foo_input_vgmstream.dll" #define PLUGIN_FILENAME "foo_input_vgmstream.dll"
@ -499,5 +500,5 @@ bool input_vgmstream::g_is_low_merit() {
// foobar plugin defs // foobar plugin defs
static input_factory_t<input_vgmstream> g_input_vgmstream_factory; static input_factory_t<input_vgmstream> g_input_vgmstream_factory;
DECLARE_COMPONENT_VERSION(APP_NAME, PLUGIN_VERSION, PLUGIN_DESCRIPTION); DECLARE_COMPONENT_VERSION(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_DESCRIPTION);
VALIDATE_COMPONENT_FILENAME(PLUGIN_FILENAME); VALIDATE_COMPONENT_FILENAME(PLUGIN_FILENAME);

View File

@ -1,18 +1,50 @@
#!/bin/sh #!/bin/sh
# echo current git version (doesn't make version_auto.h) # echo current git version (doesn't make version_auto.h)
VERSION_EMPTY=$1
#VERSION_FILE=--
VERSION_NAME=$2
if [ -z "$VERSION_EMPTY" ]; then VERSION_EMPTY=false; fi
#if [ -z "$VERSION_FILE" ]; then VERSION_FILE=version_auto.h; fi
if [ -z "$VERSION_NAME" ]; then VERSION_NAME=VGMSTREAM_VERSION; fi
VERSION_DEFAULT=unknown
# try get version from Git (dynamic), including lightweight tags # try get version from Git (dynamic), including lightweight tags
if ! command -v git > /dev/null if ! command -v git > /dev/null ; then
then VERSION=""
VERSION="unknown"
else else
VERSION=$(git describe --tags --always 2>&1 | tr : _ ) VERSION=$(git describe --tags --always 2>&1 | tr : _ )
if case "$VERSION" in fatal*) true;; *) false;; esac; then
VERSION=""
fi
fi fi
# ignore git stderr "fatal:
if case $VERSION in fatal*) ;; *) false;; esac; then if [ ! -z "$VERSION" ]; then
echo "unknown" LINE="$VERSION"
else else
echo "$VERSION" # try to get version from version.h (static)
fi; #echo "Git version not found, can't autogenerate version (using default)"
# option to output empty line instead of default version, so plugins can detect git-less builds
if [ "$VERSION_EMPTY" = "true" ]; then
LINE="/* ignored */"
else
LINE="$VERSION_DEFAULT"
while IFS= read -r <&3 ITEM; do
COMP="#define $VERSION_NAME"
if case "$ITEM" in *"$COMP"*) true;; *) false;; esac; then
# clean "#define ..." leaving rXXXX only
REGEX_REMOVE1="#define $VERSION_NAME \""
REGEX_REMOVE2="\".*"
LINE="$ITEM"
LINE=$(echo $LINE | sed "s/$REGEX_REMOVE1//")
LINE=$(echo $LINE | sed "s/$REGEX_REMOVE2//")
fi
done 3< "version.h"
fi
fi
# final print
echo "$LINE"

View File

@ -2,15 +2,13 @@
setlocal enableextensions enabledelayedexpansion setlocal enableextensions enabledelayedexpansion
REM creates or updates version_auto.h REM creates or updates version_auto.h
REM params: $1=filename (usually version_auto.h), $2=VARNAME (usually VGMSTREAM_VERSION) set VERSION_EMPTY=%1
set VERSION_FILE=%2
set VERSION_NAME=%3
REM defaults if "%~1" == "" set VERSION_EMPTY=false
if "%~2" == "" set VERSION_FILE=version_auto.h
if "%~3" == "" set VERSION_NAME=VGMSTREAM_VERSION
set VERSION_DEFAULT=unknown set VERSION_DEFAULT=unknown
set VERSION_FILE=%1
set VERSION_NAME=%2
if "%~1" == "" set VERSION_FILE=version_auto.h
if "%~2" == "" set VERSION_NAME=VGMSTREAM_VERSION
if not "%VERSION%"=="" set VERSION=!VERSION:^:=_! if not "%VERSION%"=="" set VERSION=!VERSION:^:=_!
cd /d "%~dp0" cd /d "%~dp0"
@ -29,12 +27,17 @@ goto :got_version
REM try to get version from version.h (static) REM try to get version from version.h (static)
:get_version_h :get_version_h
echo Git version not found, can't autogenerate version (using default) echo Git version not found, can't autogenerate version (using default)
set LINE=#define %VERSION_NAME% "%VERSION_DEFAULT%" /* autogenerated */ REM option to output empty line instead of default version, so plugins can detect git-less builds
if exist "version.h" ( if "%VERSION_EMPTY%"=="true" (
for /F "tokens=*" %%v in (version.h) do ( set LINE=/* ignored */
set TOKEN=%%v ) else (
REM set COMP=#define %VERSION_NAME% #todo set LINE=#define %VERSION_NAME% "%VERSION_DEFAULT%" /* autogenerated */
if /i "!TOKEN:~0,25!"=="#define VGMSTREAM_VERSION" set LINE=%%v if exist "version.h" (
for /F "tokens=*" %%v in (version.h) do (
set TOKEN=%%v
REM set COMP=#define %VERSION_NAME% #todo
if /i "!TOKEN:~0,25!"=="#define VGMSTREAM_VERSION" set LINE=%%v /* default */
)
) )
) )
goto :got_version goto :got_version

View File

@ -1,33 +1,43 @@
#!/bin/sh #!/bin/sh
# make current git version (overwrites version_auto.h) # make current git version (overwrites version_auto.h)
VERSION_EMPTY=$1
VERSION_FILE=$2
VERSION_NAME=$3
if [ -z "$VERSION_EMPTY" ]; then VERSION_EMPTY=false; fi
if [ -z "$VERSION_FILE" ]; then VERSION_FILE=version_auto.h; fi
if [ -z "$VERSION_NAME" ]; then VERSION_NAME=VGMSTREAM_VERSION; fi
VERSION_DEFAULT=unknown VERSION_DEFAULT=unknown
VERSION_NAME=VGMSTREAM_VERSION
VERSION_FILE=version_auto.h
# try get version from Git (dynamic), including lightweight tags # try get version from Git (dynamic), including lightweight tags
if ! command -v git > /dev/null ; then if ! command -v git > /dev/null ; then
VERSION="" VERSION=""
else else
VERSION=$(git describe --tags --always 2>&1 | tr : _ ) VERSION=$(git describe --tags --always 2>&1 | tr : _ )
if case "$VERSION" in fatal*) true;; *) false;; esac; then
VERSION=""
fi
fi fi
# ignore git stderr "fatal:*" or blank if [ ! -z "$VERSION" ]; then
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */" LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */"
else else
# try to get version from version.h (static) # try to get version from version.h (static)
echo "Git version not found, can't autogenerate version (using default)" echo "Git version not found, can't autogenerate version (using default)"
LINE="#define $VERSION_NAME \"$VERSION_DEFAULT\" /* autogenerated */"
while IFS= read -r -u3 item; do # option to output empty line instead of default version, so plugins can detect git-less builds
COMP="#define $VERSION_NAME*" if [ "$VERSION_EMPTY" = "true" ]; then
if [[ $item == $COMP ]] ; then LINE="/* ignored */"
LINE=$item else
fi LINE="#define $VERSION_NAME \"$VERSION_DEFAULT\" /* autogenerated */"
done 3< "version.h" while IFS= read -r <&3 ITEM; do
COMP="#define $VERSION_NAME"
if case "$ITEM" in *"$COMP"*) true;; *) false;; esac; then
LINE="$ITEM /* default */"
fi
done 3< "version.h"
fi
fi fi
@ -36,6 +46,6 @@ LINE_ORIGINAL="none"
if test -f "version_auto.h"; then if test -f "version_auto.h"; then
LINE_ORIGINAL=$(<version_auto.h) LINE_ORIGINAL=$(<version_auto.h)
fi fi
if [[ $LINE != $LINE_ORIGINAL ]] ; then if [ ! "$LINE" = "$LINE_ORIGINAL" ]; then
echo "$LINE" > "$VERSION_FILE" echo "$LINE" > "$VERSION_FILE"
fi fi

View File

@ -9,9 +9,9 @@
#else #else
/* Static/fallback version. /* Static/fallback version.
* Version is autogenerated from Git (passed via compiler args, or updated with scripts), but this file is * Version is autogenerated from Git (passed via compiler args, or updated with scripts), but this file is
* for Git-less builds (not installed or downloaded master) and builds that don't do the above should still work * for Git-less builds (not installed or downloaded master). Builds that don't do the above should still work
* (compiling a well-behaved src shouldn't depend on calling arbitrary scripts). */ * (compiling a well-behaved src shouldn't depend on calling arbitrary scripts). */
#define VGMSTREAM_VERSION "r1625" #define VGMSTREAM_VERSION "r1626"
#endif #endif
#endif #endif

View File

@ -40,7 +40,7 @@ SRC_SRCS = in_vgmstream.c in_streamfile.c in_config.c
### targets ### targets
in_vgmstream: libvgmstream.a $(TARGET_EXT_LIBS) resource.o in_vgmstream: libvgmstream.a $(TARGET_EXT_LIBS) resource.o
$(CC) -shared -static-libgcc $(CFLAGS) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" $(SRC_SRCS) resource.o $(LDFLAGS) -o $(OUTPUT_WINAMP) $(CC) -shared -static-libgcc $(CFLAGS) $(SRC_SRCS) resource.o $(LDFLAGS) -o $(OUTPUT_WINAMP)
$(STRIP) $(OUTPUT_WINAMP) $(STRIP) $(OUTPUT_WINAMP)
resource.o: resource.rc resource.h resource.o: resource.rc resource.h

View File

@ -3,12 +3,14 @@
*/ */
#include "in_vgmstream.h" #include "in_vgmstream.h"
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)" #define VGMSTREAM_VERSION "unknown version " __DATE__
#endif #endif
#define PLUGIN_DESCRIPTION "vgmstream plugin " VGMSTREAM_VERSION " " __DATE__ #define PLUGIN_NAME "vgmstream plugin " VGMSTREAM_VERSION
#define PLUGIN_INFO PLUGIN_NAME " (" __DATE__ ")"
/* ***************************************** */ /* ***************************************** */
@ -320,12 +322,12 @@ static double get_album_gain_volume(const in_char* fn) {
/* about dialog */ /* about dialog */
void winamp_About(HWND hwndParent) { void winamp_About(HWND hwndParent) {
const char* ABOUT_TEXT = const char* ABOUT_TEXT =
PLUGIN_DESCRIPTION "\n" PLUGIN_INFO "\n"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n" "by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm, Nicknine, Thealexbarney, CyberBotX, and many others\n"
"\n" "\n"
"Winamp plugin by hcs, others\n" "Winamp plugin by hcs, others\n"
"\n" "\n"
"https://github.com/kode54/vgmstream/\n" "https://github.com/vgmstream/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)"; "https://sourceforge.net/projects/vgmstream/ (original)";
{ {
@ -536,7 +538,7 @@ int winamp_InfoBox(const in_char *fn, HWND hwnd) {
size_t description_size = 1024; size_t description_size = 1024;
double tmpVolume = 1.0; double tmpVolume = 1.0;
concatn(description_size,description,PLUGIN_DESCRIPTION "\n\n"); concatn(description_size,description,PLUGIN_INFO "\n\n");
if (!fn || !*fn) { if (!fn || !*fn) {
/* no filename = current playing file */ /* no filename = current playing file */
@ -759,7 +761,7 @@ void winamp_Config(HWND hwndParent) {
/* main plugin def */ /* main plugin def */
In_Module input_module = { In_Module input_module = {
IN_VER, IN_VER,
PLUGIN_DESCRIPTION, PLUGIN_NAME,
0, /* hMainWindow (filled in by Winamp) */ 0, /* hMainWindow (filled in by Winamp) */
0, /* hDllInstance (filled in by Winamp) */ 0, /* hDllInstance (filled in by Winamp) */
working_extension_list, working_extension_list,

View File

@ -36,7 +36,7 @@ export CFLAGS LDFLAGS
### targets ### targets
xmp_vgmstream: libvgmstream.a $(TARGET_EXT_LIBS) xmp_vgmstream: libvgmstream.a $(TARGET_EXT_LIBS)
$(CC) -shared -static-libgcc $(CFLAGS) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" xmp_vgmstream.c $(LDFLAGS) -o $(OUTPUT_XMPLAY) xmpin.def $(CC) -shared -static-libgcc $(CFLAGS) xmp_vgmstream.c $(LDFLAGS) -o $(OUTPUT_XMPLAY) xmpin.def
$(STRIP) $(OUTPUT_XMPLAY) $(STRIP) $(OUTPUT_XMPLAY)
libvgmstream.a: libvgmstream.a:

View File

@ -18,8 +18,11 @@
#include "../version.h" #include "../version.h"
#ifndef VGMSTREAM_VERSION #ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)" #define VGMSTREAM_VERSION "unknown version " __DATE__
#endif #endif
#define PLUGIN_NAME "vgmstream plugin " VGMSTREAM_VERSION
#define PLUGIN_INFO PLUGIN_NAME " (" __DATE__ ")"
/* ************************************* */ /* ************************************* */
@ -433,12 +436,12 @@ static void build_extension_list() {
/* info for the "about" button in plugin options */ /* info for the "about" button in plugin options */
void WINAPI xmplay_About(HWND win) { void WINAPI xmplay_About(HWND win) {
MessageBox(win, MessageBox(win,
"vgmstream plugin " VGMSTREAM_VERSION " " __DATE__ "\n" PLUGIN_INFO "\n"
"by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm and many others\n" "by hcs, FastElbja, manakoAT, bxaimc, snakemeat, soneek, kode54, bnnm, Nicknine, Thealexbarney, CyberBotX, and many others\n"
"\n" "\n"
"XMPlay plugin by unknownfile, PSXGamerPro1, kode54\n" "XMPlay plugin by unknownfile, PSXGamerPro1, kode54, others\n"
"\n" "\n"
"https://github.com/kode54/vgmstream/\n" "https://github.com/vgmstream/vgmstream/\n"
"https://sourceforge.net/projects/vgmstream/ (original)" "https://sourceforge.net/projects/vgmstream/ (original)"
,"about xmp-vgmstream",MB_OK); ,"about xmp-vgmstream",MB_OK);
} }