_package_release.cmd 1.7 KB

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