2010-11-20 21:16:03 +01:00
|
|
|
@ECHO OFF
|
|
|
|
SETLOCAL
|
2011-10-06 11:29:10 +02:00
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
CD /D %~dp0
|
2010-11-29 17:27:13 +01:00
|
|
|
|
2011-04-20 12:08:46 +02:00
|
|
|
rem Check for the help switches
|
2011-10-27 14:49:38 +02:00
|
|
|
IF /I "%~1" == "help" GOTO SHOWHELP
|
|
|
|
IF /I "%~1" == "/help" GOTO SHOWHELP
|
|
|
|
IF /I "%~1" == "-help" GOTO SHOWHELP
|
|
|
|
IF /I "%~1" == "--help" GOTO SHOWHELP
|
|
|
|
IF /I "%~1" == "/?" GOTO SHOWHELP
|
2011-04-20 12:08:46 +02:00
|
|
|
|
2014-03-23 09:48:21 +01:00
|
|
|
IF NOT DEFINED VS120COMNTOOLS (
|
|
|
|
ECHO Visual Studio 2013 wasn't found
|
2011-02-03 11:43:13 +01:00
|
|
|
GOTO EndWithError
|
2010-11-20 21:16:03 +01:00
|
|
|
)
|
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
IF "%~1" == "" (
|
|
|
|
SET "BUILDTYPE=Build"
|
|
|
|
) ELSE (
|
2011-03-14 13:01:38 +01:00
|
|
|
IF /I "%~1" == "Build" SET "BUILDTYPE=Build" & GOTO START
|
|
|
|
IF /I "%~1" == "/Build" SET "BUILDTYPE=Build" & GOTO START
|
|
|
|
IF /I "%~1" == "-Build" SET "BUILDTYPE=Build" & GOTO START
|
|
|
|
IF /I "%~1" == "--Build" SET "BUILDTYPE=Build" & GOTO START
|
|
|
|
IF /I "%~1" == "Clean" SET "BUILDTYPE=Clean" & GOTO START
|
|
|
|
IF /I "%~1" == "/Clean" SET "BUILDTYPE=Clean" & GOTO START
|
|
|
|
IF /I "%~1" == "-Clean" SET "BUILDTYPE=Clean" & GOTO START
|
|
|
|
IF /I "%~1" == "--Clean" SET "BUILDTYPE=Clean" & GOTO START
|
|
|
|
IF /I "%~1" == "Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
|
|
|
IF /I "%~1" == "/Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
|
|
|
IF /I "%~1" == "-Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
2011-02-03 11:43:13 +01:00
|
|
|
IF /I "%~1" == "--Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
|
|
|
|
|
|
|
ECHO. & ECHO Unsupported commandline switch!
|
|
|
|
GOTO EndWithError
|
|
|
|
)
|
2010-11-20 21:16:03 +01:00
|
|
|
|
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
:START
|
2010-11-20 21:16:03 +01:00
|
|
|
PUSHD "src"
|
|
|
|
|
2014-06-21 18:25:19 +02:00
|
|
|
CALL "%VS120COMNTOOLS%vsvars32.bat" x86
|
|
|
|
TITLE %BUILDTYPE%ing SubtitleEdit - Release^|Any CPU...
|
2011-02-03 11:43:13 +01:00
|
|
|
|
2014-06-21 18:25:19 +02:00
|
|
|
"MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="Any CPU"^
|
2013-07-11 11:10:57 +02:00
|
|
|
/maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal
|
2011-02-03 11:43:13 +01:00
|
|
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
|
|
|
|
2015-08-26 22:42:40 +02:00
|
|
|
ECHO.
|
|
|
|
ECHO ILRepack...
|
2015-08-29 09:10:41 +02:00
|
|
|
"packages\ILRepack.2.0.5\tools\ILRepack.exe" /out:"bin\Release\SubtitleEdit.exe" "bin\Release\SubtitleEdit.exe" "bin\Release\libse.dll" "packages\NHunspell.1.2.5554.16953\lib\net\NHunspell.dll" "packages\zlib.net.1.0.4.0\lib\zlib.net.dll" "DLLs\Interop.QuartzTypeLib.dll" /targetplatform:v4 /internalize /parallel
|
2015-08-26 22:42:40 +02:00
|
|
|
ECHO.
|
2010-11-20 21:16:03 +01:00
|
|
|
ECHO.
|
|
|
|
POPD
|
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
IF /I "%BUILDTYPE%" == "Clean" GOTO END
|
|
|
|
|
2014-05-06 16:40:33 +02:00
|
|
|
CALL :SubDetectSevenzipPath
|
2014-09-23 18:44:07 +02:00
|
|
|
IF DEFINED SEVENZIP IF EXIST "%SEVENZIP%" (
|
2014-08-10 08:53:38 +02:00
|
|
|
CALL :SubGetVersion
|
2014-06-21 18:25:19 +02:00
|
|
|
CALL :SubZipFile
|
2014-05-06 16:40:33 +02:00
|
|
|
)
|
2011-06-10 11:40:58 +02:00
|
|
|
|
2011-04-05 15:44:49 +02:00
|
|
|
CALL :SubDetectInnoSetup
|
2010-11-29 17:27:13 +01:00
|
|
|
IF DEFINED InnoSetupPath (
|
2011-04-20 12:08:46 +02:00
|
|
|
TITLE Compiling installer...
|
2014-05-06 16:40:33 +02:00
|
|
|
"%InnoSetupPath%" /O"." /Q "installer\Subtitle_Edit_installer.iss"
|
2011-02-03 11:43:13 +01:00
|
|
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
|
|
|
|
|
|
|
ECHO. & ECHO Installer compiled successfully!
|
2010-11-29 17:27:13 +01:00
|
|
|
) ELSE (
|
2011-02-03 11:43:13 +01:00
|
|
|
ECHO Inno Setup wasn't found; the installer wasn't built
|
2010-11-29 17:27:13 +01:00
|
|
|
)
|
2010-11-20 21:16:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
:END
|
2011-06-10 11:40:58 +02:00
|
|
|
TITLE Compiling Subtitle Edit finished!
|
2010-11-20 21:16:03 +01:00
|
|
|
ECHO.
|
2011-02-03 11:43:13 +01:00
|
|
|
ENDLOCAL
|
|
|
|
PAUSE
|
2010-11-20 21:16:03 +01:00
|
|
|
EXIT /B
|
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
|
2011-06-10 11:40:58 +02:00
|
|
|
:SubZipFile
|
2014-06-21 18:25:19 +02:00
|
|
|
TITLE Creating the ZIP file...
|
2014-11-18 09:15:35 +01:00
|
|
|
ECHO. & ECHO Creating the ZIP file...
|
2014-06-21 18:25:19 +02:00
|
|
|
PUSHD "src\bin\Release"
|
2011-11-06 22:49:02 +01:00
|
|
|
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
|
|
|
IF NOT EXIST "temp_zip" MD "temp_zip"
|
|
|
|
IF NOT EXIST "temp_zip\Languages" MD "temp_zip\Languages"
|
|
|
|
IF NOT EXIST "temp_zip\Tesseract" MD "temp_zip\Tesseract"
|
|
|
|
IF NOT EXIST "temp_zip\Tesseract\tessdata" MD "temp_zip\Tesseract\tessdata"
|
|
|
|
IF NOT EXIST "temp_zip\Tesseract\tessdata\configs" MD "temp_zip\Tesseract\tessdata\configs"
|
2011-06-10 11:40:58 +02:00
|
|
|
|
2014-06-21 18:25:19 +02:00
|
|
|
COPY /Y /V "..\..\..\gpl.txt" "temp_zip\"
|
2014-06-30 10:23:40 +02:00
|
|
|
COPY /Y /V "..\..\..\Changelog.txt" "temp_zip\"
|
2014-06-21 18:25:19 +02:00
|
|
|
COPY /Y /V "Hunspellx86.dll" "temp_zip\"
|
|
|
|
COPY /Y /V "Hunspellx64.dll" "temp_zip\"
|
|
|
|
COPY /Y /V "SubtitleEdit.exe" "temp_zip\"
|
|
|
|
COPY /Y /V "Languages\*.xml" "temp_zip\Languages\"
|
|
|
|
COPY /Y /V "..\..\..\Tesseract\msvcp90.dll" "temp_zip\Tesseract\"
|
|
|
|
COPY /Y /V "..\..\..\Tesseract\msvcr90.dll" "temp_zip\Tesseract\"
|
|
|
|
COPY /Y /V "..\..\..\Tesseract\tesseract.exe" "temp_zip\Tesseract\"
|
|
|
|
COPY /Y /V "..\..\..\Tesseract\tessdata\configs\hocr" "temp_zip\Tesseract\tessdata\configs\"
|
2015-03-30 22:31:07 +02:00
|
|
|
COPY /Y /V "..\..\..\Tesseract\tessdata\*.traineddata" "temp_zip\Tesseract\tessdata\"
|
2011-06-10 11:40:58 +02:00
|
|
|
|
|
|
|
PUSHD "temp_zip"
|
2014-09-23 18:44:07 +02:00
|
|
|
START "" /B /WAIT "%SEVENZIP%" a -tzip -mx=9 "SE%VERSION%.zip" * >NUL
|
2011-06-10 11:40:58 +02:00
|
|
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
|
|
|
|
|
|
|
|
2014-11-18 09:15:35 +01:00
|
|
|
ECHO. & ECHO ZIP file created successfully!
|
2014-06-21 18:25:19 +02:00
|
|
|
MOVE /Y "SE%VERSION%.zip" "..\..\..\.." >NUL
|
2011-06-10 11:40:58 +02:00
|
|
|
POPD
|
|
|
|
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
|
|
|
POPD
|
2014-05-06 16:40:33 +02:00
|
|
|
|
2011-06-10 11:40:58 +02:00
|
|
|
EXIT /B
|
|
|
|
|
|
|
|
|
2010-11-20 21:16:03 +01:00
|
|
|
:EndWithError
|
|
|
|
Title Compiling Subtitle Edit [ERROR]
|
2011-02-03 11:43:13 +01:00
|
|
|
ECHO. & ECHO.
|
|
|
|
ECHO **ERROR: Build failed and aborted!**
|
2010-11-20 21:16:03 +01:00
|
|
|
PAUSE
|
|
|
|
ENDLOCAL
|
|
|
|
EXIT
|
|
|
|
|
2011-02-03 11:43:13 +01:00
|
|
|
|
2011-04-20 12:08:46 +02:00
|
|
|
:SHOWHELP
|
2012-01-07 23:18:43 +01:00
|
|
|
TITLE %~nx0 %1
|
2011-04-20 12:08:46 +02:00
|
|
|
ECHO. & ECHO.
|
|
|
|
ECHO Usage: %~nx0 [Clean^|Build^|Rebuild]
|
|
|
|
ECHO.
|
|
|
|
ECHO Notes: You can also prefix the commands with "-", "--" or "/".
|
2011-06-05 20:36:04 +02:00
|
|
|
ECHO The arguments are not case sensitive.
|
2011-04-20 12:08:46 +02:00
|
|
|
ECHO. & ECHO.
|
2012-01-07 23:18:43 +01:00
|
|
|
ECHO Executing %~nx0 without any arguments is equivalent to "%~nx0 build"
|
2011-04-20 12:08:46 +02:00
|
|
|
ECHO.
|
|
|
|
ENDLOCAL
|
|
|
|
EXIT /B
|
|
|
|
|
|
|
|
|
2014-08-10 08:53:38 +02:00
|
|
|
:SubGetVersion
|
|
|
|
FOR /F delims^=^"^ tokens^=2 %%A IN ('FINDSTR /R /C:"AssemblyVersion" "src\Properties\AssemblyInfo.cs.template"') DO (
|
|
|
|
rem 3.4.1.[REVNO]
|
|
|
|
SET "VERSION=%%A"
|
|
|
|
)
|
|
|
|
rem 3.4.1: 0 from the left and -8 chars from the right
|
|
|
|
SET "VERSION=%VERSION:~0,-8%"
|
|
|
|
EXIT /B
|
|
|
|
|
|
|
|
|
2014-05-06 16:40:33 +02:00
|
|
|
:SubDetectSevenzipPath
|
|
|
|
FOR %%G IN (7z.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:G")
|
|
|
|
IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B)
|
|
|
|
|
|
|
|
FOR %%G IN (7za.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:G")
|
|
|
|
IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B)
|
2011-02-03 11:43:13 +01:00
|
|
|
|
2014-05-06 16:40:33 +02:00
|
|
|
FOR /F "tokens=2*" %%A IN (
|
|
|
|
'REG QUERY "HKLM\SOFTWARE\7-Zip" /v "Path" 2^>NUL ^| FIND "REG_SZ" ^|^|
|
|
|
|
REG QUERY "HKLM\SOFTWARE\Wow6432Node\7-Zip" /v "Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "SEVENZIP=%%B\7z.exe"
|
2011-02-03 11:43:13 +01:00
|
|
|
EXIT /B
|
|
|
|
|
|
|
|
|
2014-05-06 16:40:33 +02:00
|
|
|
:SubDetectInnoSetup
|
|
|
|
FOR /F "tokens=5*" %%A IN (
|
|
|
|
'REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ" ^|^|
|
|
|
|
REG QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "InnoSetupPath=%%B\ISCC.exe"
|
2011-02-03 11:43:13 +01:00
|
|
|
EXIT /B
|