annotate src/opus-1.3/win32/genversion.bat @ 77:4edcd14160a5 pa_catalina

Duplicate for patch testing
author Chris Cannam
date Wed, 30 Oct 2019 11:25:10 +0000
parents 7aeed7906520
children
rev   line source
Chris@69 1 @echo off
Chris@69 2
Chris@69 3 setlocal enableextensions enabledelayedexpansion
Chris@69 4
Chris@69 5 for /f %%v in ('cd "%~dp0.." ^&^& git status ^>NUL 2^>NUL ^&^& git describe --tags --match "v*" --dirty 2^>NUL') do set version=%%v
Chris@69 6
Chris@69 7 if not "%version%"=="" set version=!version:~1! && goto :gotversion
Chris@69 8
Chris@69 9 if exist "%~dp0..\package_version" goto :getversion
Chris@69 10
Chris@69 11 echo Git cannot be found, nor can package_version. Generating unknown version.
Chris@69 12
Chris@69 13 set version=unknown
Chris@69 14
Chris@69 15 goto :gotversion
Chris@69 16
Chris@69 17 :getversion
Chris@69 18
Chris@69 19 for /f "delims== tokens=2" %%v in (%~dps0..\package_version) do set version=%%v
Chris@69 20 set version=!version:"=!
Chris@69 21
Chris@69 22 :gotversion
Chris@69 23
Chris@69 24 set version=!version: =!
Chris@69 25 set version_out=#define %~2 "%version%"
Chris@69 26
Chris@69 27 echo %version_out%> "%~1_temp"
Chris@69 28
Chris@69 29 echo n | comp "%~1_temp" "%~1" > NUL 2> NUL
Chris@69 30
Chris@69 31 if not errorlevel 1 goto exit
Chris@69 32
Chris@69 33 copy /y "%~1_temp" "%~1"
Chris@69 34
Chris@69 35 :exit
Chris@69 36
Chris@69 37 del "%~1_temp"