From eb95c6895a17758deb22732cf4e4f6f334b378ca Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 3 Nov 2016 08:32:15 +0100 Subject: [PATCH] Windows build environment: - Renamed folder build_libs to build-libs - Removed old file stripSVN.sh - Fixed some batch files - Switch from curl to wget - Added Qt environment - Added build.bat to build everything --- .../{build_libs => build-libs}/Makefile | 0 .../{build_libs => build-libs}/build-libs.bat | 4 +- .../{build_libs => build-libs}/clean.bat | 0 .../{build_libs => build-libs}/env.bat | 6 +- .../libxslt-1.1.28-fix.tar.gz | Bin build_scripts/Windows/build.bat | 31 +++ build_scripts/Windows/build/env.bat | 1 - build_scripts/Windows/build/pack.bat | 2 +- build_scripts/Windows/env/env-msys.bat | 3 +- build_scripts/Windows/env/env-qt.bat | 23 ++ build_scripts/Windows/env/env.bat | 6 +- .../Windows/env/tools/prepare-msys.bat | 33 ++- .../Windows/env/tools/prepare-qt.bat | 204 ++++++++++++++++++ .../Windows/env/tools/prepare-tools.bat | 80 ++++--- build_scripts/Windows/qt-cmd.bat | 27 +++ build_scripts/Windows/stripSVN.sh | 12 -- build_scripts/Windows/tools/cecho.bat | 6 + .../tools/download-file-wildcard.bat.bat | 46 ++++ build_scripts/Windows/tools/download-file.bat | 13 ++ 19 files changed, 430 insertions(+), 67 deletions(-) rename build_scripts/Windows/{build_libs => build-libs}/Makefile (100%) rename build_scripts/Windows/{build_libs => build-libs}/build-libs.bat (83%) rename build_scripts/Windows/{build_libs => build-libs}/clean.bat (100%) rename build_scripts/Windows/{build_libs => build-libs}/env.bat (50%) rename build_scripts/Windows/{build_libs => build-libs}/libxslt-1.1.28-fix.tar.gz (100%) create mode 100644 build_scripts/Windows/build.bat create mode 100644 build_scripts/Windows/env/env-qt.bat create mode 100644 build_scripts/Windows/env/tools/prepare-qt.bat create mode 100644 build_scripts/Windows/qt-cmd.bat delete mode 100755 build_scripts/Windows/stripSVN.sh create mode 100644 build_scripts/Windows/tools/cecho.bat create mode 100644 build_scripts/Windows/tools/download-file-wildcard.bat.bat create mode 100644 build_scripts/Windows/tools/download-file.bat diff --git a/build_scripts/Windows/build_libs/Makefile b/build_scripts/Windows/build-libs/Makefile similarity index 100% rename from build_scripts/Windows/build_libs/Makefile rename to build_scripts/Windows/build-libs/Makefile diff --git a/build_scripts/Windows/build_libs/build-libs.bat b/build_scripts/Windows/build-libs/build-libs.bat similarity index 83% rename from build_scripts/Windows/build_libs/build-libs.bat rename to build_scripts/Windows/build-libs/build-libs.bat index 197f0f97f..9dac5c8b5 100644 --- a/build_scripts/Windows/build_libs/build-libs.bat +++ b/build_scripts/Windows/build-libs/build-libs.bat @@ -25,13 +25,13 @@ if errorlevel 1 goto error_env :: Check MSYS environment set MSYSSH=%EnvMSYSPath%\msys\1.0\bin\sh.exe -if not exist "%MSYSSH%" echo Please install MSYS first.& exit /B 1 +if not exist "%MSYSSH%" %cecho% error "Please install MSYS first." & exit /B 1 :: Initialize environment call "%~dp0env.bat" if errorlevel 1 goto error_env -call "%ToolsPath%\msys-path.bat" "%CurPath%" MSYSCurPath +call "%ToolsPath%\msys-path.bat" "%~dp0" MSYSCurPath call "%ToolsPath%\msys-path.bat" "%BuildLibsPath%" MSYSBuildLibsPath if not exist "%BuildLibsPath%" mkdir "%BuildLibsPath%" diff --git a/build_scripts/Windows/build_libs/clean.bat b/build_scripts/Windows/build-libs/clean.bat similarity index 100% rename from build_scripts/Windows/build_libs/clean.bat rename to build_scripts/Windows/build-libs/clean.bat diff --git a/build_scripts/Windows/build_libs/env.bat b/build_scripts/Windows/build-libs/env.bat similarity index 50% rename from build_scripts/Windows/build_libs/env.bat rename to build_scripts/Windows/build-libs/env.bat index affde05f9..e340a6f88 100644 --- a/build_scripts/Windows/build_libs/env.bat +++ b/build_scripts/Windows/build-libs/env.bat @@ -1,13 +1,11 @@ -set CurPath=%~dp0 - :: Check MinGW environment set MinGWPath= call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe -if "%MinGWPath%"=="" echo Please run command in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable.& exit /B 1 +if "%MinGWPath%"=="" %cecho% error "Please run command in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable." & exit /B 1 :: Get gcc versions call "%ToolsPath%\get-gcc-version.bat" GCCVersion -if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1 +if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1 set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion% diff --git a/build_scripts/Windows/build_libs/libxslt-1.1.28-fix.tar.gz b/build_scripts/Windows/build-libs/libxslt-1.1.28-fix.tar.gz similarity index 100% rename from build_scripts/Windows/build_libs/libxslt-1.1.28-fix.tar.gz rename to build_scripts/Windows/build-libs/libxslt-1.1.28-fix.tar.gz diff --git a/build_scripts/Windows/build.bat b/build_scripts/Windows/build.bat new file mode 100644 index 000000000..48b6be7bb --- /dev/null +++ b/build_scripts/Windows/build.bat @@ -0,0 +1,31 @@ +@echo off + +setlocal + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env.bat" +if errorlevel 1 goto error_env + +%cecho% info "Build libraries" +call "%~dp0build-libs\build-libs.bat" auto-copy +if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL% + +%cecho% info "Build %SourceName%" +call "%~dp0build\build.bat" +if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL% + +%cecho% info "Pack %SourceName%" +call "%~dp0build\pack.bat" +if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL% + +%cecho% info "Build installer" +call "%~dp0build\build-installer.bat" +if errorlevel 1 %cecho% error "Failed to build installer." & exit /B %ERRORLEVEL% + +exit /B 0 + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows/build/env.bat b/build_scripts/Windows/build/env.bat index c4758f0d4..cf25d543b 100644 --- a/build_scripts/Windows/build/env.bat +++ b/build_scripts/Windows/build/env.bat @@ -1,4 +1,3 @@ -set CurPath=%~dp0 set BuildPath=%EnvRootPath%\builds set DeployPath=%EnvRootPath%\deploy diff --git a/build_scripts/Windows/build/pack.bat b/build_scripts/Windows/build/pack.bat index a8e7fdaff..3e8773614 100644 --- a/build_scripts/Windows/build/pack.bat +++ b/build_scripts/Windows/build/pack.bat @@ -169,7 +169,7 @@ if exist "%SourcePath%\libresapi\src\webui" ( rem pack files title Pack - %SourceName%-%RsBuildConfig% [pack files] -"%SevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*" +"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*" title %COMSPEC% diff --git a/build_scripts/Windows/env/env-msys.bat b/build_scripts/Windows/env/env-msys.bat index 9b1d98620..9b5421032 100644 --- a/build_scripts/Windows/env/env-msys.bat +++ b/build_scripts/Windows/env/env-msys.bat @@ -1,5 +1,5 @@ :: Usage: -:: call find-in-path.bat [reinstall|clean] +:: call env-msys.bat [reinstall|clean] :: Initialize environment call "%~dp0env.bat" @@ -12,5 +12,4 @@ exit /B %ERRORLEVEL% :error_env echo Failed to initialize environment. -endlocal exit /B 1 diff --git a/build_scripts/Windows/env/env-qt.bat b/build_scripts/Windows/env/env-qt.bat new file mode 100644 index 000000000..95b633705 --- /dev/null +++ b/build_scripts/Windows/env/env-qt.bat @@ -0,0 +1,23 @@ +:: Usage: +:: call env-qt4.bat version [reinstall|clean] + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env + +set EnvQtBasePath=%EnvRootPath%\qt + +:: Create folders +if not exist "%EnvQtBasePath%" mkdir "%EnvQtBasePath%" + +call "%~dp0tools\prepare-qt.bat" %1 %2 +if errorlevel 1 exit /B %ERRORLEVEL% + +if "%MinGWDir%" NEQ "" set PATH=%MinGWDir%\bin;%PATH% +if "%QtDir%" NEQ "" set PATH=%QtDir%\bin;%PATH% + +exit /B 0 + +:error_env +echo Failed to initialize environment. +exit /B 1 diff --git a/build_scripts/Windows/env/env.bat b/build_scripts/Windows/env/env.bat index d9052b5f3..a243256fc 100644 --- a/build_scripts/Windows/env/env.bat +++ b/build_scripts/Windows/env/env.bat @@ -7,13 +7,16 @@ set EnvToolsPath=%EnvRootPath%\tools set EnvTempPath=%EnvRootPath%\tmp set EnvDownloadPath=%EnvRootPath%\download -set EnvCurlExe=%EnvToolsPath%\curl.exe +::set EnvCurlExe=%EnvToolsPath%\curl.exe +set EnvWgetExe=%EnvToolsPath%\wget.exe set EnvSevenZipExe=%EnvToolsPath%\7z.exe set EnvJomExe=%EnvToolsPath%\jom.exe set EnvSedExe=%EnvToolsPath%\sed.exe set EnvCutExe=%EnvToolsPath%\cut.exe set EnvDependsExe=%EnvToolsPath%\depends.exe set EnvMakeNSISExe=%EnvToolsPath%\NSIS\makensis.exe +set EnvCEchoExe=%EnvToolsPath%\cecho.exe +set cecho=call "%ToolsPath%\cecho.bat" :: Create folders if not exist "%EnvRootPath%" mkdir "%EnvRootPath%" @@ -25,5 +28,4 @@ exit /B %ERRORLEVEL% :error_env echo Failed to initialize environment. -endlocal exit /B 1 diff --git a/build_scripts/Windows/env/tools/prepare-msys.bat b/build_scripts/Windows/env/tools/prepare-msys.bat index 4799715ca..af9b9bf78 100644 --- a/build_scripts/Windows/env/tools/prepare-msys.bat +++ b/build_scripts/Windows/env/tools/prepare-msys.bat @@ -9,7 +9,7 @@ if not exist "%EnvRootPath%"=="" exit /B 1 copy "%~dp0root\update-msys.bat" "%EnvRootPath%" >nul if "%~1"=="clean" ( - echo Clean MSYS + %cecho% info "Clean MSYS" call "%ToolsPath%\remove-dir.bat" "%EnvMSYSPath%" goto exit ) @@ -24,23 +24,25 @@ if exist "%EnvMSYSPath%\bin\mingw-get.exe" ( ) set MSYSInstall=mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip +set MSYSUrl=http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download set CMakeInstall=cmake-3.1.0-win32-x86.zip +set CMakeUrl=http://www.cmake.org/files/v3.1/%CMakeInstall% set CMakeUnpackPath=%EnvMSYSPath%\msys\1.0 -echo Remove previous MSYS version +%cecho% info "Remove previous MSYS version" call "%ToolsPath%\remove-dir.bat" "%EnvMSYSPath%" -echo Download installation files -if not exist "%EnvDownloadPath%\%MSYSInstall%" "%EnvCurlExe%" -L -k http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download -o "%EnvDownloadPath%\%MSYSInstall%" -if not exist "%EnvDownloadPath%%\MSYSInstall%" echo Cannot download MSYS& goto error +%cecho% info "Download installation files" +if not exist "%EnvDownloadPath%\%MSYSInstall%" call "%ToolsPath%\download-file.bat" "%MSYSUrl%" "%EnvDownloadPath%\%MSYSInstall%" +if not exist "%EnvDownloadPath%\%MSYSInstall%" %cecho% error "Cannot download MSYS" & goto error -if not exist "%EnvDownloadPath%\%CMakeInstall%" "%EnvCurlExe%" -L -k http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.zip -o "%EnvDownloadPath%\%CMakeInstall%" -if not exist "%EnvDownloadPath%\%CMakeInstall%" echo Cannot download CMake& goto error +if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\download-file.bat" "%CMakeUrl%" "%EnvDownloadPath%\%CMakeInstall%" +if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake" & goto error -echo Unpack MSYS +%cecho% info "Unpack MSYS" "%EnvSevenZipExe%" x -o"%EnvMSYSPath%" "%EnvDownloadPath%\%MSYSInstall%" -echo Install MSYS +%cecho% info "Install MSYS" if not exist "%EnvMSYSPath%\var\lib\mingw-get\data\profile.xml" copy "%EnvMSYSPath%\var\lib\mingw-get\data\defaults.xml" "%EnvMSYSPath%\var\lib\mingw-get\data\profile.xml" pushd "%EnvMSYSPath%\bin" mingw-get.exe install mingw32-mingw-get @@ -53,14 +55,14 @@ mingw-get.exe install msys-mktemp mingw-get.exe install msys-wget popd -echo Unpack CMake +%cecho% info "Unpack CMake" "%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -echo Install CMake +%cecho% info "Install CMake" set CMakeVersion= for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF -if "%CMakeVersion%"=="" echo CMake version not found.& goto :exit -echo Found CMake version %CMakeVersion% +if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit +%cecho% info "Found CMake version %CMakeVersion%" set FoundProfile= for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%EnvMSYSPath%\msys\1.0\etc\profile"') do set FoundProfile=%%F @@ -76,8 +78,3 @@ exit /B 0 :error endlocal exit /B 1 - -:error_vars -echo Failed to initialize variables. -endlocal -exit /B 1 diff --git a/build_scripts/Windows/env/tools/prepare-qt.bat b/build_scripts/Windows/env/tools/prepare-qt.bat new file mode 100644 index 000000000..31c938f77 --- /dev/null +++ b/build_scripts/Windows/env/tools/prepare-qt.bat @@ -0,0 +1,204 @@ +:: Usage: +:: call prepare-qt.bat version [reinstall|clean] + +setlocal enabledelayedexpansion + +if "%EnvQtBasePath%"=="" exit /B 1 +if not exist "%EnvRootPath%"=="" exit /B 1 + +set EnvQtVersion=%~1 +if "%EnvQtVersion%"=="" ( + %cecho% error "Please specify Qt version" + goto error +) + +for /f "tokens=1,2 delims=." %%A in ("%EnvQtVersion%") do set EnvQtMainVersion=%%A& set EnvQtBaseVersion=%%A.%%B +set EnvQtPath=%EnvQtBasePath%\%EnvQtVersion% + +if "%~2"=="clean" ( + %cecho% info "Clean Qt %EnvQtVersion%" + call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%" + goto exit +) + +set CheckQmakeExe= +if "%EnvQtMainVersion%"=="4" ( + set CheckQmakeExe=%EnvQtPath%\Qt\bin\qmake.exe +) else ( + if "%EnvQtMainVersion%" GEQ "5" ( + call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%" + if "!EnvQtMinGWVersion!" NEQ "" ( + set CheckQmakeExe=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion!\bin\qmake.exe + ) + ) +) + +if "%CheckQmakeExe%" NEQ "" ( + if exist "%CheckQmakeExe%" ( + if "%~2"=="reinstall" ( + choice /M "Found existing Qt %EnvQtVersion% version. Do you want to proceed?" + if !ERRORLEVEL!==2 goto exit + ) else ( + goto exit + ) + ) +) + +set QtInstall=qt-opensource-windows-x86-mingw-%EnvQtVersion%.exe +set QtInstallWildcard=qt-opensource-windows-x86-mingw*-%EnvQtVersion%.exe +set QtUrl=http://download.qt.io/official_releases/qt/%EnvQtBaseVersion%/%EnvQtVersion% + +%cecho% info "Remove previous Qt %EnvQtVersion% version" +call "%ToolsPath%\remove-dir.bat" "%EnvQtPath%" + +%cecho% info "Download Qt installation files" +if not exist "%EnvDownloadPath%\%QtInstall%" ( + call "%ToolsPath%\download-file-wildcard.bat" "%QtUrl%" "%QtInstallWildcard%" "%EnvDownloadPath%" QtInstallDownload + if "!QtInstallDownload!"=="" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error + ren "%EnvDownloadPath%\!QtInstallDownload!" "%QtInstall%" +) +if not exist "%EnvDownloadPath%\%QtInstall%" %cecho% error "Cannot download Qt %EnvQtVersion%" & goto error + +mkdir "%EnvQtPath%" + +if "%EnvQtMainVersion%"=="4" ( + rem Qt 4 + goto install_qt4 +) +if "%EnvQtMainVersion%" GEQ "5" ( + rem Qt >= 5 + goto install_qt5 +) + +%cecho% error "Unknown Qt version %EnvQtVersion%" + +:error +endlocal & set QtDir=& set MinGWDir= +exit /B 1 + +:exit +set QtDir= +set MinGWDir= + +if "%EnvQtMainVersion%"=="4" ( + rem Qt 4 + set QtDir=%EnvQtBasePath%\%EnvQtVersion%\Qt + set MinGWDir=%EnvQtBasePath%\%EnvQtVersion%\mingw32 +) else ( + if "%EnvQtMainVersion%" GEQ "5" ( + call :get_mingw_version EnvQtToolsMinGWVersion "%EnvQtPath%\Tools" + + set QtDir=%EnvQtPath%\%EnvQtBaseVersion%\!EnvQtMinGWVersion! + set MinGWDir=%EnvQtPath%\Tools\!EnvQtToolsMinGWVersion! + ) +) + +endlocal & set QtDir=%QtDir%& set MinGWDir=%MinGWDir% +exit /B 0 + +:get_mingw_version +setlocal enabledelayedexpansion +set Variable=%~1 +set Result= + +for /D %%A in (%~2\*) do set Name=%%~nA& if "!Name:~0,5!"=="mingw" set Result=!Name! +endlocal & set %Variable%=%Result% +goto :EOF + +:replace +set InFile=%~1 +set InFileName=%~nx1 +set OutFile=%~1.tmp +set SearchText=%~2 +set ReplaceText=%~3 + +if exist "%OutFile%" del /Q "%OutFile%" + +for /f "tokens=1* delims=]" %%A in ('find /n /v ""^<%InFile%') do ( + set string=%%B + + if "!string!"=="" ( + echo.>>%OutFile% + ) else ( + set modified=!string:%SearchText%=%ReplaceText%! + echo !modified!>> %OutFile% + ) +) +del "%InFile%" +rename "%OutFile%" "%InFileName%" +goto :EOF + +:install_qt4 +set MinGWInstall=i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z +set MinGWUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/4.8.2/threads-posix/dwarf/%MinGWInstall%/download + +%cecho% info "Download MinGW installation files" +if not exist "%EnvDownloadPath%\%MinGWInstall%" call "%ToolsPath%\download-file.bat" "%MinGWUrl%" "%EnvDownloadPath%\%MinGWInstall%" +if not exist "%EnvDownloadPath%\%MinGWInstall%" %cecho% error "Cannot download MinGW" & goto error + +%cecho% info "Unpack Qt %EnvQtVersion%" +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +mkdir "%EnvTempPath%" +"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstall%" $_14_ +move "%EnvTempPath%\$_14_" "%EnvQtPath%\Qt" +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + +%cecho% info "Unpack MinGW" +"%EnvSevenZipExe%" x -o"%EnvQtPath%" "%EnvDownloadPath%\%MinGWInstall%" + +echo Prepare Qt %EnvQtVersion% +echo [Paths]>"%EnvQtPath%\Qt\bin\qt.conf" +echo Prefix=..>>"%EnvQtPath%\Qt\bin\qt.conf" + +goto exit + +:install_qt5 +set EnvQtInstallerFrameworkVersion=2.0.3 + +set QtInstallerFrameworkInstall=QtInstallerFramework-%EnvQtInstallerFrameworkVersion%-win-x86.exe +set QtInstallerFrameworkUrl=http://download.qt.io/official_releases/qt-installer-framework/%EnvQtInstallerFrameworkVersion%/QtInstallerFramework-win-x86.exe + +%cecho% info "Download QtInstallerFramework installation files" +if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" call "%ToolsPath%\download-file.bat" "%QtInstallerFrameworkUrl%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" +if not exist "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" %cecho% error "Cannot download Qt Installer Framework %EnvQtInstallerFrameworkVersion%" & goto error + +%cecho% info "Unpack Qt Installer Framework" +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +mkdir "%EnvTempPath%" +"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%QtInstallerFrameworkInstall%" bin\devtool.exe +move "%EnvTempPath%\bin\devtool.exe" "%EnvQtPath%" +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + +%cecho% info "Unpack Qt %EnvQtVersion%" +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +mkdir "%EnvTempPath%" +"%EnvQtPath%\devtool.exe" "%EnvDownloadPath%\%QtInstall%" --dump "%EnvTempPath%" + +pushd "%EnvTempPath%" +del /S *vcredist*.7z +del /S *qtcreator*.7z +del /S *1installer-changelog.7z +for /R %%F in (*.7z) do "%EnvSevenZipExe%" x -y -o"%EnvQtPath%" "%%F" +popd + +call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" + +call :get_mingw_version EnvQtMinGWVersion "%EnvQtPath%\%EnvQtBaseVersion%" + +%cecho% info "Prepare Qt %EnvQtVersion%" +echo [Paths]>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf" +echo Documentation=../../Docs/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf" +echo Examples=../../Examples/Qt-%EnvQtBaseVersion%>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf" +echo Prefix=..>>"%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\bin\qt.conf" + +call :replace "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\mkspecs\qconfig.pri" "Enterprise" "OpenSource" + +for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.pc) do ( + call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%" + call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%" +) +for /R "%EnvQtPath%\%EnvQtBaseVersion%\%EnvQtMinGWVersion%\lib" %%A in (*.prl) do ( + call :replace "%%A" "c:/Users/qt/work/install" "%EnvQtPath:\=\\%\%EnvQtBaseVersion%\\%EnvQtMinGWVersion%" + call :replace "%%A" "c:\Users\qt\work\install" "%EnvQtPath:\=/%\%EnvQtBaseVersion%/%EnvQtMinGWVersion%" +) +goto exit diff --git a/build_scripts/Windows/env/tools/prepare-tools.bat b/build_scripts/Windows/env/tools/prepare-tools.bat index f453f35da..94ad1ae8b 100644 --- a/build_scripts/Windows/env/tools/prepare-tools.bat +++ b/build_scripts/Windows/env/tools/prepare-tools.bat @@ -2,10 +2,14 @@ setlocal if "%EnvRootPath%"=="" exit /B 1 +set CEchoUrl=https://github.com/lordmulder/cecho/releases/download/2015-10-10/cecho.2015-10-10.zip +set CEchoInstall=cecho.2015-10-10.zip set SevenZipUrl=http://7-zip.org/a/7z1602.msi set SevenZipInstall=7z1602.msi -set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z -set CurlInstall=curl-7.50.1-win32-mingw.7z +::set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z +::set CurlInstall=curl-7.50.1-win32-mingw.7z +set WgetUrl=https://eternallybored.org/misc/wget/current/wget.exe +set WgetInstall=wget.exe set JomUrl=http://download.qt.io/official_releases/jom/jom.zip set JomInstall=jom.zip set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip @@ -33,32 +37,58 @@ if not exist "%EnvToolsPath%\7z.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" ) -if not exist "%EnvToolsPath%\curl.exe" ( +if not exist "%EnvToolsPath%\cecho.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download Curl installation + echo Download cecho installation - if not exist "%EnvDownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%EnvDownloadPath%\%CurlInstall%" - if not exist "%EnvDownloadPath%\%CurlInstall%" echo Cannot download Curl installation& goto error + if not exist "%EnvDownloadPath%\%CEchoInstall%" call "%ToolsPath%\winhttpjs.bat" "%CEchoUrl%" -saveTo "%EnvDownloadPath%\%CEchoInstall%" + if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error - echo Unpack Curl - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CurlInstall%" - copy "%EnvTempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%EnvToolsPath%" + echo Unpack cecho + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" ) +::if not exist "%EnvToolsPath%\curl.exe" ( +:: call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +:: mkdir "%EnvTempPath%" +:: +:: echo Download Curl installation +:: +:: if not exist "%EnvDownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%EnvDownloadPath%\%CurlInstall%" +:: if not exist "%EnvDownloadPath%\%CurlInstall%" echo Cannot download Curl installation& goto error +:: +:: echo Unpack Curl +:: "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CurlInstall%" +:: copy "%EnvTempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%EnvToolsPath%" +:: +:: call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" +::) + +if not exist "%EnvToolsPath%\wget.exe" ( + %cecho% info "Download Wget installation" + + if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%" + if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error + + %cecho% info "Copy Wget" + copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%" +) + if not exist "%EnvToolsPath%\jom.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download jom installation + %cecho% info "Download jom installation" if not exist "%EnvDownloadPath%\%JomInstall%" call "%ToolsPath%\winhttpjs.bat" %JomUrl% -saveTo "%EnvDownloadPath%\%JomInstall%" - if not exist "%EnvDownloadPath%\%JomInstall%" echo Cannot download jom installation& goto error + if not exist "%EnvDownloadPath%\%JomInstall%" %cecho% error "Cannot download jom installation" & goto error - echo Unpack jom + %cecho% info "Unpack jom" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%JomInstall%" copy "%EnvTempPath%\jom.exe" "%EnvToolsPath%" @@ -69,12 +99,12 @@ if not exist "%EnvToolsPath%\depends.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download Dependency Walker installation + %cecho% info "Download Dependency Walker installation" if not exist "%EnvDownloadPath%\%DependsInstall%" call "%ToolsPath%\winhttpjs.bat" %DependsUrl% -saveTo "%EnvDownloadPath%\%DependsInstall%" - if not exist "%EnvDownloadPath%\%DependsInstall%" echo Cannot download Dependendy Walker installation& goto error + if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error - echo Unpack Dependency Walker + %cecho% info "Unpack Dependency Walker" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" copy "%EnvTempPath%\*" "%EnvToolsPath%" @@ -85,12 +115,12 @@ if not exist "%EnvToolsPath%\cut.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download Unix Tools installation + %cecho% info "Download Unix Tools installation" if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%" - if not exist "%EnvDownloadPath%\%UnixToolsInstall%" echo Cannot download unix Tools installation& goto error + if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error - echo Unpack Unix Tools + %cecho% info "Unpack Unix Tools" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%" @@ -101,12 +131,12 @@ if not exist "%EnvToolsPath%\sed.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download Unix Tools installation + %cecho% info "Download Unix Tools installation" if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%" - if not exist "%EnvDownloadPath%\%UnixToolsInstall%" echo Cannot download Unix Tools installation& goto error + if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error - echo Unpack Unix Tools + %cecho% info "Unpack Unix Tools" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%" @@ -117,12 +147,12 @@ if not exist "%EnvToolsPath%\NSIS\nsis.exe" ( call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" mkdir "%EnvTempPath%" - echo Download NSIS installation + %cecho% info "Download NSIS installation" - if not exist "%EnvDownloadPath%\%NSISInstall%" "%EnvCurlExe%" -L -k %NSISUrl% -o "%EnvDownloadPath%\%NSISInstall%" - if not exist "%EnvDownloadPath%\%NSISInstall%" echo Cannot download NSIS installation& goto error + if not exist "%EnvDownloadPath%\%NSISInstall%" call "%ToolsPath%\download-file.bat" "%NSISUrl%" "%EnvDownloadPath%\%NSISInstall%" + if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error - echo Unpack NSIS + %cecho% info "Unpack NSIS" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%" xcopy /s "%EnvTempPath%" "%NSISInstallPath%" diff --git a/build_scripts/Windows/qt-cmd.bat b/build_scripts/Windows/qt-cmd.bat new file mode 100644 index 000000000..1e4ad475e --- /dev/null +++ b/build_scripts/Windows/qt-cmd.bat @@ -0,0 +1,27 @@ +:: Usage: +:: call qt-cmd.bat [command] + +@echo off + +setlocal + +set QtVersion=%~1 + +:: Initialize environment +call "%~dp0env.bat" +if errorlevel 1 goto error_env +call "%EnvPath%\env-qt.bat" %QtVersion% +if errorlevel 1 goto error_env + +if "%~2"=="" ( + "%ComSpec%" +) else ( + "%ComSpec%" /c %2 %3 %4 %5 %6 %7 %8 %9 +) + +exit /B %ERRORLEVEL% + +:error_env +echo Failed to initialize environment. +endlocal +exit /B 1 diff --git a/build_scripts/Windows/stripSVN.sh b/build_scripts/Windows/stripSVN.sh deleted file mode 100755 index 65a740cab..000000000 --- a/build_scripts/Windows/stripSVN.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - - -if [ $# -le 0 ] -then - echo usage $0 directory - exit -fi - -echo find $1 -name .svn -rm -vrf `find $1 -name .svn` - diff --git a/build_scripts/Windows/tools/cecho.bat b/build_scripts/Windows/tools/cecho.bat new file mode 100644 index 000000000..69c6370e9 --- /dev/null +++ b/build_scripts/Windows/tools/cecho.bat @@ -0,0 +1,6 @@ +:: Usage: +:: call cecho.bat [info|error|std] "text" + +if "%~1"=="std" echo %~2 +if "%~1"=="info" "%EnvCEchoExe%" green "%~2" +if "%~1"=="error" "%EnvCEchoExe%" red "%~2" diff --git a/build_scripts/Windows/tools/download-file-wildcard.bat.bat b/build_scripts/Windows/tools/download-file-wildcard.bat.bat new file mode 100644 index 000000000..d37943063 --- /dev/null +++ b/build_scripts/Windows/tools/download-file-wildcard.bat.bat @@ -0,0 +1,46 @@ +:: Usage: +:: call download-file-wildcard.bat url file-wildcard download-path variable + +if "%~4"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +if "%EnvTempPath%"=="" ( + echo. + echo Environment error. + exit /B 1 +) + +setlocal + +set Url=%~1 +set FileWildcard=%~2 +set DownloadPath=%~3 +set Var=%~4 +set File= + +call "%~dp0remove-dir.bat" "%EnvTempPath%" +mkdir "%EnvTempPath%" + +"%EnvWgetExe%" --recursive --continue --no-directories --no-parent -A "%FileWildcard%" --directory-prefix="%EnvTempPath%" "%Url%" + +if errorlevel 1 ( + call "%~dp0remove-dir.bat" "%EnvTempPath%" + endlocal & set %Var%= + exit /B %ERRORLEVEL% +) + +for %%A in (%EnvTempPath%\%FileWildcard%) do set File=%%~nxA +if "%File%"=="" ( + call "%~dp0remove-dir.bat" "%EnvTempPath%" + endlocal & set %Var%= + exit /B %ERRORLEVEL% +) + +move "%EnvTempPath%\%File%" "%DownloadPath%" +call "%~dp0remove-dir.bat" "%EnvTempPath%" + +endlocal & set %Var%=%File% +exit /B 0 diff --git a/build_scripts/Windows/tools/download-file.bat b/build_scripts/Windows/tools/download-file.bat new file mode 100644 index 000000000..d42349ccb --- /dev/null +++ b/build_scripts/Windows/tools/download-file.bat @@ -0,0 +1,13 @@ +:: Usage: +:: call download-file.bat url file + +if "%~2"=="" ( + echo. + echo Parameter error. + exit /B 1 +) + +::"%EnvCurlExe%" -L -k "%~1" -o "%~2" +"%EnvWgetExe%" --continue "%~1" --output-document="%~2" + +exit /B %ERRORLEVEL%