MediaInfoXP/z_build.bat

154 lines
6.7 KiB
Batchfile
Raw Permalink Normal View History

2013-05-21 22:53:19 +02:00
@echo off
REM ///////////////////////////////////////////////////////////////////////////
REM // Set Paths
REM ///////////////////////////////////////////////////////////////////////////
2017-10-29 12:00:03 +01:00
set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
2013-05-21 22:53:19 +02:00
REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
REM ###############################################
REM ///////////////////////////////////////////////////////////////////////////
REM // Setup environment
REM ///////////////////////////////////////////////////////////////////////////
if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
call "%MSVC_PATH%\vcvarsall.bat" x86
REM ///////////////////////////////////////////////////////////////////////////
REM // Check environment
REM ///////////////////////////////////////////////////////////////////////////
if "%VCINSTALLDIR%"=="" (
echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
goto BuildError
)
if "%QTDIR%"=="" (
echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
goto BuildError
)
2017-10-29 12:00:03 +01:00
if not exist "%VCToolsInstallDir%\bin\HostX86\x86\cl.exe" (
2013-05-21 22:53:19 +02:00
echo C++ compiler not found. Please check your MSVC_PATH var!
goto BuildError
)
if not exist "%QTDIR%\bin\moc.exe" (
echo Qt meta compiler not found. Please check your QTDIR var!
goto BuildError
)
if not exist "%QTDIR%\include\QtCore\qglobal.h" (
echo %%QTDIR%% header files not found. Please check your QTDIR var!
2013-05-21 22:53:19 +02:00
goto BuildError
)
REM ///////////////////////////////////////////////////////////////////////////
REM // Get current date and time (in ISO format)
REM ///////////////////////////////////////////////////////////////////////////
set "ISO_DATE="
set "ISO_TIME="
2020-04-05 15:13:40 +02:00
if not exist "%~dp0\..\Prerequisites\MSYS\1.0\bin\date.exe" BuildError
for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Prerequisites\MSYS\1.0\bin\date.exe" +ISODATE:%%Y-%%m-%%d') do (
2013-05-21 22:53:19 +02:00
if "%%a"=="ISODATE" set "ISO_DATE=%%b"
)
2020-04-05 15:13:40 +02:00
for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\..\Prerequisites\MSYS\1.0\bin\date.exe" +ISOTIME:%%T') do (
2013-05-21 22:53:19 +02:00
if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
)
if "%ISO_DATE%"=="" goto BuildError
if "%ISO_TIME%"=="" goto BuildError
REM ///////////////////////////////////////////////////////////////////////////
REM // Build the binaries
REM ///////////////////////////////////////////////////////////////////////////
echo ---------------------------------------------------------------------
echo BEGIN BUILD
echo ---------------------------------------------------------------------
2017-10-29 12:00:03 +01:00
MSBuild.exe /property:Configuration=release_static /property:Platform=Win32 /target:clean "%~dp0\MediaInfoXP.sln"
2013-05-21 22:53:19 +02:00
if not "%ERRORLEVEL%"=="0" goto BuildError
2017-10-29 12:00:03 +01:00
MSBuild.exe /property:Configuration=release_static /property:Platform=Win32 /target:rebuild "%~dp0\MediaInfoXP.sln"
2013-05-21 22:53:19 +02:00
if not "%ERRORLEVEL%"=="0" goto BuildError
2017-10-29 12:00:03 +01:00
MSBuild.exe /property:Configuration=release_static /property:Platform=Win32 /target:build "%~dp0\MediaInfoXP.sln"
2013-05-21 22:53:19 +02:00
if not "%ERRORLEVEL%"=="0" goto BuildError
REM ///////////////////////////////////////////////////////////////////////////
REM // Copy base files
REM ///////////////////////////////////////////////////////////////////////////
echo ---------------------------------------------------------------------
echo BEGIN PACKAGING
echo ---------------------------------------------------------------------
set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
mkdir "%PACK_PATH%"
2015-05-02 21:58:53 +02:00
copy "%~dp0\bin\Win32\Release_Static\*.exe" "%PACK_PATH%"
2013-05-21 22:53:19 +02:00
copy "%~dp0\Copying.txt" "%PACK_PATH%"
2016-05-21 17:31:36 +02:00
copy "%~dp0\doc\*.txt" "%PACK_PATH%"
copy "%~dp0\doc\*.html" "%PACK_PATH%"
copy "%~dp0\doc\*.svg" "%PACK_PATH%"
2013-05-21 22:53:19 +02:00
REM ///////////////////////////////////////////////////////////////////////////
REM // Compress
REM ///////////////////////////////////////////////////////////////////////////
2020-04-04 15:49:22 +02:00
::"%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\*.exe"
2013-05-21 22:53:19 +02:00
REM ///////////////////////////////////////////////////////////////////////////
REM // Attributes
REM ///////////////////////////////////////////////////////////////////////////
attrib +R "%PACK_PATH%\*.exe"
attrib +R "%PACK_PATH%\*.html"
attrib +R "%PACK_PATH%\*.txt"
2016-05-21 17:31:36 +02:00
attrib +R "%PACK_PATH%\*.svg"
2013-05-21 22:53:19 +02:00
REM ///////////////////////////////////////////////////////////////////////////
2013-05-21 23:06:39 +02:00
REM // Generate outfile name
2013-05-21 22:53:19 +02:00
REM ///////////////////////////////////////////////////////////////////////////
2013-05-21 23:06:39 +02:00
set "OUT_NAME=MediaInfo-GUI.%ISO_DATE%"
:CheckOutName
if exist "%~dp0\out\%OUT_NAME%.zip" (
2013-05-21 23:09:02 +02:00
set "OUT_NAME=%OUT_NAME%.new"
2013-05-21 23:06:39 +02:00
goto CheckOutName
)
2014-01-11 21:41:24 +01:00
REM ///////////////////////////////////////////////////////////////////////////
REM // Create version tag
REM ///////////////////////////////////////////////////////////////////////////
2014-01-11 21:47:07 +01:00
echo MediaInfoXP - Simple GUI for MediaInfo > "%~dp0\out\%OUT_NAME%.txt"
echo Built %ISO_DATE%, %TIME% >> "%~dp0\out\%OUT_NAME%.txt"
2024-08-17 17:41:23 +02:00
echo Copyright (C) 2004-2024 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%~dp0\out\%OUT_NAME%.txt"
2014-01-11 21:47:07 +01:00
echo. >> "%~dp0\out\%OUT_NAME%.txt"
2014-04-09 15:16:10 +02:00
echo This program is free software; you can redistribute it and/or modify >> "%~dp0\out\%OUT_NAME%.txt"
echo it under the terms of the GNU General Public License as published by >> "%~dp0\out\%OUT_NAME%.txt"
echo the Free Software Foundation; either version 2 of the License, or >> "%~dp0\out\%OUT_NAME%.txt"
echo (at your option) any later version. >> "%~dp0\out\%OUT_NAME%.txt"
echo. >> "%~dp0\out\%OUT_NAME%.txt"
echo ------------------------------------------------------------------->> "%~dp0\out\%OUT_NAME%.txt"
echo. >> "%~dp0\out\%OUT_NAME%.txt"
2024-08-17 17:41:23 +02:00
echo MediaInfo(Lib) is Copyright (C) 2002-2024 MediaArea.net SARL. >> "%~dp0\out\%OUT_NAME%.txt"
2014-01-11 21:47:07 +01:00
echo. >> "%~dp0\out\%OUT_NAME%.txt"
2014-04-09 15:16:10 +02:00
echo Redistribution and use in source and binary forms, with or without >> "%~dp0\out\%OUT_NAME%.txt"
echo modification, are permitted according to the BSD-2-Clause license. >> "%~dp0\out\%OUT_NAME%.txt"
echo. >> "%~dp0\out\%OUT_NAME%.txt"
2014-01-11 21:41:24 +01:00
2013-05-21 23:06:39 +02:00
REM ///////////////////////////////////////////////////////////////////////////
REM // Build the package
REM ///////////////////////////////////////////////////////////////////////////
2014-01-11 21:41:24 +01:00
pushd "%PACK_PATH%
2020-04-05 15:13:40 +02:00
"%~dp0\..\Prerequisites\InfoZip\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%~dp0\out\%OUT_NAME%.txt"
2014-01-11 21:41:24 +01:00
popd
2013-05-21 22:53:19 +02:00
rmdir /Q /S "%PACK_PATH%"
2013-05-21 23:06:39 +02:00
attrib +R "%~dp0\out\%OUT_NAME%.zip"
2014-01-11 21:47:07 +01:00
del "%~dp0\out\%OUT_NAME%.txt"
2013-05-21 22:53:19 +02:00
REM ///////////////////////////////////////////////////////////////////////////
REM // COMPLETE
REM ///////////////////////////////////////////////////////////////////////////
echo.
echo Build completed.
echo.
pause
goto:eof
REM ///////////////////////////////////////////////////////////////////////////
REM // FAILED
REM ///////////////////////////////////////////////////////////////////////////
:BuildError
echo.
echo Build has failed !!!
echo.
pause