-
Notifications
You must be signed in to change notification settings - Fork 38
/
_package_release.cmd
50 lines (44 loc) · 1.7 KB
/
_package_release.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo off
setlocal enableextensions
:: Locate winrar.exe
set winrar="%ProgramFiles%\winrar\winrar.exe"
if not exist %winrar% set winrar="%ProgramFiles(x86)%\winrar\winrar.exe"
if not exist %winrar% (
echo ERROR: Cannot find winrar.exe 1>&2
exit /b 1
)
:: Get head tag and make sure it is sane.
for /f %%i in ('git describe --long --dirty') do set longtag=%%i
set insane=0
if not %longtag:-dirty=%.==%longtag%. set insane=1
if %longtag:-0-g=%.==%longtag%. set insane=1
if %longtag:win/=%.==%longtag%. set insane=1
if %insane%==1 (
echo ERROR: Best HEAD description '%longtag%' is not at a clean tag on winport branch 1>&2
exit /b 1
)
:: Get short description now, strip "win/" for version only
for /f %%i in ('git describe') do set tag=%%i
set tag=%tag:win/=%
:: Create archive with a comment
set cmtfile=%TEMP%\openfst-package-comment.txt
del /q %cmtfile% 2>nul
echo OpenFST binaries for Windows x64, optimized build. >>%cmtfile%
echo Copyright 2005-2019 Google, Inc. (Original source). >>%cmtfile%
echo Copyright 2016-2019 SmartAction LLC (Windows port). >>%cmtfile%
echo Copyright 2016-2019 Johns Hopkins Uni (Windows port). >>%cmtfile%
echo.>>%cmtfile%
echo OpenFST home page: http://www.openfst.org/ >>%cmtfile%
echo Git Repository: https://github.com/kkm000/openfst/ >>%cmtfile%
echo Build tag: %longtag% >>%cmtfile%
set zipfile=openfst-bin-win-x64-%tag%.zip
del /q %zipfile% 2>nul
%winrar% a -ep -m5 -z%cmtfile% %zipfile% NEWS COPYING build_output\x64\Release\bin\*.exe
if errorlevel 1 (
echo "ERROR: Cannot create archive '%zipfile%' 1>&2
del /q %cmtfile% 2>nul
exit /b 1
)
echo SUCCESS: Created archive '%zipfile%' 1>&2
del /q %cmtfile% 2>nul
exit /b 0