builds: fix makefile version issues and cleanup

This commit is contained in:
bnnm 2021-08-15 19:15:56 +02:00
parent f6f26c7992
commit 2fbbe32386
9 changed files with 77 additions and 53 deletions

View File

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

View File

@ -6,7 +6,7 @@ inputplugindir = $(plugindir)/$(INPUT_PLUGIN_DIR)
inputplugin_LTLIBRARIES = libvgmstream.la
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 =
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)

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/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
VGMSTREAM_VERSION=`./version-get.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
sh version-make.sh
# create fake files expected by automake and process
touch README AUTHORS NEWS ChangeLog

View File

@ -44,11 +44,11 @@ export CFLAGS LDFLAGS
### targets
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)
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)
libvgmstream.a:

View File

@ -6,7 +6,7 @@ if HAVE_LIBAO
bin_PROGRAMS += vgmstream123
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
vgmstream_cli_SOURCES = vgmstream_cli.c

View File

@ -1,18 +1,38 @@
#!/bin/sh
# echo current git version (doesn't make version_auto.h)
VERSION_DEFAULT=unknown
VERSION_NAME=VGMSTREAM_VERSION
#VERSION_FILE=version_auto.h
# try get version from Git (dynamic), including lightweight tags
if ! command -v git > /dev/null
then
VERSION="unknown"
if ! command -v git > /dev/null ; then
VERSION=""
else
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
fi
# ignore git stderr "fatal:
if case $VERSION in fatal*) ;; *) false;; esac; then
echo "unknown"
# ignore git stderr "fatal:*" or blank
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
LINE="$VERSION"
else
echo "$VERSION"
fi;
# try to get version from version.h (static)
#echo "Git version not found, can't autogenerate version (using default)"
LINE="$VERSION_DEFAULT"
while IFS= read -r -u3 item; do
COMP="#define $VERSION_NAME*"
if [[ $item == $COMP ]] ; then
STR_REM1="*$VERSION_NAME \""
STR_REM2="\"*"
LINE=$item
LINE=${LINE/$STR_REM1/}
LINE=${LINE/$STR_REM2/}
fi
done 3< "version.h"
fi
# final print
echo "$LINE"

View File

@ -13,7 +13,6 @@ else
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
fi
# ignore git stderr "fatal:*" or blank
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */"

View File

@ -40,7 +40,7 @@ SRC_SRCS = in_vgmstream.c in_streamfile.c in_config.c
### targets
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)
resource.o: resource.rc resource.h

View File

@ -36,7 +36,7 @@ export CFLAGS LDFLAGS
### targets
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)
libvgmstream.a: