forked from Detanup01/gbe_fork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package_win.bat
104 lines (82 loc) · 2.76 KB
/
package_win.bat
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
set /a "MAX_THREADS=2"
if defined NUMBER_OF_PROCESSORS (
:: use 70%
set /a "MAX_THREADS=%NUMBER_OF_PROCESSORS% * 70 / 100"
if %MAX_THREADS% lss 1 (
set /a "MAX_THREADS=1"
)
)
set "ROOT=%cd%"
set "BUILD_DIR=%ROOT%\build\win"
set "OUT_DIR=%ROOT%\build\package\win"
if "%~1" equ "" (
1>&2 echo:missing build target folder arg
goto :end_script_with_err
)
set "TARGET_DIR=%BUILD_DIR%\%~1"
if not exist "%TARGET_DIR%\" (
1>&2 echo:build target folder wasn't found
goto :end_script_with_err
)
set /a "BUILD_DEBUG=0"
if "%~2" equ "1" (
set /a "BUILD_DEBUG=1"
)
set /a "PKG_EXE_MEM_PERCENT=90"
set /a "PKG_EXE_DICT_SIZE_MB=384"
set "PKG_EXE=third-party\deps\win\7za\7za.exe"
if not exist "%PKG_EXE%" (
1>&2 echo:packager wasn't found
goto :end_script_with_err
)
::::::::::::::::::::::::::::::::::::::::::
echo:// copying readmes + example files
xcopy /y /s /e /r "%ROOT%\post_build\steam_settings.EXAMPLE\" "%TARGET_DIR%\steam_settings.EXAMPLE\"
copy /y "%ROOT%\post_build\README.release.md" "%TARGET_DIR%\"
copy /y "%ROOT%\CHANGELOG.md" "%TARGET_DIR%\"
copy /y "%ROOT%\CREDITS.md" "%TARGET_DIR%\"
if %BUILD_DEBUG% equ 1 (
copy /y "%ROOT%\post_build\README.debug.md" "%TARGET_DIR%\"
)
if exist "%TARGET_DIR%\experimental\" (
copy /y "%ROOT%\post_build\README.experimental.md" "%TARGET_DIR%\experimental\"
)
if exist "%TARGET_DIR%\steamclient_experimental\" (
xcopy /y /s /e /r "%ROOT%\post_build\win\ColdClientLoader.EXAMPLE\" "%TARGET_DIR%\steamclient_experimental\dll_injection.EXAMPLE\"
copy /y "%ROOT%\post_build\README.experimental_steamclient.md" "%TARGET_DIR%\steamclient_experimental\"
copy /y "%ROOT%\tools\steamclient_loader\win\ColdClientLoader.ini" "%TARGET_DIR%\steamclient_experimental\"
)
if exist "%TARGET_DIR%\tools\generate_interfaces\" (
copy /y "%ROOT%\post_build\README.generate_interfaces.md" "%TARGET_DIR%\tools\generate_interfaces\"
)
if exist "%TARGET_DIR%\tools\lobby_connect\" (
copy /y "%ROOT%\post_build\README.lobby_connect.md" "%TARGET_DIR%\tools\lobby_connect\"
)
::::::::::::::::::::::::::::::::::::::::::
set "ACHIVE_DIR=%OUT_DIR%\%~1"
if exist "%ACHIVE_DIR%\" (
rmdir /s /q "%ACHIVE_DIR%"
)
for %%A in ("%ACHIVE_DIR%") do (
md "%%~dpA"
)
set "ACHIVE_FILE="
for %%A in ("%ACHIVE_DIR%") do (
set "ACHIVE_FILE=%%~dpAemu-win-%%~nxA.7z"
)
if exist "%ACHIVE_FILE%" (
del /f /q "%ACHIVE_FILE%"
)
call "%PKG_EXE%" a "%ACHIVE_FILE%" "%TARGET_DIR%" -t7z -xr^^!*.lib -xr^^!*.exp -slp -ssw -mx -myx -mmemuse=p%PKG_EXE_MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%PKG_EXE_DICT_SIZE_MB%m -mmt=%MAX_THREADS% -mmtf+ -mtm- -mtc- -mta- -mtr+ || (
goto :end_script_with_err
)
goto :end_script
:end_script
endlocal
exit /b 0
:end_script_with_err
endlocal
exit /b 1