mirror of
https://github.com/rocketsciencegg/qstat
synced 2026-08-18 12:23:04 -04:00
Add the ability to configure the version of qstat builds and Windows CI Also: * Convert compile docs to markdown. * Remove CVS remnants and old gitmktar. * Remove travis support now we have github actions. * Fix noauto build when gnuconfig.h isn't present. * Add incremental build for windows using qstat.exe target. * Removed os2 support from Makefile.noauto as the OS is long dead.
53 lines
1.4 KiB
Batchfile
Executable file
53 lines
1.4 KiB
Batchfile
Executable file
@echo off
|
|
|
|
:: Default file paramters
|
|
SETLOCAL EnableDelayedExpansion
|
|
SET "VERSION_FILE=.version"
|
|
SET "TEMPLATE_FILE=version.h.tmpl"
|
|
SET "HEADER_FILE=version.h"
|
|
|
|
IF NOT [%1] == [] (
|
|
SET "VERSION_FILE=%1"
|
|
)
|
|
IF NOT [%2] == [] (
|
|
SET "TEMPLATE_FILE=%2"
|
|
)
|
|
IF NOT [%3] == [] (
|
|
SET "HEADER_FILE=%3"
|
|
)
|
|
|
|
IF [!QSTAT_VERSION!] == [] (
|
|
:: QSTAT_VERSION not set determine from git.
|
|
FOR /F "usebackq" %%v IN (`cmd /c "git status --porcelain | grep -Fv 'gnuconfig.h.in~' | grep -E '^(M^| M^|\?\?)' | wc -l | sed -e 's/^[[:space:]]*//'"`) DO (
|
|
IF NOT %%v == 0 (
|
|
:: We have modifications so indicate so in the version.
|
|
SET "QSTAT_VERSION=!QSTAT_VERSION!-modified"
|
|
)
|
|
)
|
|
)
|
|
|
|
IF EXIST "!VERSION_FILE!" (
|
|
:: .version file exists load the value.
|
|
set /p OLD_VERSION=<"!VERSION_FILE!"
|
|
)
|
|
|
|
IF NOT [!OLD_VERSION!] == [!QSTAT_VERSION!] (
|
|
:: version has changed update the file.
|
|
echo|set /p="!QSTAT_VERSION!" > "!VERSION_FILE!"
|
|
)
|
|
|
|
:: Update version.h if needed.
|
|
IF NOT EXIST "!HEADER_FILE!" (
|
|
:: File doesn't exist to just create.
|
|
sed "s/CHANGEME/!QSTAT_VERSION!/g" "!TEMPLATE_FILE!" > "!HEADER_FILE!"
|
|
) else (
|
|
:: File exists compare with new.
|
|
SET "TMP_FILE=!HEADER_FILE!.tmp"
|
|
|
|
sed "s/CHANGEME/!QSTAT_VERSION!/g" "!TEMPLATE_FILE!" > "!TMP_FILE!"
|
|
|
|
:: cmp doesn't correctly set ERRORLEVEL so we use redirection.
|
|
cmp -s "!HEADER_FILE!" "!TMP_FILE!" && rm -f "!TMP_FILE!" || mv "!TMP_FILE!" "!HEADER_FILE!"
|
|
)
|
|
|
|
ENDLOCAL
|