LameXP/etc/Deployment/_paths.bat

117 lines
3.3 KiB
Batchfile
Raw Normal View History

2010-11-06 23:04:47 +01:00
@echo off
2014-12-22 14:44:09 +01:00
:: ------------------------------------------
:: Paths already initialized?
:: ------------------------------------------
if "%_LAMEXP_PATHS_INITIALIZED_%"=="%DATE%" (
goto:eof
)
:: ------------------------------------------
:: Clear Paths
:: ------------------------------------------
set "PATH_UPXBIN="
set "PATH_MKNSIS="
2013-10-18 20:44:55 +02:00
set "PATH_MSCDIR="
set "PATH_QTMSVC="
set "PATH_GNUPG1="
set "PATH_PANDOC="
set "PATH_VCPROJ="
2014-12-22 14:44:09 +01:00
:: ------------------------------------------
:: Setup BUILDENV_TXT
:: ------------------------------------------
2011-04-19 16:21:19 +02:00
set "BUILDENV_TXT=%~dp0\buildenv.txt"
if not "%~1"=="" (
set "BUILDENV_TXT=%~1"
)
2014-12-22 14:44:09 +01:00
if not exist "%BUILDENV_TXT%" (
echo.
echo Could not find 'buildenv.txt' in current directory^!
echo Please create your 'buildenv.txt' file from 'buildenv.template.txt' first.
echo.
pause
exit
)
2014-12-22 14:44:09 +01:00
:: ------------------------------------------
:: Parse paths from BUILDENV_TXT
:: ------------------------------------------
for /f "tokens=2,*" %%s in (%BUILDENV_TXT%) do (
if "%%s"=="PATH_UPXBIN" set "PATH_UPXBIN=%%~t"
if "%%s"=="PATH_MKNSIS" set "PATH_MKNSIS=%%~t"
2013-10-18 20:44:55 +02:00
if "%%s"=="PATH_MSCDIR" set "PATH_MSCDIR=%%~t"
if "%%s"=="PATH_QTMSVC" set "PATH_QTMSVC=%%~t"
if "%%s"=="PATH_GNUPG1" set "PATH_GNUPG1=%%~t"
if "%%s"=="PATH_PANDOC" set "PATH_PANDOC=%%~t"
if "%%s"=="PATH_VCPROJ" set "PATH_VCPROJ=%%~t"
)
2014-12-22 14:44:09 +01:00
set "BUILDENV_TXT="
2014-12-22 14:44:09 +01:00
:: ------------------------------------------
:: Print all paths
:: ------------------------------------------
echo.
echo ======= BEGIN PATHS =======
2011-04-22 22:10:55 +02:00
echo PATH_UPXBIN = "%PATH_UPXBIN%"
echo PATH_MKNSIS = "%PATH_MKNSIS%"
2013-10-18 20:44:55 +02:00
echo PATH_MSCDIR = "%PATH_MSCDIR%"
2011-04-22 22:10:55 +02:00
echo PATH_QTMSVC = "%PATH_QTMSVC%"
echo PATH_GNUPG1 = "%PATH_GNUPG1%"
echo PATH_PANDOC = "%PATH_PANDOC%"
2011-04-22 22:10:55 +02:00
echo PATH_VCPROJ = "%PATH_VCPROJ%"
2014-12-22 14:44:09 +01:00
echo ======== END PATHS ========
echo.
:: ------------------------------------------
:: Validate Paths
:: ------------------------------------------
call:validate_path PATH_UPXBIN "%PATH_UPXBIN%\upx.exe"
call:validate_path PATH_MKNSIS "%PATH_MKNSIS%\makensis.exe"
call:validate_path PATH_MSCDIR "%PATH_MSCDIR%\VC\vcvarsall.bat"
call:validate_path PATH_MSCDIR "%PATH_MSCDIR%\VC\bin\cl.exe"
call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\uic.exe"
call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\moc.exe"
call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\rcc.exe"
call:validate_path PATH_GNUPG1 "%PATH_GNUPG1%\gpg.exe"
call:validate_path PATH_PANDOC "%PATH_PANDOC%\pandoc.exe"
call:validate_path PATH_VCPROJ "%~dp0\..\..\%PATH_VCPROJ%"
:: ------------------------------------------
:: Locate Qt Path
:: ------------------------------------------
if exist "%PATH_QTMSVC%\bin\qtvars.bat" goto:exit_success
if exist "%PATH_QTMSVC%\bin\qtenv2.bat" goto:exit_success
echo. && echo Could not find "qtvars.bat" or "qtenv2.bat" in your Qt path.
echo. && echo Please check your PATH_QTMSVC and try again!
echo. && pause && exit
:: ------------------------------------------
:: Validate Path
:: ------------------------------------------
:validate_path
if not exist "%~2" (
echo. && echo Path could not be found: && echo "%~2"
echo. && echo Please check your %1 and try again!
echo. && pause && exit
)
goto:eof
:: ------------------------------------------
:: Completed
:: ------------------------------------------
:exit_success
set "_LAMEXP_PATHS_INITIALIZED_=%DATE%"