ソースをダウンロードしてビルド、アーカイブを作成するバッチファイルです。
EDCBに加えて以下をビルドします。
- B25Decoder
- lua52
- zlib52
- b24tovtt
- psisiarc
- psisimux
- tsmemseg
- tsreadex
- Write_Multi
- EDCB Material WebUI
必要
Visual Studio
2017以降でビルドできます。
こちらの記事を参考にインストールしてください。
2022で動作確認しています。
Git for Windows
公式サイトの「Download」をクリックします。
インストールで特に変更するところはありません。
7-Zip
公式サイトからダウンロードしてインストールします。
バッチファイル
拡張子を.batにして保存します。
@echo off
setlocal
cd /d %~dp0
rem デフォルト設定
set ARCH=x86
set TARGET=Build
set CONFIG=Release
set REPO_DEL=False
set EDITION=xtne6f
set CLONE_DIR=
set OUT_DIR=EDCB\package
rem 引数の取得
for %%i in (%*) do (
if /i "%%i" == "help" goto Help
if /i "%%i" == "x86" set ARCH=x86
if /i "%%i" == "x64" set ARCH=x64
if /i "%%i" == "Both" set ARCH=Both
if /i "%%i" == "Build" set TARGET=Build
if /i "%%i" == "Rebuild" set TARGET=Rebuild
if /i "%%i" == "Clean" set TARGET=Clean
if /i "%%i" == "Debug" set CONFIG=Debug
if /i "%%i" == "Release" set CONFIG=Release
if /i "%%i" == "del" set REPO_DEL=True
)
if defined CLONE_DIR (
if not exist "%CLONE_DIR%" md "%CLONE_DIR%"
cd /d "%CLONE_DIR%"
)
if /i "%REPO_DEL%" == "True" (
if exist EDCB rd /s /q EDCB
if exist libaribb25 rd /s /q libaribb25
if exist lua rd /s /q lua
if exist lua-zlib rd /s /q lua-zlib
if exist b24tovtt rd /s /q b24tovtt
if exist psisiarc rd /s /q psisiarc
if exist psisimux rd /s /q psisimux
if exist tsmemseg rd /s /q tsmemseg
if exist tsreadex rd /s /q tsreadex
if exist Write_Multi rd /s /q Write_Multi
if exist EDCB_Material_WebUI rd /s /q EDCB_Material_WebUI
)
rem ソースのダウンロード
if not exist EDCB git clone https://github.com/%EDITION%/EDCB.git
if not exist libaribb25 git clone https://github.com/tkmsst/libaribb25.git
if not exist lua git clone https://github.com/xtne6f/lua.git
if not exist lua-zlib git clone https://github.com/xtne6f/lua-zlib.git
if not exist b24tovtt git clone https://github.com/xtne6f/b24tovtt.git
if not exist psisiarc git clone https://github.com/xtne6f/psisiarc.git
if not exist psisimux git clone https://github.com/xtne6f/psisimux.git
if not exist tsmemseg git clone -b master-with-d https://github.com/xtne6f/tsmemseg.git
if not exist tsreadex git clone https://github.com/xtne6f/tsreadex.git
if not exist Write_Multi git clone https://github.com/xtne6f/Write_Multi.git
if not exist EDCB_Material_WebUI git clone https://github.com/EMWUI/EDCB_Material_WebUI.git
rem バージョン情報にコミットハッシュを追加
setlocal
cd EDCB
if /i "%TARGET%" == "Clean" (
call versionhashclean.bat
) else (
call versionhashgen.bat
)
endlocal
rem Visual Studioのインストールフォルダの検索
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set VS_INSTALL_DIR=%%i
)
rem 開発者コマンドプロンプトの起動
call "%VS_INSTALL_DIR%\Common7\Tools\VsDevCmd.bat" -no_logo
if /i "%ARCH%" == "Both" (
call :Build x86
if errorlevel 1 exit /b 1
call :Build x64
if errorlevel 1 exit /b 1
) else (
call :Build %ARCH%
if errorlevel 1 exit /b 1
)
exit /b 0
:Build
set ARCH=%1
if /i "%ARCH%" == "x86" (
set PLATFORM=Win32
) else (
set PLATFORM=%ARCH%
)
set FRAMEWORK=v4.5
if "%VisualStudioVersion%" == "17.0" set FRAMEWORK=v4.8
set TOOLSET=v141
if "%VisualStudioVersion%" == "16.0" set TOOLSET=v142
if "%VisualStudioVersion%" == "17.0" set TOOLSET=v143
set WINDOWS_SDK=10.0
if "%VisualStudioVersion%" == "15.0" set WINDOWS_SDK=10.0.17763.0
rem ビルド
pushd EDCB\Document
MSBuild EDCB_ALL.VS2015.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%PLATFORM%;TargetFrameworkVersion=%FRAMEWORK%
popd
if errorlevel 1 exit /b 1
pushd libaribb25
MSBuild arib_std_b25.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%PLATFORM%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd lua
MSBuild lua52.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%
popd
if errorlevel 1 exit /b 1
pushd lua-zlib
MSBuild zlib52.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%
popd
if errorlevel 1 exit /b 1
pushd b24tovtt
MSBuild b24tovtt.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd psisiarc
MSBuild psisiarc.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd psisimux
MSBuild psisimux.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd tsmemseg
MSBuild tsmemseg.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd tsreadex
MSBuild tsreadex.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
pushd Write_Multi
MSBuild Write_Multi.sln /nologo /m /t:%TARGET% /p:Configuration=%CONFIG%;Platform=%ARCH%;PlatformToolset=%TOOLSET%;WindowsTargetPlatformVersion=%WINDOWS_SDK%
popd
if errorlevel 1 exit /b 1
if /i "%TARGET%" == "Clean" exit /b 0
set SRC_DIR=%ARCH%\%CONFIG%
if /i "%ARCH%" == "x86" (
set SRC_DIR2=%CONFIG%
) else (
set SRC_DIR2=%SRC_DIR%
)
set DST_DIR=%OUT_DIR%\%ARCH%\%CONFIG%
rem フォルダの準備
if exist "%DST_DIR%" rd /s /q "%DST_DIR%"
md "%DST_DIR%"
md "%DST_DIR%\BonDriver"
md "%DST_DIR%\EdcbPlugIn"
md "%DST_DIR%\HttpPublic"
md "%DST_DIR%\PostBatExamples"
md "%DST_DIR%\RecName"
md "%DST_DIR%\Setting"
md "%DST_DIR%\Tools"
md "%DST_DIR%\Write"
rem ファイルの配置
copy /v EDCB\%SRC_DIR%\*.dll "%DST_DIR%" >nul
copy /v EDCB\%SRC_DIR%\*.exe "%DST_DIR%" >nul
copy /v EDCB\%SRC_DIR%\EpgTimer.exe "%DST_DIR%\EpgTimerNW.exe" >nul
copy /v EDCB\%SRC_DIR%\EdcbPlugIn.tvtp "%DST_DIR%\EdcbPlugIn" >nul
copy /v EDCB\%SRC_DIR%\EpgTimerPlugIn.tvtp "%DST_DIR%" >nul
copy /v EDCB\%SRC_DIR%\RecName\RecName_Macro.dll "%DST_DIR%\RecName" >nul
copy /v EDCB\%SRC_DIR%\Tools\*.exe "%DST_DIR%\Tools" >nul
copy /v EDCB\%SRC_DIR%\Write\Write_Default.dll "%DST_DIR%\Write" >nul
copy /v EDCB\%SRC_DIR%\Write\Write_OneService.dll "%DST_DIR%\EdcbPlugIn" >nul
copy /v EDCB\Document\*.txt "%DST_DIR%" >nul
copy /v EDCB\EdcbPlugIn\EdcbPlugIn\ch2chset.vbs "%DST_DIR%\EdcbPlugIn" >nul
copy /v EDCB\EdcbPlugIn\EdcbPlugIn\EdcbPlugIn.ini "%DST_DIR%\EdcbPlugIn" >nul
copy /v EDCB\EdcbPlugIn\EdcbPlugIn\EdcbPlugIn_Readme.txt "%DST_DIR%\EdcbPlugIn" >nul
copy /v EDCB\ini "%DST_DIR%" >nul
xcopy /e /v EDCB\ini\HttpPublic "%DST_DIR%\HttpPublic" >nul
copy /v EDCB\ini\PostBatExamples "%DST_DIR%\PostBatExamples" >nul
copy /v EDCB\Tools\tsidmove_helper.bat "%DST_DIR%\Tools" >nul
copy /v libaribb25\%PLATFORM%\%CONFIG%\libaribb25.dll "%DST_DIR%\B25Decoder.dll" >nul
copy /v lua\%SRC_DIR2%\lua52.dll "%DST_DIR%" >nul
copy /v lua-zlib\%SRC_DIR2%\zlib52.dll "%DST_DIR%" >nul
copy /v b24tovtt\%SRC_DIR2%\b24tovtt.exe "%DST_DIR%\Tools" >nul
copy /v psisiarc\%SRC_DIR2%\psisiarc.exe "%DST_DIR%\Tools" >nul
copy /v psisimux\%SRC_DIR2%\psisimux.exe "%DST_DIR%\Tools" >nul
copy /v tsmemseg\%SRC_DIR2%\tsmemseg.exe "%DST_DIR%\Tools" >nul
copy /v tsreadex\%SRC_DIR2%\tsreadex.exe "%DST_DIR%\Tools" >nul
copy /v tsreadex\%SRC_DIR2%\tsreadex.exe "%DST_DIR%\Tools\edcbnosuspend.exe" >nul
copy /v Write_Multi\%SRC_DIR2%\Write_Multi.dll "%DST_DIR%\EdcbPlugIn" >nul
xcopy /e /v EDCB_Material_WebUI\HttpPublic "%DST_DIR%\HttpPublic" >nul
copy /v EDCB_Material_WebUI\Setting "%DST_DIR%\Setting" >nul
copy /v EDCB_Material_WebUI\README.md "%DST_DIR%\Readme_EMWUI.md" >nul
pushd EDCB
rem バージョン情報の取得
for /f "usebackq tokens=2*" %%i in (`findstr /r /c:"^#define EDCB_VERSION_TAG" Common\CommonResource.h`) do set VERSION=%%~j
rem コミットハッシュの取得
for /f "usebackq tokens=*" %%i in (`git rev-parse --short HEAD`) do set GIT_HASH=%%i
popd
set ARCHIVE_NAME=%OUT_DIR%\EDCB_%VERSION%_%GIT_HASH%_%ARCH%
rem 7-Zipのインストールフォルダの検索
for /f "usebackq tokens=1,2*" %%i in (`reg query HKLM\Software\7-Zip /v Path`) do if "%%i" == "Path" set PATH=%%k;%PATH%
if exist "%ARCHIVE_NAME%.7z" del "%ARCHIVE_NAME%.7z"
rem アーカイブの作成
7z a "%ARCHIVE_NAME%.7z" ".\%DST_DIR%\*" -mx=9 -ms=on -myx=9
exit /b
:Help
echo %~nx0 [x86^|x64^|Both] [Build^|Rebuild^|Clean] [Debug^|Release] [del]
exit /b
使い方
コマンドプロンプトでバッチファイルを実行するときに引数を指定します。
EDCB.bat [x86|x64|Both] [Build|Rebuild|Clean] [Debug|Release] [del]
上記はhelpを指定すると表示されます。
引数のデフォルト値は以下です。
EDCB.bat x86 Build Release
x86は32bit版、x64は64bit版、Bothは32bit版と64bit版の両方です。
delはソースを削除します。ダウンロードし直す場合に指定します。
xtne6f版をビルドしています。
tkntrec版をビルドする場合は「set EDITION=」に「tkntrec」と書きます。
バッチファイルと同じフォルダにある EDCB\package に出力されます。
ソースのダウンロード先を変更する場合は「set CLONE_DIR=」にフォルダパスを書きます。
アーカイブの出力先を変更する場合は「set OUT_DIR=」にフォルダパスを書きます。


コメント
250124までは出来てたのですが250321が最後まで実行出来なくなってしまいました
どこを修正すれば良いでしょうか?
ツール類のプロジェクトがEDCB_ALL.VS2015.slnに追加されたことが原因のようです。修正しました。
ありがとうございます
ビルド出来ました。