builds: clean version makers a bit

This commit is contained in:
bnnm 2021-08-08 14:00:58 +02:00
parent 483ee87498
commit 25b95c61ae
10 changed files with 37 additions and 16 deletions

View File

@ -96,9 +96,9 @@ if(WIN32)
if(MSVC) if(MSVC)
file(TO_NATIVE_PATH "${VGM_BINARY_DIR}/version.h" VERSION_H_PATH) file(TO_NATIVE_PATH "${VGM_BINARY_DIR}/version.h" VERSION_H_PATH)
add_custom_command(OUTPUT ${VGM_BINARY_DIR}/version.h add_custom_command(OUTPUT ${VGM_BINARY_DIR}/version.h
COMMAND "${VGM_SOURCE_DIR}/version.bat" COMMAND "${VGM_SOURCE_DIR}/version-make.bat"
ARGS ${VERSION_H_PATH} ARGS ${VERSION_H_PATH}
DEPENDS ${VGM_SOURCE_DIR}/version.bat) DEPENDS ${VGM_SOURCE_DIR}/version-make.bat)
add_custom_target(version_h DEPENDS ${VGM_BINARY_DIR}/version.h) add_custom_target(version_h DEPENDS ${VGM_BINARY_DIR}/version.h)
else() else()
find_package(Git) find_package(Git)

View File

@ -4,9 +4,9 @@
ifeq ($(VGMSTREAM_VERSION),) ifeq ($(VGMSTREAM_VERSION),)
# for current dir (expanded later) # for current dir (expanded later)
VGMSTREAM_VERSION_CURR=`./version.sh` VGMSTREAM_VERSION_CURR=`./version-get.sh`
# for subdirs (expanded later) # for subdirs (expanded later)
VGMSTREAM_VERSION_PREV=`../version.sh` VGMSTREAM_VERSION_PREV=`../version-get.sh`
else else
VGMSTREAM_VERSION_CURR=$(VGMSTREAM_VERSION) VGMSTREAM_VERSION_CURR=$(VGMSTREAM_VERSION)
VGMSTREAM_VERSION_PREV=$(VGMSTREAM_VERSION) VGMSTREAM_VERSION_PREV=$(VGMSTREAM_VERSION)
@ -183,8 +183,8 @@ sourceball:
rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR) rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR)
git checkout-index -f -a --prefix=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 # git archive --format zip --output vgmstream-$(VGMSTREAM_VERSION_CURR).zip master
echo "#!/bin/sh" > vgmstream-$(VGMSTREAM_VERSION_CURR)/version.sh echo "#!/bin/sh" > vgmstream-$(VGMSTREAM_VERSION_CURR)/version-get.sh
echo "echo \"$(VGMSTREAM_VERSION_CURR)\"" >> vgmstream-$(VGMSTREAM_VERSION_CURR)/version.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)/* tar cvzf "vgmstream-$(VGMSTREAM_VERSION_CURR).tar.gz" vgmstream-$(VGMSTREAM_VERSION_CURR)/*
rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR) rm -rf vgmstream-$(VGMSTREAM_VERSION_CURR)

View File

@ -27,7 +27,7 @@ sed -i -e "s/EXTRA_DIST =.*/EXTRA_DIST = $AUDACIOUS_HDRS/g" ./audacious/Makefile
# get version to show in about dialogs # get version to show in about dialogs
# again, not very pretty # again, not very pretty
VGMSTREAM_VERSION=`./version.sh` 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" ./audacious/Makefile.autotools.am
sed -i -e "s/VGMSTREAM_VERSION/$VGMSTREAM_VERSION/g" ./cli/Makefile.autotools.am sed -i -e "s/VGMSTREAM_VERSION/$VGMSTREAM_VERSION/g" ./cli/Makefile.autotools.am

View File

@ -88,7 +88,7 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>
@ -116,7 +116,7 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>

View File

@ -88,7 +88,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>
@ -118,7 +118,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>

0
version.sh → version-get.sh Executable file → Normal file
View File

View File

@ -23,7 +23,7 @@ for /f %%v in ('git describe --always') do set version=%%v
if not "%version%"=="" set version=!version:^:=_! if not "%version%"=="" set version=!version:^:=_!
if not "%version%"=="" goto :got_version if not "%version%"=="" goto :got_version
echo Git version cannot be found, can't autogenerate version.h echo Git version not found, can't autogenerate version.h
goto :exit goto :exit

21
version-make.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# make current git version (overwrites version.h)
VERSION_NAME=VGMSTREAM_VERSION
VERSION_FILE=version.h
# test if git exists
if ! command -v git > /dev/null ; then
VERSION=""
else
VERSION=$(git describe --always 2>&1 | tr : _ )
fi
# ignore git stderr "fatal:*" or blank
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
echo "#define $VERSION_NAME \"$VERSION\" /* autogenerated */" > $VERSION_FILE
else
echo "Git version not found, can't autogenerate version.h"
fi;

View File

@ -89,7 +89,7 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>
@ -119,7 +119,7 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>

View File

@ -77,7 +77,7 @@
<ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile> <ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>
@ -107,7 +107,7 @@
<ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile> <ModuleDefinitionFile>xmpin.def</ModuleDefinitionFile>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat"</Command> <Command>"$(ProjectDir)..\version-make.bat"</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message>Generating version</Message> <Message>Generating version</Message>