diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-11-18 16:24:31 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-12-23 13:45:59 +0000 |
commit | 8f49da6c18a2a86576f06deb9a6ff1deef748837 (patch) | |
tree | c309a10c8c5056c02062480b8f5ad2fb989b4f60 | |
parent | 9b68bc4147e1a8e61cbe0b5e318001fd6b76c7be (diff) | |
download | qtbase-8f49da6c18a2a86576f06deb9a6ff1deef748837.tar.gz |
... and so configureapp.exe disappeareth
Change-Id: I3fd9f2b0d4cf05a625484fce21532da8563cd62c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | configure.bat | 249 | ||||
-rw-r--r-- | src/corelib/global/qconfig-bootstrapped.h | 7 | ||||
-rw-r--r-- | tools/configure/Makefile.mingw | 125 | ||||
-rw-r--r-- | tools/configure/Makefile.win32 | 174 | ||||
-rw-r--r-- | tools/configure/configure.pro | 135 | ||||
-rw-r--r-- | tools/configure/configure_pch.h | 41 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 380 | ||||
-rw-r--r-- | tools/configure/configureapp.h | 74 | ||||
-rw-r--r-- | tools/configure/environment.cpp | 318 | ||||
-rw-r--r-- | tools/configure/environment.h | 57 | ||||
-rw-r--r-- | tools/configure/main.cpp | 72 |
11 files changed, 192 insertions, 1440 deletions
diff --git a/configure.bat b/configure.bat index 385b1e3556..a5968e2ec7 100644 --- a/configure.bat +++ b/configure.bat @@ -28,13 +28,35 @@ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off -setlocal ENABLEEXTENSIONS +setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS set ARGS=%* set QTSRC=%~dp0 +set QTSRC=%QTSRC:~0,-1% set QTDIR=%CD% +rem Parse command line + +set TOPLEVEL=false +set TOPQTSRC=%QTSRC% +set TOPQTDIR=%QTDIR% +if /i not "%~1" == "-top-level" goto notoplevel +set ARGS=%ARGS:~10% +set TOPLEVEL=true +for %%P in ("%TOPQTSRC%") do set TOPQTSRC=%%~dpP +set TOPQTSRC=%TOPQTSRC:~0,-1% +for %%P in ("%QTDIR%") do set TOPQTDIR=%%~dpP +set TOPQTDIR=%TOPQTDIR:~0,-1% +:notoplevel + +set SYNCQT= +set PLATFORM= +set MAKE= +call :doargs %ARGS% +if errorlevel 1 exit /b +goto doneargs + :doargs - if "%~1" == "" goto doneargs + if "%~1" == "" exit /b if "%~1" == "/?" goto help if "%~1" == "-?" goto help @@ -44,25 +66,118 @@ set QTDIR=%CD% if /i "%~1" == "-help" goto help if /i "%~1" == "--help" goto help + if /i "%~1" == "-redo" goto redo + if /i "%~1" == "--redo" goto redo + + if /i "%~1" == "-platform" goto platform + if /i "%~1" == "--platform" goto platform + + if /i "%~1" == "-no-syncqt" goto nosyncqt + if /i "%~1" == "--no-syncqt" goto nosyncqt + + if /i "%~1" == "-make-tool" goto maketool + if /i "%~1" == "--make-tool" goto maketool + +:nextarg shift goto doargs -:doneargs -echo Please wait while bootstrapping configure ... +:help + type %QTSRC%\config_help.txt + exit /b 1 + +:redo + if not exist "%TOPQTDIR%\config.opt" goto redoerr + set rargs= + for /f "usebackq delims=" %%i in ("%TOPQTDIR%\config.opt") do set rargs=!rargs! "%%i" + call :doargs %rargs% + goto nextarg +:redoerr + echo No config.opt present - cannot redo configuration. >&2 + exit /b 1 +:platform + shift + if "%~1" == "win32-msvc2012" goto msvc + if "%~1" == "win32-msvc2013" goto msvc + if "%~1" == "win32-msvc2015" goto msvc + if "%~1" == "win32-msvc2017" goto msvc + set PLATFORM=%~1 + goto nextarg +:msvc + echo. >&2 + echo Notice: re-mapping requested qmake spec to unified 'win32-msvc'. >&2 + echo. >&2 + set PLATFORM=win32-msvc + goto nextarg + +:nosyncqt + set SYNCQT=false + goto nextarg + +:maketool + shift + set MAKE=%~1 + goto nextarg + +:doneargs + +rem Find various executables for %%C in (clang-cl.exe cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C -if "%perl.exe%" == "" ( - echo Perl not found in PATH. Aborting. >&2 +rem Determine host spec + +if "%PLATFORM%" == "" ( + if not "%icl.exe%" == "" ( + set PLATFORM=win32-icc + ) else if not "%clang-cl.exe%" == "" ( + set PLATFORM=win32-clang-msvc + ) else if not "%cl.exe%" == "" ( + set PLATFORM=win32-msvc + ) else if not "%g++.exe%" == "" ( + set PLATFORM=win32-g++ + ) else ( + echo Cannot detect host toolchain. Please use -platform. Aborting. >&2 + exit /b 1 + ) +) +if not exist "%QTSRC%\mkspecs\%PLATFORM%\qmake.conf" ( + echo Host platform '%PLATFORM%' is invalid. Aborting. >&2 exit /b 1 ) +if "%PLATFORM:win32-g++=%" == "%PLATFORM%" ( + if "%MAKE%" == "" ( + if not "%jom.exe%" == "" ( + set MAKE=jom + ) else ( + set MAKE=nmake + ) + ) + set tmpl=win32 +) else ( + if "%MAKE%" == "" ( + set MAKE=mingw32-make + ) + set tmpl=unix +) + +rem Prepare build dir + if not exist mkspecs ( md mkspecs - if errorlevel 1 goto exit + if errorlevel 1 exit /b +) +if not exist bin ( + md bin + if errorlevel 1 exit /b +) +if not exist qmake ( + md qmake + if errorlevel 1 exit /b ) rem Extract Qt's version from .qmake.conf -for /f "eol=# tokens=1,2,3,4 delims=.= " %%i in (%QTSRC%.qmake.conf) do ( +for /f "eol=# tokens=1,2,3,4 delims=.= " %%i in (%QTSRC%\.qmake.conf) do ( if %%i == MODULE_VERSION ( set QTVERMAJ=%%j set QTVERMIN=%%k @@ -71,69 +186,85 @@ for /f "eol=# tokens=1,2,3,4 delims=.= " %%i in (%QTSRC%.qmake.conf) do ( ) set QTVERSION=%QTVERMAJ%.%QTVERMIN%.%QTVERPAT% -perl %QTSRC%bin\syncqt.pl -minimal -version %QTVERSION% -module QtCore -outdir "%QTDIR%" %QTSRC% -if errorlevel 1 goto exit +rem Create forwarding headers -if not exist tools\configure ( - md tools\configure - if errorlevel 1 goto exit +if "%SYNCQT%" == "" ( + if exist "%QTSRC%\.git" ( + set SYNCQT=true + ) else ( + set SYNCQT=false + ) +) +if "%SYNCQT%" == "true" ( + if not "%perl.exe%" == "" ( + echo Running syncqt ... + "%perl.exe%" -w "%QTSRC%\bin\syncqt.pl" -minimal -version %QTVERSION% -module QtCore -outdir "%QTDIR%" %QTSRC% + if errorlevel 1 exit /b + ) else ( + echo Perl not found in PATH. Aborting. >&2 + exit /b 1 + ) ) -cd tools\configure -if errorlevel 1 goto exit -set make=nmake -if not "%jom.exe%" == "" set make=jom +rem Build qmake + +echo Bootstrapping qmake ... + +cd qmake +if errorlevel 1 exit /b echo #### Generated by configure.bat - DO NOT EDIT! ####> Makefile echo/>> Makefile -echo QTVERSION = %QTVERSION%>> Makefile +echo BUILD_PATH = ..>> Makefile +if "%tmpl%" == "win32" ( + echo SOURCE_PATH = %QTSRC%>> Makefile +) else ( + echo SOURCE_PATH = %QTSRC:\=/%>> Makefile +) +if exist "%QTSRC%\.git" ( + echo INC_PATH = ../include>> Makefile +) else ( + echo INC_PATH = $^(SOURCE_PATH^)/include>> Makefile +) +echo QT_VERSION = %QTVERSION%>> Makefile rem These must have trailing spaces to avoid misinterpretation as 5>>, etc. -echo QT_VERSION_MAJOR = %QTVERMAJ% >> Makefile -echo QT_VERSION_MINOR = %QTVERMIN% >> Makefile -echo QT_VERSION_PATCH = %QTVERPAT% >> Makefile -if not "%icl.exe%" == "" ( - echo CXX = icl>>Makefile - echo EXTRA_CXXFLAGS = /Qstd=c++11 /Zc:forScope>>Makefile - rem This must have a trailing space. - echo QTSRC = %QTSRC% >> Makefile - set tmpl=win32 -) else if not "%cl.exe%" == "" ( - echo CXX = cl>>Makefile - echo EXTRA_CXXFLAGS =>>Makefile - rem This must have a trailing space. - echo QTSRC = %QTSRC% >> Makefile - set tmpl=win32 -) else if not "%clang-cl.exe%" == "" ( - echo CXX = clang-cl>>Makefile - echo EXTRA_CXXFLAGS = -fms-compatibility-version=19.00.23506 -Wno-microsoft-enum-value>>Makefile - rem This must have a trailing space. - echo QTSRC = %QTSRC% >> Makefile - set tmpl=win32 -) else if not "%g++.exe%" == "" ( - echo CXX = g++>>Makefile - echo EXTRA_CXXFLAGS =>>Makefile - rem This must NOT have a trailing space. - echo QTSRC = %QTSRC:\=/%>> Makefile - set tmpl=mingw - set make=mingw32-make +echo QT_MAJOR_VERSION = %QTVERMAJ% >> Makefile +echo QT_MINOR_VERSION = %QTVERMIN% >> Makefile +echo QT_PATCH_VERSION = %QTVERPAT% >> Makefile +if "%tmpl%" == "win32" ( + echo QMAKESPEC = %PLATFORM%>> Makefile ) else ( - echo No suitable compiler found in PATH. Aborting. >&2 - cd ..\.. - exit /b 1 + echo QMAKESPEC = $^(SOURCE_PATH^)/mkspecs/%PLATFORM%>> Makefile + echo CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections>> Makefile + echo CONFIG_LFLAGS = -Wl,--gc-sections>> Makefile + type "%QTSRC%\qmake\Makefile.unix.win32" >> Makefile + type "%QTSRC%\qmake\Makefile.unix.mingw" >> Makefile ) echo/>> Makefile -type %QTSRC%tools\configure\Makefile.%tmpl% >> Makefile +type "%QTSRC%\qmake\Makefile.%tmpl%" >> Makefile -%make% -if errorlevel 1 (cd ..\.. & exit /b 1) +%MAKE% +if errorlevel 1 (cd .. & exit /b 1) -cd ..\.. +cd .. -:conf -configureapp.exe -srcdir %QTSRC% %ARGS% -goto exit +rem Generate qt.conf -:help -type %QTSRC%config_help.txt +> "%QTDIR%\bin\qt.conf" ( + @echo [EffectivePaths] + @echo Prefix=.. + @echo [Paths] + @echo TargetSpec=dummy + @echo HostSpec=%PLATFORM% +) +if not "%QTDIR%" == "%QTSRC%" ( + >> "%QTDIR%\bin\qt.conf" ( + @echo [EffectiveSourcePaths] + @echo Prefix=%QTSRC:\=/% + ) +) + +rem Launch qmake-based configure -:exit +cd "%TOPQTDIR%" +"%QTDIR%\bin\qmake.exe" "%TOPQTSRC%" -- %ARGS% diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index d0e45478cc..2bca82535f 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -84,10 +84,11 @@ #define QT_FEATURE_translation -1 #define QT_NO_GEOM_VARIANT -#if defined(QT_BUILD_QMAKE) || defined(QT_BUILD_CONFIGURE) +#ifdef QT_BUILD_QMAKE #define QT_FEATURE_commandlineparser -1 #define QT_NO_COMPRESS #define QT_JSON_READONLY +#define QT_NO_STANDARDPATHS #define QT_NO_TEXTCODEC #define QT_FEATURE_textcodec -1 #else @@ -97,8 +98,4 @@ #define QT_FEATURE_textcodec 1 #endif -#if defined(QT_BUILD_QMAKE) -#define QT_NO_STANDARDPATHS -#endif - #endif // QT_BOOTSTRAPPED diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw deleted file mode 100644 index ccc3a64cdf..0000000000 --- a/tools/configure/Makefile.mingw +++ /dev/null @@ -1,125 +0,0 @@ -CORESRC = $(QTSRC)src/corelib -CONFSRC = $(QTSRC)tools/configure - -RAW_PCH = configure_pch.h -PCH = $(RAW_PCH).gch/c++ -DEFINES = -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_USE_QSTRINGBUILDER -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH) -INCPATH = -I"../../include" -I"../../include/QtCore" -I"../../include/QtCore/$(QTVERSION)" -I"../../include/QtCore/$(QTVERSION)/QtCore" -I"$(QTSRC)mkspecs/win32-g++" -CXXFLAGS_BARE = -std=c++11 -fno-rtti -fno-exceptions -mthreads -Wall -Wextra $(DEFINES) $(INCPATH) -CXXFLAGS = -include $(RAW_PCH) $(CXXFLAGS_BARE) -LINK = g++ -LFLAGS = -Wl,-subsystem,console -mthreads -LIBS = -lole32 -ladvapi32 -luuid - -TARGET = ../../configureapp.exe - -OBJECTS = \ - main.o \ - configureapp.o \ - environment.o \ - qarraydata.o \ - qbytearray.o \ - qbytearraymatcher.o \ - qhash.o \ - qlist.o \ - qlocale.o \ - qlocale_win.o \ - qlocale_tools.o \ - qvector.o \ - qutfcodec.o \ - qtextcodec.o \ - qglobal.o \ - qnumeric.o \ - qbuffer.o \ - qdatastream.o \ - qdir.o \ - qdiriterator.o \ - qfiledevice.o \ - qfile.o \ - qfileinfo.o \ - qabstractfileengine.o \ - qfilesystementry.o \ - qfilesystemengine.o \ - qfilesystemengine_win.o \ - qfilesystemiterator_win.o \ - qfsfileengine.o \ - qfsfileengine_win.o \ - qfsfileengine_iterator.o \ - qiodevice.o \ - qringbuffer.o \ - qdebug.o \ - qtextstream.o \ - qlogging.o \ - qtemporaryfile.o \ - qstandardpaths.o \ - qstandardpaths_win.o \ - qsystemlibrary.o \ - qbitarray.o \ - qdatetime.o \ - qmap.o \ - qregexp.o \ - qstring.o \ - qstring_compat.o \ - qstringbuilder.o \ - qstringlist.o \ - qvsnprintf.o \ - qvariant.o \ - qsystemerror.o \ - qmetatype.o \ - qmalloc.o \ - qxmlstream.o \ - qxmlutils.o \ - quuid.o - -$(TARGET): $(OBJECTS) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) - -$(OBJECTS): $(PCH) - -# SHELL is the full path of sh.exe, unless -# 1) it is found in the current directory -# 2) it is not found at all -# 3) it is overridden on the command line with an existing file -# ... otherwise it is always sh.exe. Specifically, SHELL from the -# environment has no effect. -# -# This check will fail if SHELL is explicitly set to a not -# sh-compatible shell. This is not a problem, because configure.bat -# will not do that. -ifeq ($(SHELL), sh.exe) - ifeq ($(wildcard "$(CURDIR)/sh.exe"), ) - SH = 0 - else - SH = 1 - endif -else - SH = 1 -endif - -ifeq ($(SH), 1) - CHK_DIR_EXISTS = test -d - CHK_DIR_EXISTS_GLUE = || - MKDIR = mkdir -p -else - CHK_DIR_EXISTS = if not exist - CHK_DIR_EXISTS_GLUE = - MKDIR = md -endif - -$(PCH): $(CONFSRC)/configure_pch.h - @$(CHK_DIR_EXISTS) $(RAW_PCH).gch $(CHK_DIR_EXISTS_GLUE) $(MKDIR) $(RAW_PCH).gch - $(CXX) -x c++-header -c $(CXXFLAGS_BARE) -o $@ $< - -VPATH = $(CONFSRC):$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin - -main.o: $(CONFSRC)/configureapp.h -configureapp.o: $(CONFSRC)/configureapp.h $(CONFSRC)/environment.h -environment.o: $(CONFSRC)/environment.h - -# Make sure qstring_compat.obj isn't compiled with PCH enabled -qstring_compat.o: $(CORESRC)/tools/qstring_compat.cpp - $(CXX) -c $(CXXFLAGS_BARE) -o $@ $< - -clean: - -rm -f *.o - -rm -rf *.gch diff --git a/tools/configure/Makefile.win32 b/tools/configure/Makefile.win32 deleted file mode 100644 index f0199343be..0000000000 --- a/tools/configure/Makefile.win32 +++ /dev/null @@ -1,174 +0,0 @@ -CORESRC = $(QTSRC)src\corelib -CONFSRC = $(QTSRC)tools\configure - -DEFINES = -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_USE_QSTRINGBUILDER -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH) -INCPATH = -I"..\..\include" -I"..\..\include\QtCore" -I"..\..\include\QtCore\$(QTVERSION)" -I"..\..\include\QtCore\$(QTVERSION)\QtCore" -I"$(QTSRC)mkspecs\win32-msvc" -CXXFLAGS_BARE = -nologo -Zc:wchar_t -W3 -GR -EHsc -w34100 -w34189 -wd4577 $(CFLAGS_CRT) $(EXTRA_CXXFLAGS) $(DEFINES) $(INCPATH) -!IF ("$(CXX)" != "clang-cl") -PCH = configure_pch.pch -PCH_OBJECT = configure_pch.obj -CXXFLAGS = -FIconfigure_pch.h -Yuconfigure_pch.h -Fp$(PCH) -MP $(CXXFLAGS_BARE) -!ELSE -PCH = -CXXFLAGS = -Wmicrosoft $(CXXFLAGS_BARE) -!ENDIF -LINK = link -LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:"configure.intermediate.manifest" -LIBS = ole32.lib advapi32.lib shell32.lib - -TARGET = ..\..\configureapp.exe - -OBJECTS = \ - main.obj \ - configureapp.obj \ - environment.obj \ - qarraydata.obj \ - qbytearray.obj \ - qbytearraymatcher.obj \ - qhash.obj \ - qlist.obj \ - qlocale.obj \ - qlocale_win.obj \ - qlocale_tools.obj \ - qvector.obj \ - qutfcodec.obj \ - qtextcodec.obj \ - qglobal.obj \ - qnumeric.obj \ - qbuffer.obj \ - qdatastream.obj \ - qdir.obj \ - qdiriterator.obj \ - qfiledevice.obj \ - qfile.obj \ - qfileinfo.obj \ - qabstractfileengine.obj \ - qfilesystementry.obj \ - qfilesystemengine.obj \ - qfilesystemengine_win.obj \ - qfilesystemiterator_win.obj \ - qfsfileengine.obj \ - qfsfileengine_win.obj \ - qfsfileengine_iterator.obj \ - qiodevice.obj \ - qringbuffer.obj \ - qdebug.obj \ - qtextstream.obj \ - qlogging.obj \ - qtemporaryfile.obj \ - qstandardpaths.obj \ - qstandardpaths_win.obj \ - qsystemlibrary.obj \ - qbitarray.obj \ - qdatetime.obj \ - qmap.obj \ - qregexp.obj \ - qstring.obj \ - qstring_compat.obj \ - qstringbuilder.obj \ - qstringlist.obj \ - qvsnprintf.obj \ - qvariant.obj \ - qsystemerror.obj \ - qmetatype.obj \ - qmalloc.obj \ - qxmlstream.obj \ - qxmlutils.obj \ - quuid.obj \ - $(PCH_OBJECT) - -$(TARGET): $(OBJECTS) - $(LINK) $(LFLAGS) /OUT:$(TARGET) @<< - $(OBJECTS) $(LIBS) -<< - mt.exe -nologo -manifest "configure.intermediate.manifest" -outputresource:$(TARGET);1 - -clean: - -del *.obj - -del *.pch - -del configure.intermediate.manifest - -$(PCH): $(CONFSRC)\configure_pch.h - $(CXX) -c -Yc $(CXXFLAGS_BARE) -Fp$@ -Foconfigure_pch.obj -TP $** - -$(OBJECTS): $(PCH) - -main.obj: $(CONFSRC)\main.cpp $(CONFSRC)\configureapp.h $(PCH) -configureapp.obj: $(CONFSRC)\configureapp.cpp $(CONFSRC)\configureapp.h $(CONFSRC)\environment.h $(PCH) -environment.obj: $(CONFSRC)\environment.cpp $(CONFSRC)\environment.h $(PCH) -qarraydata.obj: $(CORESRC)\tools\qarraydata.cpp $(PCH) -qbytearray.obj: $(CORESRC)\tools\qbytearray.cpp $(PCH) -qbytearraymatcher.obj: $(CORESRC)\tools\qbytearraymatcher.cpp $(PCH) -qhash.obj: $(CORESRC)\tools\qhash.cpp $(PCH) -qlist.obj: $(CORESRC)\tools\qlist.cpp $(PCH) -qlocale.obj: $(CORESRC)\tools\qlocale.cpp $(PCH) -qlocale_win.obj: $(CORESRC)\tools\qlocale_win.cpp $(PCH) -qlocale_tools.obj: $(CORESRC)\tools\qlocale_tools.cpp $(PCH) -qvector.obj: $(CORESRC)\tools\qvector.cpp $(PCH) -qutfcodec.obj: $(CORESRC)\codecs\qutfcodec.cpp $(PCH) -qtextcodec.obj: $(CORESRC)\codecs\qtextcodec.cpp $(PCH) -qglobal.obj: $(CORESRC)\global\qglobal.cpp $(PCH) -qnumeric.obj: $(CORESRC)\global\qnumeric.cpp $(PCH) -qbuffer.obj: $(CORESRC)\io\qbuffer.cpp $(PCH) -qdatastream.obj: $(CORESRC)\io\qdatastream.cpp $(PCH) -qdir.obj: $(CORESRC)\io\qdir.cpp $(PCH) -qdiriterator.obj: $(CORESRC)\io\qdiriterator.cpp $(PCH) -qfiledevice.obj: $(CORESRC)\io\qfiledevice.cpp $(PCH) -qfile.obj: $(CORESRC)\io\qfile.cpp $(PCH) -qfileinfo.obj: $(CORESRC)\io\qfileinfo.cpp $(PCH) -qabstractfileengine.obj: $(CORESRC)\io\qabstractfileengine.cpp $(PCH) -qfilesystementry.obj: $(CORESRC)\io\qfilesystementry.cpp $(PCH) -qfilesystemengine.obj: $(CORESRC)\io\qfilesystemengine.cpp $(PCH) -qfilesystemengine_win.obj: $(CORESRC)\io\qfilesystemengine_win.cpp $(PCH) -qfilesystemiterator_win.obj: $(CORESRC)\io\qfilesystemiterator_win.cpp $(PCH) -qfsfileengine.obj: $(CORESRC)\io\qfsfileengine.cpp $(PCH) -qfsfileengine_win.obj: $(CORESRC)\io\qfsfileengine_win.cpp $(PCH) -qfsfileengine_iterator.obj: $(CORESRC)\io\qfsfileengine_iterator.cpp $(PCH) -qiodevice.obj: $(CORESRC)\io\qiodevice.cpp $(PCH) -qringbuffer.obj: $(CORESRC)\tools\qringbuffer.cpp $(PCH) -qdebug.obj: $(CORESRC)\io\qdebug.cpp $(PCH) -qtextstream.obj: $(CORESRC)\io\qtextstream.cpp $(PCH) -qtemporaryfile.obj: $(CORESRC)\io\qtemporaryfile.cpp $(PCH) -qstandardpaths.obj: $(CORESRC)\io\qstandardpaths.cpp $(PCH) -qstandardpaths_win.obj: $(CORESRC)\io\qstandardpaths_win.cpp $(PCH) -qsystemlibrary.obj: $(CORESRC)\plugin\qsystemlibrary.cpp $(PCH) -qbitarray.obj: $(CORESRC)\tools\qbitarray.cpp $(PCH) -qdatetime.obj: $(CORESRC)\tools\qdatetime.cpp $(PCH) -qmap.obj: $(CORESRC)\tools\qmap.cpp $(PCH) -qregexp.obj: $(CORESRC)\tools\qregexp.cpp $(PCH) -qstring.obj: $(CORESRC)\tools\qstring.cpp $(PCH) -qstringbuilder.obj: $(CORESRC)\tools\qstringbuilder.cpp $(PCH) -qstringlist.obj: $(CORESRC)\tools\qstringlist.cpp $(PCH) -qvsnprintf.obj: $(CORESRC)\tools\qvsnprintf.cpp $(PCH) -qvariant.obj: $(CORESRC)\kernel\qvariant.cpp $(PCH) -qsystemerror.obj: $(CORESRC)\kernel\qsystemerror.cpp $(PCH) -qline.obj: $(CORESRC)\tools\qline.cpp $(PCH) -qsize.obj: $(CORESRC)\tools\qsize.cpp $(PCH) -qpoint.obj: $(CORESRC)\tools\qpoint.cpp $(PCH) -qrect.obj: $(CORESRC)\tools\qrect.cpp $(PCH) -qmetatype.obj: $(CORESRC)\kernel\qmetatype.cpp $(PCH) -qmalloc.obj: $(CORESRC)\global\qmalloc.cpp $(PCH) -qxmlstream.obj: $(CORESRC)\xml\qxmlstream.cpp $(PCH) -qxmlutils.obj: $(CORESRC)\xml\qxmlutils.cpp $(PCH) -quuid.obj: $(CORESRC)\plugin\quuid.cpp $(PCH) - -{$(CONFSRC)}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\tools}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\codecs}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\global}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\io}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\kernel}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\plugin}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< -{$(CORESRC)\xml}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< - -# Make sure qstring_compat.obj isn't compiled with PCH enabled -qstring_compat.obj: $(CORESRC)\tools\qstring_compat.cpp - $(CXX) -c $(CXXFLAGS_BARE) $(CORESRC)\tools\qstring_compat.cpp diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro deleted file mode 100644 index 90da2de119..0000000000 --- a/tools/configure/configure.pro +++ /dev/null @@ -1,135 +0,0 @@ -TARGET = configureapp -DESTDIR = $$PWD/../.. # build directly in source dir - -CONFIG += console flat stl rtti_off -CONFIG -= moc qt -DEFINES = UNICODE _CRT_SECURE_NO_DEPRECATE QT_USE_QSTRINGBUILDER -DEFINES += QT_BOOTSTRAPPED QT_BUILD_CONFIGURE - -win32 : LIBS += -lole32 -ladvapi32 -mingw : LIBS += -luuid - -win32-msvc* { - QMAKE_CFLAGS_RELEASE -= -MD - QMAKE_CFLAGS_RELEASE -= -O2 - QMAKE_CFLAGS_RELEASE += -MT -O1 -Os - QMAKE_CFLAGS_DEBUG -= -MDd - QMAKE_CFLAGS_DEBUG += -MTd - QMAKE_CXXFLAGS_RELEASE -= -MD - QMAKE_CXXFLAGS_RELEASE -= -O2 - QMAKE_CXXFLAGS_RELEASE += -MT -O1 -Os - QMAKE_CXXFLAGS_DEBUG -= -MDd - QMAKE_CXXFLAGS_DEBUG += -MTd -} - -PRECOMPILED_HEADER = configure_pch.h - -INCLUDEPATH += \ - $$QT_BUILD_TREE/include \ - $$QT_BUILD_TREE/include/QtCore \ - $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION \ - $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore \ - $$QT_SOURCE_TREE/tools/shared - -HEADERS = configureapp.h environment.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qarraydata.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qarraydatapointer.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qarraydataops.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qchar.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qhash.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qlist.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qlocale.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qvector.h \ - $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec_p.h \ - $$QT_SOURCE_TREE/src/corelib/codecs/qtextcodec.h \ - $$QT_SOURCE_TREE/src/corelib/global/qglobal.h \ - $$QT_SOURCE_TREE/src/corelib/global/qnumeric.h \ - $$QT_SOURCE_TREE/src/corelib/global/qlogging.h \ - $$QT_SOURCE_TREE/src/corelib/io/qbuffer.h \ - $$QT_SOURCE_TREE/src/corelib/io/qdatastream.h \ - $$QT_SOURCE_TREE/src/corelib/io/qdir.h \ - $$QT_SOURCE_TREE/src/corelib/io/qdiriterator.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfiledevice.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfile.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfileinfo.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry_p.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine_p.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemmetadata_p.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemiterator_p.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine.h \ - $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_iterator_p.h \ - $$QT_SOURCE_TREE/src/corelib/io/qiodevice.h \ - $$QT_SOURCE_TREE/src/corelib/io/qtextstream.h \ - $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.h \ - $$QT_SOURCE_TREE/src/corelib/io/qstandardpaths.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qmap.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qregexp.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qringbuffer_p.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qstring.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qstringbuilder.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.h \ - $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \ - $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror_p.h \ - $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \ - $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h - -SOURCES = main.cpp configureapp.cpp environment.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qarraydata.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qhash.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qlist.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qlocale.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qlocale_win.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qlocale_tools.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qvector.cpp \ - $$QT_SOURCE_TREE/src/corelib/codecs/qutfcodec.cpp \ - $$QT_SOURCE_TREE/src/corelib/codecs/qtextcodec.cpp \ - $$QT_SOURCE_TREE/src/corelib/global/qglobal.cpp \ - $$QT_SOURCE_TREE/src/corelib/global/qnumeric.cpp \ - $$QT_SOURCE_TREE/src/corelib/global/qlogging.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qbuffer.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qdatastream.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qdir.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qdiriterator.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfiledevice.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfile.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfileinfo.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qabstractfileengine.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemengine_win.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfilesystemiterator_win.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_win.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_iterator.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qiodevice.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qdebug.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qtextstream.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qstandardpaths.cpp \ - $$QT_SOURCE_TREE/src/corelib/io/qstandardpaths_win.cpp \ - $$QT_SOURCE_TREE/src/corelib/plugin/qsystemlibrary.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qbitarray.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qdatetime.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qmap.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qregexp.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qringbuffer.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qstring.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qstringbuilder.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qstring_compat.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qvsnprintf.cpp \ - $$QT_SOURCE_TREE/src/corelib/kernel/qvariant.cpp \ - $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror.cpp \ - $$QT_SOURCE_TREE/src/corelib/kernel/qmetatype.cpp \ - $$QT_SOURCE_TREE/src/corelib/global/qmalloc.cpp \ - $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.cpp \ - $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils.cpp \ - $$QT_SOURCE_TREE/src/corelib/plugin/quuid.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qcryptographichash.cpp diff --git a/tools/configure/configure_pch.h b/tools/configure/configure_pch.h deleted file mode 100644 index 8e36f7e54e..0000000000 --- a/tools/configure/configure_pch.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// for rand_s, _CRT_RAND_S must be #defined before #including stdlib.h. -// put it at the beginning so some indirect inclusion doesn't break it -#ifndef _CRT_RAND_S -#define _CRT_RAND_S -#endif -#include <qplatformdefs.h> -#include <qglobal.h> -#include <qlist.h> -#include <qvariant.h> // All moc genereated code has this include -#include <qregexp.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qtextcodec.h> diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp deleted file mode 100644 index 6a09705cc1..0000000000 --- a/tools/configure/configureapp.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "configureapp.h" -#include "environment.h" - -#include <qdir.h> -#include <qdiriterator.h> -#include <qtemporaryfile.h> -#include <qstandardpaths.h> -#include <qstack.h> -#include <qdebug.h> -#include <qfileinfo.h> -#include <qtextstream.h> -#include <qregexp.h> -#include <qhash.h> - -#include <iostream> -#include <string> -#include <fstream> -#include <windows.h> - -QT_BEGIN_NAMESPACE - -std::ostream &operator<<(std::ostream &s, const QString &val) { - s << val.toLocal8Bit().data(); - return s; -} - - -using namespace std; - -Configure::Configure(int& argc, char** argv) -{ - int i; - - for (i = 1; i < argc; i++) - configCmdLine += argv[ i ]; - - if (configCmdLine.size() >= 2 && configCmdLine.at(0) == "-srcdir") { - sourcePath = QDir::cleanPath(configCmdLine.at(1)); - sourceDir = QDir(sourcePath); - configCmdLine.erase(configCmdLine.begin(), configCmdLine.begin() + 2); - } else { - // Get the path to the executable - wchar_t module_name[MAX_PATH]; - GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t)); - QFileInfo sourcePathInfo = QString::fromWCharArray(module_name); - sourcePath = sourcePathInfo.absolutePath(); - sourceDir = sourcePathInfo.dir(); - } - buildPath = QDir::currentPath(); - if (sourceDir != buildDir) { //shadow builds! - QDir(buildPath).mkpath("bin"); - - buildDir.mkpath("mkspecs"); - } - - if (dictionary[ "QMAKESPEC" ].size() == 0) { - dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec(); - dictionary[ "QMAKESPEC_FROM" ] = "detected"; - } - - dictionary[ "SYNCQT" ] = "auto"; - - QString tmp = dictionary[ "QMAKESPEC" ]; - if (tmp.contains("\\")) { - tmp = tmp.mid(tmp.lastIndexOf("\\") + 1); - } else { - tmp = tmp.mid(tmp.lastIndexOf("/") + 1); - } - dictionary[ "QMAKESPEC" ] = tmp; -} - -Configure::~Configure() -{ -} - -void Configure::parseCmdLine() -{ - sourcePathMangled = sourcePath; - buildPathMangled = buildPath; - if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") { - dictionary[ "TOPLEVEL" ] = "yes"; - configCmdLine.removeAt(0); - sourcePathMangled = QFileInfo(sourcePath).path(); - buildPathMangled = QFileInfo(buildPath).path(); - } - qmakeCmdLine = configCmdLine; - - int argCount = configCmdLine.size(); - int i = 0; - - // Look first for -redo - for (int k = 0 ; k < argCount; ++k) { - if (configCmdLine.at(k) == "-redo") { - configCmdLine.removeAt(k); - if (!reloadCmdLine(k)) { - dictionary["DONE"] = "error"; - return; - } - argCount = configCmdLine.size(); - break; - } - } - - for (; i<configCmdLine.size(); ++i) { - if (configCmdLine.at(i) == "-platform") { - ++i; - if (i == argCount) - break; - dictionary[ "QMAKESPEC" ] = configCmdLine.at(i); - dictionary[ "QMAKESPEC_FROM" ] = "commandline"; - } - - else if (configCmdLine.at(i) == "-no-syncqt") - dictionary[ "SYNCQT" ] = "no"; - - else if (configCmdLine.at(i) == "-make-tool") { - ++i; - if (i == argCount) - break; - dictionary[ "MAKE" ] = configCmdLine.at(i); - } - - } - - // Ensure that QMAKESPEC exists in the mkspecs folder - const QString mkspecPath(sourcePath + "/mkspecs"); - QDirIterator itMkspecs(mkspecPath, QDir::AllDirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); - QStringList mkspecs; - - while (itMkspecs.hasNext()) { - QString mkspec = itMkspecs.next(); - // Remove base PATH - mkspec.remove(0, mkspecPath.length() + 1); - mkspecs << mkspec; - } - - if (dictionary[ "QMAKESPEC" ] == "win32-msvc2012" - || dictionary[ "QMAKESPEC" ] == "win32-msvc2013" - || dictionary[ "QMAKESPEC" ] == "win32-msvc2015" - || dictionary[ "QMAKESPEC" ] == "win32-msvc2017") { - cout << "\nNotice: re-mapping requested qmake spec to unified 'win32-msvc'.\n\n"; - dictionary[ "QMAKESPEC" ] = "win32-msvc"; - } - - if (dictionary["QMAKESPEC"].toLower() == "features" - || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) { - dictionary[ "DONE" ] = "error"; - if (dictionary ["QMAKESPEC_FROM"] == "commandline") { - cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl; - } else { // was autodetected from environment - cout << "Unable to detect the platform from environment. Use -platform command line" << endl - << "argument and run configure again." << endl; - } - cout << "See the README file for a list of supported operating systems and compilers." << endl; - } else { - if (dictionary[ "QMAKESPEC" ].endsWith("-icc") || - dictionary[ "QMAKESPEC" ].contains("-msvc")) { - if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake"; - dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; - } else if (dictionary[ "QMAKESPEC" ].startsWith(QLatin1String("win32-g++"))) { - if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make"; - dictionary[ "QMAKEMAKEFILE" ] = "Makefile.unix"; - } else { - if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make"; - dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; - } - } -} - -void Configure::generateHeaders() -{ - if (dictionary["SYNCQT"] == "auto") - dictionary["SYNCQT"] = QFile::exists(sourcePath + "/.git") ? "yes" : "no"; - - if (dictionary["SYNCQT"] == "yes") { - if (!QStandardPaths::findExecutable(QStringLiteral("perl.exe")).isEmpty()) { - cout << "Running syncqt..." << endl; - QStringList args; - args << "perl" << "-w"; - args += sourcePath + "/bin/syncqt.pl"; - args << "-version" << QT_VERSION_STR << "-minimal" << "-module" << "QtCore"; - args += sourcePath; - int retc = Environment::execute(args, QStringList(), QStringList()); - if (retc) { - cout << "syncqt failed, return code " << retc << endl << endl; - dictionary["DONE"] = "error"; - } - } else { - cout << "Perl not found in environment - cannot run syncqt." << endl; - dictionary["DONE"] = "error"; - } - } -} - -void Configure::buildQmake() -{ - { - QStringList args; - - // Build qmake - QString pwd = QDir::currentPath(); - if (!QDir(buildPath).mkpath("qmake")) { - cout << "Cannot create qmake build dir." << endl; - dictionary[ "DONE" ] = "error"; - return; - } - if (!QDir::setCurrent(buildPath + "/qmake")) { - cout << "Cannot enter qmake build dir." << endl; - dictionary[ "DONE" ] = "error"; - return; - } - - QString makefile = "Makefile"; - { - QFile out(makefile); - if (out.open(QFile::WriteOnly | QFile::Text)) { - QTextStream stream(&out); - stream << "#AutoGenerated by configure.exe" << endl - << "BUILD_PATH = .." << endl - << "SOURCE_PATH = " << QDir::toNativeSeparators(sourcePath) << endl - << "INC_PATH = " << QDir::toNativeSeparators( - (QFile::exists(sourcePath + "/.git") ? ".." : sourcePath) - + "/include") << endl; - stream << "QT_VERSION = " QT_VERSION_STR << endl - << "QT_MAJOR_VERSION = " QT_STRINGIFY(QT_VERSION_MAJOR) << endl - << "QT_MINOR_VERSION = " QT_STRINGIFY(QT_VERSION_MINOR) << endl - << "QT_PATCH_VERSION = " QT_STRINGIFY(QT_VERSION_PATCH) << endl; - if (dictionary[ "QMAKESPEC" ].startsWith("win32-g++")) { - stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\" << dictionary[ "QMAKESPEC" ] << endl - << "CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections" << endl - << "CONFIG_LFLAGS = -Wl,--gc-sections" << endl; - - QFile in(sourcePath + "/qmake/Makefile.unix.win32"); - if (in.open(QFile::ReadOnly | QFile::Text)) - stream << in.readAll(); - QFile in2(sourcePath + "/qmake/Makefile.unix.mingw"); - if (in2.open(QFile::ReadOnly | QFile::Text)) - stream << in2.readAll(); - } else { - stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl; - } - - stream << "\n\n"; - - QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]); - if (in.open(QFile::ReadOnly | QFile::Text)) { - QString d = in.readAll(); - //### need replaces (like configure.sh)? --Sam - stream << d << endl; - } - stream.flush(); - out.close(); - } - } - - args += dictionary[ "MAKE" ]; - args += "-f"; - args += makefile; - - cout << "Creating qmake..." << endl; - int exitCode = Environment::execute(args, QStringList(), QStringList()); - if (exitCode) { - args.clear(); - args += dictionary[ "MAKE" ]; - args += "-f"; - args += makefile; - args += "clean"; - exitCode = Environment::execute(args, QStringList(), QStringList()); - if (exitCode) { - cout << "Cleaning qmake failed, return code " << exitCode << endl << endl; - dictionary[ "DONE" ] = "error"; - } else { - args.clear(); - args += dictionary[ "MAKE" ]; - args += "-f"; - args += makefile; - exitCode = Environment::execute(args, QStringList(), QStringList()); - if (exitCode) { - cout << "Building qmake failed, return code " << exitCode << endl << endl; - dictionary[ "DONE" ] = "error"; - } - } - } - QDir::setCurrent(pwd); - } - - // Generate qt.conf - QFile confFile(buildPath + "/bin/qt.conf"); - if (confFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file. - QTextStream confStream(&confFile); - confStream << "[EffectivePaths]" << endl - << "Prefix=.." << endl - << "[Paths]" << endl - << "TargetSpec=dummy" << endl - << "HostSpec=" << dictionary["QMAKESPEC"] << endl; - if (sourcePath != buildPath) - confStream << "[EffectiveSourcePaths]" << endl - << "Prefix=" << sourcePath << endl; - - confStream.flush(); - confFile.close(); - } - -} - -void Configure::configure() -{ - QStringList args; - args << buildPath + "/bin/qmake" - << sourcePathMangled - << "--" << qmakeCmdLine; - - QString pwd = QDir::currentPath(); - QDir::setCurrent(buildPathMangled); - if (int exitCode = Environment::execute(args, QStringList(), QStringList())) { - cout << "Qmake failed, return code " << exitCode << endl << endl; - dictionary[ "DONE" ] = "error"; - } - QDir::setCurrent(pwd); -} - -bool Configure::reloadCmdLine(int idx) -{ - QFile inFile(buildPathMangled + "/config.opt"); - if (!inFile.open(QFile::ReadOnly)) { - inFile.setFileName(buildPath + "/config.opt"); - if (!inFile.open(QFile::ReadOnly)) { - inFile.setFileName(buildPath + "/configure.cache"); - if (!inFile.open(QFile::ReadOnly)) { - cout << "No config.opt present - cannot redo configuration." << endl; - return false; - } - } - } - QTextStream inStream(&inFile); - while (!inStream.atEnd()) - configCmdLine.insert(idx++, inStream.readLine().trimmed()); - return true; -} - -bool Configure::isDone() -{ - return !dictionary["DONE"].isEmpty(); -} - -bool Configure::isOk() -{ - return (dictionary[ "DONE" ] != "error"); -} - -QT_END_NAMESPACE diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h deleted file mode 100644 index 596196c2a9..0000000000 --- a/tools/configure/configureapp.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qmap.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qlist.h> -#include <qbuffer.h> -#include <qtextstream.h> -#include <qdir.h> - -QT_BEGIN_NAMESPACE - -class Configure -{ -public: - Configure( int& argc, char** argv ); - ~Configure(); - - void parseCmdLine(); - - void buildQmake(); - - void prepareConfigureInput(); - void configure(); - - void generateHeaders(); - - bool isDone(); - bool isOk(); - -private: - int verbose; - - // Our variable dictionaries - QMap<QString,QString> dictionary; - QStringList configCmdLine, qmakeCmdLine; - - QString outputLine; - - QTextStream outStream; - QString sourcePath, buildPath; - QString sourcePathMangled, buildPathMangled; - QDir sourceDir, buildDir; - - bool reloadCmdLine(int idx); -}; - -QT_END_NAMESPACE diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp deleted file mode 100644 index 312e2f9e56..0000000000 --- a/tools/configure/environment.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "environment.h" - -#include <qdebug.h> -#include <qstringlist.h> -#include <qmap.h> -#include <qdir.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qstandardpaths.h> -#include <qtemporaryfile.h> - -#include <process.h> -#include <errno.h> -#include <iostream> - -//#define CONFIGURE_DEBUG_EXECUTE -//#define CONFIGURE_DEBUG_CP_DIR - -using namespace std; - -#ifdef Q_OS_WIN32 -#include <qt_windows.h> -#endif - -QT_BEGIN_NAMESPACE - -struct CompilerInfo{ - Compiler compiler; - const char *compilerStr; - const char *executable; -} compiler_info[] = { - // The compilers here are sorted in a reversed-preferred order - {CC_MINGW, "MinGW (Minimalist GNU for Windows)", "g++.exe"}, - {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe - {CC_MSVC, "Microsoft (R) Visual Studio C/C++ Compiler", "cl.exe"}, // link.exe, lib.exe - {CC_UNKNOWN, "Unknown", 0}, -}; - - -// Initialize static variables -Compiler Environment::detectedCompiler = CC_UNKNOWN; - -/*! - Returns the pointer to the CompilerInfo for a \a compiler. -*/ -CompilerInfo *Environment::compilerInfo(Compiler compiler) -{ - int i = 0; - while(compiler_info[i].compiler != compiler && compiler_info[i].compiler != CC_UNKNOWN) - ++i; - return &(compiler_info[i]); -} - -/*! - Returns the qmakespec for the compiler detected on the system. -*/ -QString Environment::detectQMakeSpec() -{ - QString spec; - switch (detectCompiler()) { - case CC_MSVC: - spec = "win32-msvc"; - break; - case CC_INTEL: - spec = "win32-icc"; - break; - case CC_MINGW: - spec = "win32-g++"; - break; - default: - break; - } - - return spec; -} - -/*! - Returns the enum of the compiler which was detected on the system. - The compilers are detected in the order as entered into the - compiler_info list. - - If more than one compiler is found, CC_UNKNOWN is returned. -*/ -Compiler Environment::detectCompiler() -{ - if(detectedCompiler != CC_UNKNOWN) - return detectedCompiler; - - int installed = 0; - for (int i = 0; compiler_info[i].compiler; ++i) { - if (!QStandardPaths::findExecutable(compiler_info[i].executable).isEmpty()) { - if (detectedCompiler == CC_UNKNOWN) - detectedCompiler = compiler_info[i].compiler; - ++installed; - } - } - - if (installed > 1) { - cout << "Found more than one known compiler! Using \"" << compilerInfo(detectedCompiler)->compilerStr << "\"" << endl; - detectedCompiler = CC_UNKNOWN; - } - return detectedCompiler; -}; - -/*! - Creates a commandling from \a program and it \a arguments, - escaping characters that needs it. -*/ -static QString qt_create_commandline(const QString &program, const QStringList &arguments) -{ - QString programName = program; - if (!programName.startsWith("\"") && !programName.endsWith("\"") && programName.contains(" ")) - programName = "\"" + programName + "\""; - programName.replace("/", "\\"); - - QString args; - // add the prgram as the first arrg ... it works better - args = programName + " "; - for (int i=0; i<arguments.size(); ++i) { - QString tmp = arguments.at(i); - // in the case of \" already being in the string the \ must also be escaped - tmp.replace( "\\\"", "\\\\\"" ); - // escape a single " because the arguments will be parsed - tmp.replace( "\"", "\\\"" ); - if (tmp.isEmpty() || tmp.contains(' ') || tmp.contains('\t')) { - // The argument must not end with a \ since this would be interpreted - // as escaping the quote -- rather put the \ behind the quote: e.g. - // rather use "foo"\ than "foo\" - QString endQuote("\""); - int i = tmp.length(); - while (i>0 && tmp.at(i-1) == '\\') { - --i; - endQuote += "\\"; - } - args += QString(" \"") + tmp.left(i) + endQuote; - } else { - args += ' ' + tmp; - } - } - return args; -} - -/*! - Creates a QByteArray of the \a environment. -*/ -static QByteArray qt_create_environment(const QStringList &environment) -{ - QByteArray envlist; - if (environment.isEmpty()) - return envlist; - - int pos = 0; - // add PATH if necessary (for DLL loading) - QByteArray path = qgetenv("PATH"); - if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) { - QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path)); - uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data() + pos, tmp.utf16(), tmpSize); - pos += tmpSize; - } - // add the user environment - foreach (const QString &tmp, environment) { - uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data() + pos, tmp.utf16(), tmpSize); - pos += tmpSize; - } - // add the 2 terminating 0 (actually 4, just to be on the safe side) - envlist.resize(envlist.size() + 4); - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - - return envlist; -} - -/*! - Executes the command described in \a arguments, in the - environment inherited from the parent process, with the - \a additionalEnv settings applied. - \a removeEnv removes the specified environment variables from - the environment of the executed process. - - Returns the exit value of the process, or -1 if the command could - not be executed. - - This function uses _(w)spawnvpe to spawn a process by searching - through the PATH environment variable. -*/ -int Environment::execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv) -{ -#ifdef CONFIGURE_DEBUG_EXECUTE - qDebug() << "About to Execute: " << arguments; - qDebug() << " " << QDir::currentPath(); - qDebug() << " " << additionalEnv; - qDebug() << " " << removeEnv; -#endif - // Create the full environment from the current environment and - // the additionalEnv strings, then remove all variables defined - // in removeEnv - QMap<QString, QString> fullEnvMap; - LPWSTR envStrings = GetEnvironmentStrings(); - if (envStrings) { - int strLen = 0; - for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) { - strLen = int(wcslen(envString)); - QString str = QString((const QChar*)envString, strLen); - if (!str.startsWith("=")) { // These are added by the system - int sepIndex = str.indexOf('='); - fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1)); - } - } - } - FreeEnvironmentStrings(envStrings); - - // Add additionalEnv variables - for (int i = 0; i < additionalEnv.count(); ++i) { - const QString &str = additionalEnv.at(i); - int sepIndex = str.indexOf('='); - fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1)); - } - - // Remove removeEnv variables - for (int j = 0; j < removeEnv.count(); ++j) - fullEnvMap.remove(removeEnv.at(j).toUpper()); - - // Add all variables to a QStringList - QStringList fullEnv; - QMapIterator<QString, QString> it(fullEnvMap); - while (it.hasNext()) { - it.next(); - fullEnv += QString(it.key() + "=" + it.value()); - } - - // ---------------------------- - QString program = arguments.takeAt(0); - QString args = qt_create_commandline(program, arguments); - QByteArray envlist = qt_create_environment(fullEnv); - - DWORD exitCode = DWORD(-1); - PROCESS_INFORMATION procInfo; - memset(&procInfo, 0, sizeof(procInfo)); - - STARTUPINFO startInfo; - memset(&startInfo, 0, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); - - bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(), - 0, 0, true, CREATE_UNICODE_ENVIRONMENT, - envlist.isEmpty() ? 0 : envlist.data(), - 0, &startInfo, &procInfo); - - if (couldExecute) { - WaitForSingleObject(procInfo.hProcess, INFINITE); - GetExitCodeProcess(procInfo.hProcess, &exitCode); - CloseHandle(procInfo.hThread); - CloseHandle(procInfo.hProcess); - } - - - if (exitCode == DWORD(-1)) { - switch(GetLastError()) { - case E2BIG: - cerr << "execute: Argument list exceeds 1024 bytes" << endl; - foreach (const QString &arg, arguments) - cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; - break; - case ENOENT: - cerr << "execute: File or path is not found (" << program.toLocal8Bit().constData() << ")" << endl; - break; - case ENOEXEC: - cerr << "execute: Specified file is not executable or has invalid executable-file format (" << program.toLocal8Bit().constData() << ")" << endl; - break; - case ENOMEM: - cerr << "execute: Not enough memory is available to execute new process." << endl; - break; - default: - cerr << "execute: Unknown error" << endl; - foreach (const QString &arg, arguments) - cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; - break; - } - } - return exitCode; -} - -QT_END_NAMESPACE diff --git a/tools/configure/environment.h b/tools/configure/environment.h deleted file mode 100644 index 65ddc60eff..0000000000 --- a/tools/configure/environment.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qstringlist.h> - -QT_BEGIN_NAMESPACE - - -enum Compiler { - CC_UNKNOWN = 0, - CC_MINGW = 0x02, - CC_INTEL = 0x03, - CC_MSVC = 0x04 -}; - -struct CompilerInfo; -class Environment -{ -public: - static Compiler detectCompiler(); - static QString detectQMakeSpec(); - - static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv); - -private: - static Compiler detectedCompiler; - - static CompilerInfo *compilerInfo(Compiler compiler); -}; - - -QT_END_NAMESPACE diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp deleted file mode 100644 index c6b555d14d..0000000000 --- a/tools/configure/main.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* -** Configure tool -** -*/ - -#include "configureapp.h" - -QT_BEGIN_NAMESPACE - -int runConfigure( int argc, char** argv ) -{ - Configure app( argc, argv ); - if (!app.isOk()) - return 3; - - app.parseCmdLine(); - if (!app.isOk()) - return 3; - - // Bootstrapped includes. Needed by qmake. - app.generateHeaders(); - if (!app.isOk()) - return 3; - - // Bootstrap qmake. Needed by config tests. - app.buildQmake(); - if (!app.isOk()) - return 3; - - // run qmake based configure - app.configure(); - if (!app.isOk()) - return 3; - - return 0; -} - -QT_END_NAMESPACE - -int main( int argc, char** argv ) -{ - QT_USE_NAMESPACE - return runConfigure(argc, argv); -} |