ref: 68b89f9cbbf88d056f1f61718caed24aff3d8cbb
parent: a4848367b5f8fbc5d65d47502b7c56ddac885ef6
author: Ricardo Constantino <[email protected]>
date: Sun Jan 22 08:06:52 EST 2017
win32: use same genversion script as opus Like with opus, this generates an unknown version for git archives (like the ones generated by GitHub). If you need a proper version either use releases, a proper git repo or craft your own package_version. Signed-off-by: Mark Harris <[email protected]>
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,8 +37,7 @@
win32/genversion.bat \
win32/config.h \
win32/unicode_support.h \
- win32/unicode_support.c \
- win32/version.h
+ win32/unicode_support.c
dist_man_MANS = man/opusenc.1 man/opusdec.1 man/opusinfo.1
--- a/win32/genversion.bat
+++ b/win32/genversion.bat
@@ -1,17 +1,37 @@
@echo off
-for /f %%v in ('git describe --tags --match "v*" --always') do set version=%%v
+setlocal enableextensions enabledelayedexpansion
-set version_out=#define %2 "%version%"
+for /f %%v in ('cd "%~dp0.." ^&^& git status ^>NUL 2^>NUL ^&^& git describe --tags --match "v*" --dirty 2^>NUL') do set version=%%v
-echo %version_out% > %1_temp
+if not "%version%"=="" set version=!version:~1! && goto :gotversion
-echo n | comp %1_temp %1 > NUL 2> NUL
+if exist "%~dp0..\package_version" goto :getversion
+echo Git cannot be found, nor can package_version. Generating unknown version.
+
+set version=unknown
+
+goto :gotversion
+
+:getversion
+
+for /f "delims== tokens=2" %%v in (%~dps0..\package_version) do set version=%%v
+set version=!version:"=!
+
+:gotversion
+
+set version=!version: =!
+set version_out=#define %~2 "%version%"
+
+echo %version_out%> "%~1_temp"
+
+echo n | comp "%~1_temp" "%~1" > NUL 2> NUL
+
if not errorlevel 1 goto exit
-copy /y %1_temp %1
+copy /y "%~1_temp" "%~1"
:exit
-del %1_temp
+del "%~1_temp"
--- a/win32/version.h
+++ /dev/null
@@ -1,1 +1,0 @@
-#define PACKAGE_VERSION "v0.1.9-dev"