summaryrefslogtreecommitdiffhomepage
path: root/tools/mkbindist.bat
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2024-02-26 18:54:16 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2024-02-26 18:54:16 +0000
commitefd2491a3d19160d9cae2a094e7baa9f2d958196 (patch)
tree1cbcae136679bc1411c3758c1252ffdc67d7d12b /tools/mkbindist.bat
Implement initial versionv1.0
Diffstat (limited to 'tools/mkbindist.bat')
-rw-r--r--tools/mkbindist.bat28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/mkbindist.bat b/tools/mkbindist.bat
new file mode 100644
index 0000000..49f5bc8
--- /dev/null
+++ b/tools/mkbindist.bat
@@ -0,0 +1,28 @@
+:: This file is dedicated to the public domain.
+@echo off
+
+:: NOTE: requires 7-zip, either in the default installation dir or %SEVENZIP%
+
+call compile.bat || exit /B
+if not exist release\ md release
+if "%SEVENZIP%"=="" set SEVENZIP=C:\Program Files\7-Zip\7z.exe
+setlocal EnableDelayedExpansion
+for /F "tokens=* usebackq" %%x IN (`^(echo VERSION_MAJOR ^& echo VERSION_MINOR^) ^| ^
+ clang -x c -E -include src\version.h - ^| findstr /v #`) do (
+ :: dumb but works:
+ if "!major!"=="" set major=%%x
+ set minor=%%x
+)
+setlocal DisableDelayedExpansion
+set name=threadfix-v%major%.%minor%-win32
+md TEMP-%name% || exit /B
+copy hl2.wrap.exe TEMP-%name%\hl2.wrap.exe || exit /B
+copy dist\LICENCE-threadfix TEMP-%name%\LICENCE-threadfix || exit /B
+:: using midnight on release day to make zip deterministic! change on next release!
+powershell (Get-Item TEMP-%name%\hl2.wrap.exe).LastWriteTime = new-object DateTime 2024, 2, 26, 0, 0, 0
+powershell (Get-Item TEMP-%name%\LICENCE-threadfix).LastWriteTime = new-object DateTime 2024, 2, 26, 0, 0, 0
+pushd TEMP-%name%
+"%SEVENZIP%" a -mtc=off %name%.zip hl2.wrap.exe LICENCE-threadfix || exit /B
+move %name%.zip ..\release\%name%.zip
+popd
+rd /s /q TEMP-%name%\ || exit /B