Files
juc500/build-installer-windows.bat
2026-07-21 21:11:19 +09:00

115 lines
4.5 KiB
Batchfile

@echo off
REM JUC500 Windows 설치파일 + 포터블 빌드 (Windows x64에서 실행)
REM 결과:
REM dist\JUC500\JUC500.exe
REM dist\JUC500-portable.exe
REM dist-windows\JUC500-Setup-win64.exe
REM dist-windows\JUC500-win64-portable.zip
REM dist-windows\JUC500-portable.exe
setlocal EnableExtensions EnableDelayedExpansion
cd /d "%~dp0"
echo ============================================
echo JUC500 — Windows Installer / Portable
echo ============================================
echo.
set "PY="
if defined PYTHON set "PY=%PYTHON%"
if not defined PY (
where py >nul 2>&1 && set "PY=py -3.11"
)
if not defined PY set "PY=python"
echo ==^> Python: %PY%
%PY% -c "import sys; assert sys.version_info>=(3,10); assert sys.maxsize>2**32; print(sys.version)" || (
echo 64-bit Python 3.10+ 가 필요합니다.
exit /b 1
)
if not exist "vendor\libusb-1.0.dll" (
echo [!] vendor\libusb-1.0.dll 없음 — USB 동작에 필요합니다.
echo https://github.com/libusb/libusb/releases 에서 MS64 dll 을 넣으세요.
exit /b 1
)
if not exist ".venv-build-win\Scripts\python.exe" (
%PY% -m venv .venv-build-win
)
call .venv-build-win\Scripts\activate.bat
python -m pip install -q -U pip pyinstaller
if exist "vendor\wheels" (
echo ==^> Runtime deps from vendor\wheels
python -m pip install -q --no-index --find-links=vendor\wheels -r requirements.txt || exit /b 1
) else (
python -m pip install -q pyusb pynput six || exit /b 1
)
echo ==^> PyInstaller onedir
if exist build\juc500-windows rmdir /s /q build\juc500-windows 2>nul
if exist build\JUC500 rmdir /s /q build\JUC500 2>nul
if exist dist\JUC500 rmdir /s /q dist\JUC500
python -m PyInstaller --noconfirm --clean juc500-windows.spec
if not exist "dist\JUC500\JUC500.exe" (
echo 빌드 실패: dist\JUC500\JUC500.exe 없음
exit /b 1
)
echo ==^> PyInstaller onefile ^(portable exe^)
python -m PyInstaller --noconfirm --clean juc500-windows-onefile.spec
if not exist "dist\JUC500-portable.exe" (
echo 빌드 실패: dist\JUC500-portable.exe 없음
exit /b 1
)
copy /Y packaging\windows\install.ps1 dist\JUC500\install.ps1 >nul
copy /Y packaging\windows\setup.bat dist\JUC500\setup.bat >nul
copy /Y packaging\windows\README-WIN.txt dist\JUC500\README-WIN.txt >nul
copy /Y packaging\windows\zadig-hint.url dist\JUC500\zadig-hint.url >nul
copy /Y vendor\libusb-1.0.dll dist\JUC500\libusb-1.0.dll >nul 2>nul
if not exist dist-windows mkdir dist-windows
echo ==^> Portable zip + portable exe
powershell -NoProfile -Command ^
"Compress-Archive -Path 'dist\JUC500\*' -DestinationPath 'dist-windows\JUC500-win64-portable.zip' -Force"
copy /Y dist\JUC500-portable.exe dist-windows\JUC500-portable.exe >nul
copy /Y packaging\windows\install.ps1 dist-windows\install.ps1 >nul
copy /Y packaging\windows\README-WIN.txt dist-windows\README-WIN.txt >nul
REM --- Inno Setup → Setup.exe ---
set "ISCC="
if exist "%LocalAppData%\Programs\Inno Setup 6\ISCC.exe" set "ISCC=%LocalAppData%\Programs\Inno Setup 6\ISCC.exe"
if not defined ISCC if exist "%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe" set "ISCC=%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe"
if not defined ISCC if exist "%ProgramFiles%\Inno Setup 6\ISCC.exe" set "ISCC=%ProgramFiles%\Inno Setup 6\ISCC.exe"
if defined ISCC (
echo ==^> Inno Setup: %ISCC%
"%ISCC%" packaging\windows\juc500.iss
) else (
echo.
echo [!] Inno Setup 6 이 없어 Setup.exe 를 생략합니다.
echo https://jrsoftware.org/isinfo.php
echo portable zip / JUC500-portable.exe 는 생성되었습니다.
)
echo ==^> SHA-256 checksums
powershell -NoProfile -Command ^
"$files = Get-ChildItem 'dist-windows' -File | Where-Object { $_.Name -in @('JUC500-Setup-win64.exe','JUC500-portable.exe','JUC500-win64-portable.zip') }; if (-not $files) { throw 'No Windows artifacts found' }; $lines = $files | Sort-Object Name | ForEach-Object { $h = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower(); $h + ' ' + $_.Name }; [IO.File]::WriteAllText((Join-Path $PWD 'dist-windows\SHA256SUMS.txt'), (($lines -join [char]10) + [char]10), [Text.Encoding]::ASCII)"
if errorlevel 1 exit /b 1
echo.
echo ============================================
echo 완료
echo ============================================
echo EXE: %CD%\dist\JUC500\JUC500.exe
echo 포터블 EXE: %CD%\dist-windows\JUC500-portable.exe
echo 포터블 ZIP: %CD%\dist-windows\JUC500-win64-portable.zip
if exist dist-windows\JUC500-Setup-win64.exe (
echo 설치파일: %CD%\dist-windows\JUC500-Setup-win64.exe
) else (
echo 설치파일: ^(미생성 — Inno Setup 6 필요^)
)
echo.
endlocal