2023-12-16 15:53:41 +08:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
setlocal
|
|
|
|
pushd "%~dp0"
|
|
|
|
|
|
|
|
set "venv=.env-win"
|
|
|
|
set "out_dir=bin\win"
|
2023-12-27 01:53:10 +08:00
|
|
|
set "build_temp_dir=build\tmp\win"
|
2023-12-16 15:53:41 +08:00
|
|
|
set "tool_name=generate_emu_config"
|
|
|
|
set "icon_file=icon\Froyoshark-Enkel-Steam.ico"
|
|
|
|
set "main_file=generate_emu_config.py"
|
2024-01-01 01:52:17 +08:00
|
|
|
set "signer_tool=..\..\third-party\build\win\cert\sign_helper.bat"
|
2023-12-16 15:53:41 +08:00
|
|
|
|
|
|
|
set /a last_code=0
|
|
|
|
|
2024-01-01 01:52:17 +08:00
|
|
|
if not exist "%signer_tool%" (
|
|
|
|
1>&2 echo "[X] signing tool wasn't found"
|
|
|
|
set /a last_code=1
|
|
|
|
goto :script_end
|
|
|
|
)
|
|
|
|
|
2023-12-16 15:53:41 +08:00
|
|
|
if exist "%out_dir%" (
|
|
|
|
rmdir /s /q "%out_dir%"
|
|
|
|
)
|
|
|
|
mkdir "%out_dir%"
|
|
|
|
|
|
|
|
if exist "%build_temp_dir%" (
|
|
|
|
rmdir /s /q "%build_temp_dir%"
|
|
|
|
)
|
|
|
|
|
|
|
|
del /f /q "*.spec"
|
|
|
|
|
|
|
|
call "%venv%\Scripts\activate.bat"
|
|
|
|
|
|
|
|
pyinstaller "%main_file%" --distpath "%out_dir%" -y --clean --onedir --name "%tool_name%" --noupx --console -i "%icon_file%" --workpath "%build_temp_dir%" --collect-submodules "steam" || (
|
|
|
|
set /a last_code=1
|
|
|
|
goto :script_end
|
|
|
|
)
|
2024-01-01 01:52:17 +08:00
|
|
|
for /f "usebackq tokens=* delims=" %%A in ('"%main_file%"') do (
|
|
|
|
call "%signer_tool%" "%out_dir%\%tool_name%\%%~nA.exe"
|
|
|
|
)
|
2023-12-16 15:53:41 +08:00
|
|
|
|
|
|
|
copy /y "steam_default_icon_locked.jpg" "%out_dir%\%tool_name%\"
|
|
|
|
copy /y "steam_default_icon_unlocked.jpg" "%out_dir%\%tool_name%\"
|
2023-12-30 02:47:07 +08:00
|
|
|
copy /y "README.md" "%out_dir%\%tool_name%\"
|
2023-12-16 15:53:41 +08:00
|
|
|
|
|
|
|
echo:
|
|
|
|
echo =============
|
|
|
|
echo Built inside: "%out_dir%\"
|
|
|
|
|
2023-12-27 01:26:58 +08:00
|
|
|
if exist "%build_temp_dir%" (
|
|
|
|
rmdir /s /q "%build_temp_dir%"
|
|
|
|
)
|
|
|
|
|
2023-12-16 15:53:41 +08:00
|
|
|
:script_end
|
|
|
|
popd
|
|
|
|
endlocal & (
|
|
|
|
exit /b %last_code%
|
|
|
|
)
|