From 38be0d13830efd2d98281c645c3a60afe05ffece Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 12:05:43 +0200 Subject: Initial import from the monolithic Qt. This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12 --- tools/configure/configure.pro | 132 + tools/configure/configure_pch.h | 74 + tools/configure/configureapp.cpp | 4200 +++++++++++++ tools/configure/configureapp.h | 187 + tools/configure/environment.cpp | 516 ++ tools/configure/environment.h | 82 + tools/configure/main.cpp | 114 + tools/configure/tools.cpp | 249 + tools/configure/tools.h | 58 + tools/shared/symbian/epocroot.cpp | 227 + tools/shared/symbian/epocroot.pri | 11 + tools/shared/symbian/epocroot_p.h | 83 + tools/shared/windows/registry.cpp | 169 + tools/shared/windows/registry_p.h | 80 + tools/uilib/abstractformbuilder.cpp | 3209 ++++++++++ tools/uilib/abstractformbuilder.h | 290 + tools/uilib/container.h | 75 + tools/uilib/container.qdoc | 172 + tools/uilib/customwidget.h | 101 + tools/uilib/customwidget.qdoc | 295 + tools/uilib/formbuilder.cpp | 570 ++ tools/uilib/formbuilder.h | 115 + tools/uilib/formbuilderextra.cpp | 555 ++ tools/uilib/formbuilderextra_p.h | 262 + tools/uilib/formscriptrunner.cpp | 208 + tools/uilib/formscriptrunner_p.h | 120 + tools/uilib/properties.cpp | 681 +++ tools/uilib/properties_p.h | 176 + tools/uilib/qdesignerexportwidget.h | 66 + tools/uilib/resourcebuilder.cpp | 180 + tools/uilib/resourcebuilder_p.h | 104 + tools/uilib/textbuilder.cpp | 84 + tools/uilib/textbuilder_p.h | 93 + tools/uilib/ui4.cpp | 11154 ++++++++++++++++++++++++++++++++++ tools/uilib/ui4_p.h | 3807 ++++++++++++ tools/uilib/uilib.pri | 32 + tools/uilib/uilib_global.h | 64 + tools/uilib/widgets.table | 148 + 38 files changed, 28743 insertions(+) create mode 100644 tools/configure/configure.pro create mode 100644 tools/configure/configure_pch.h create mode 100644 tools/configure/configureapp.cpp create mode 100644 tools/configure/configureapp.h create mode 100644 tools/configure/environment.cpp create mode 100644 tools/configure/environment.h create mode 100644 tools/configure/main.cpp create mode 100644 tools/configure/tools.cpp create mode 100644 tools/configure/tools.h create mode 100644 tools/shared/symbian/epocroot.cpp create mode 100644 tools/shared/symbian/epocroot.pri create mode 100644 tools/shared/symbian/epocroot_p.h create mode 100644 tools/shared/windows/registry.cpp create mode 100644 tools/shared/windows/registry_p.h create mode 100644 tools/uilib/abstractformbuilder.cpp create mode 100644 tools/uilib/abstractformbuilder.h create mode 100644 tools/uilib/container.h create mode 100644 tools/uilib/container.qdoc create mode 100644 tools/uilib/customwidget.h create mode 100644 tools/uilib/customwidget.qdoc create mode 100644 tools/uilib/formbuilder.cpp create mode 100644 tools/uilib/formbuilder.h create mode 100644 tools/uilib/formbuilderextra.cpp create mode 100644 tools/uilib/formbuilderextra_p.h create mode 100644 tools/uilib/formscriptrunner.cpp create mode 100644 tools/uilib/formscriptrunner_p.h create mode 100644 tools/uilib/properties.cpp create mode 100644 tools/uilib/properties_p.h create mode 100644 tools/uilib/qdesignerexportwidget.h create mode 100644 tools/uilib/resourcebuilder.cpp create mode 100644 tools/uilib/resourcebuilder_p.h create mode 100644 tools/uilib/textbuilder.cpp create mode 100644 tools/uilib/textbuilder_p.h create mode 100644 tools/uilib/ui4.cpp create mode 100644 tools/uilib/ui4_p.h create mode 100644 tools/uilib/uilib.pri create mode 100644 tools/uilib/uilib_global.h create mode 100644 tools/uilib/widgets.table (limited to 'tools') diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro new file mode 100644 index 0000000000..124564667c --- /dev/null +++ b/tools/configure/configure.pro @@ -0,0 +1,132 @@ +TARGET = configure +DESTDIR = $$PWD/../.. # build directly in source dir + +CONFIG += console flat +CONFIG -= moc qt +DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE +DEFINES += QT_BOOTSTRAPPED + +win32 : LIBS += -lole32 -ladvapi32 +win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc +win32-g++* : LIBS += -luuid + +win32-msvc* { + QMAKE_CFLAGS_RELEASE -= -MD + QMAKE_CFLAGS_RELEASE += -MT + QMAKE_CFLAGS_DEBUG -= -MDd + QMAKE_CFLAGS_DEBUG += -MTd + QMAKE_CXXFLAGS_RELEASE -= -MD + QMAKE_CXXFLAGS_RELEASE += -MT + QMAKE_CXXFLAGS_DEBUG -= -MDd + QMAKE_CXXFLAGS_DEBUG += -MTd +} + +PRECOMPILED_HEADER = configure_pch.h + +INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/corelib/arch/generic \ + $$QT_SOURCE_TREE/src/corelib/global \ + $$QT_BUILD_TREE/include \ + $$QT_BUILD_TREE/include/QtCore \ + $$QT_SOURCE_TREE/tools/shared + +HEADERS = configureapp.h environment.h tools.h\ + $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.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/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/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/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/qstring.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 \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \ + $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h + + +SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qchar.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/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/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/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/qtextstream.cpp \ + $$QT_SOURCE_TREE/src/corelib/io/qtemporaryfile.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/qstring.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables.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/io/qurl.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qline.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qsize.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qpoint.cpp \ + $$QT_SOURCE_TREE/src/corelib/tools/qrect.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/tools/shared/symbian/epocroot.cpp \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp + +DEFINES += COMMERCIAL_VERSION + +INCLUDEPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \ + $$QT_SOURCE_TREE/include/QtCore \ + $$QT_SOURCE_TREE/tools/shared diff --git a/tools/configure/configure_pch.h b/tools/configure/configure_pch.h new file mode 100644 index 0000000000..3fe15f5952 --- /dev/null +++ b/tools/configure/configure_pch.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if (defined(_WIN32) || defined(__NT__)) +# define QT_UNDEF_MACROS_IN_PCH +# define _WINSCARD_H_ +# define _POSIX_ /* Make sure PATH_MAX et al. are defined */ +# include +# undef _POSIX_ /* Don't polute */ + + /* Make sure IP v6 is defined first of all, before windows.h */ +# ifndef QT_NO_IPV6 +# include +# endif +# include +#endif + +#if defined __cplusplus +#include +#include +#include // All moc genereated code has this include +#include +#include +#include +#include +#include + +#include +#include +#endif + +#if defined(QT_UNDEF_MACROS_IN_PCH) +# undef max /* These are defined in windef.h, but */ +# undef min /* we don't want them when building Qt */ +# undef _WINSCARD_H_ +#endif diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp new file mode 100644 index 0000000000..494ea52ec5 --- /dev/null +++ b/tools/configure/configureapp.cpp @@ -0,0 +1,4200 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "configureapp.h" +#include "environment.h" +#ifdef COMMERCIAL_VERSION +# include "tools.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +std::ostream &operator<<(std::ostream &s, const QString &val) { + s << val.toLocal8Bit().data(); + return s; +} + + +using namespace std; + +// Macros to simplify options marking +#define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " ) + + +bool writeToFile(const char* text, const QString &filename) +{ + QByteArray symFile(text); + QFile file(filename); + QDir dir(QFileInfo(file).absoluteDir()); + if (!dir.exists()) + dir.mkpath(dir.absolutePath()); + if (!file.open(QFile::WriteOnly)) { + cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString()) + << endl; + return false; + } + file.write(symFile); + return true; +} + +Configure::Configure(int& argc, char** argv) +{ + useUnixSeparators = false; + // Default values for indentation + optionIndent = 4; + descIndent = 25; + outputWidth = 0; + // Get console buffer output width + CONSOLE_SCREEN_BUFFER_INFO info; + HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + if (GetConsoleScreenBufferInfo(hStdout, &info)) + outputWidth = info.dwSize.X - 1; + outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable + if (outputWidth < 35) // Insanely small, just use 79 + outputWidth = 79; + int i; + + /* + ** Set up the initial state, the default + */ + dictionary[ "CONFIGCMD" ] = argv[ 0 ]; + + for (i = 1; i < argc; i++) + configCmdLine += argv[ i ]; + + + // 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 0 + const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR); +#else + const QString installPath = buildPath; +#endif + if (sourceDir != buildDir) { //shadow builds! + if (!findFile("perl") && !findFile("perl.exe")) { + cout << "Error: Creating a shadow build of Qt requires" << endl + << "perl to be in the PATH environment"; + exit(0); // Exit cleanly for Ctrl+C + } + + cout << "Preparing build tree..." << endl; + QDir(buildPath).mkpath("bin"); + + { //duplicate qmake + QStack qmake_dirs; + qmake_dirs.push("qmake"); + while (!qmake_dirs.isEmpty()) { + QString dir = qmake_dirs.pop(); + QString od(buildPath + "/" + dir); + QString id(sourcePath + "/" + dir); + QFileInfoList entries = QDir(id).entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries); + for (int i = 0; i < entries.size(); ++i) { + QFileInfo fi(entries.at(i)); + if (fi.isDir()) { + qmake_dirs.push(dir + "/" + fi.fileName()); + QDir().mkpath(od + "/" + fi.fileName()); + } else { + QDir().mkpath(od); + bool justCopy = true; + const QString fname = fi.fileName(); + const QString outFile(od + "/" + fname), inFile(id + "/" + fname); + if (fi.fileName() == "Makefile") { //ignore + } else if (fi.suffix() == "h" || fi.suffix() == "cpp") { + QTemporaryFile tmpFile; + if (tmpFile.open()) { + QTextStream stream(&tmpFile); + stream << "#include \"" << inFile << "\"" << endl; + justCopy = false; + stream.flush(); + tmpFile.flush(); + if (filesDiffer(tmpFile.fileName(), outFile)) { + QFile::remove(outFile); + tmpFile.copy(outFile); + } + } + } + if (justCopy && filesDiffer(inFile, outFile)) + QFile::copy(inFile, outFile); + } + } + } + } + + { //make a syncqt script(s) that can be used in the shadow + QFile syncqt(buildPath + "/bin/syncqt"); + if (syncqt.open(QFile::WriteOnly)) { + QTextStream stream(&syncqt); + stream << "#!/usr/bin/perl -w" << endl + << "require \"" << sourcePath + "/bin/syncqt\";" << endl; + } + QFile syncqt_bat(buildPath + "/bin/syncqt.bat"); + if (syncqt_bat.open(QFile::WriteOnly)) { + QTextStream stream(&syncqt_bat); + stream << "@echo off" << endl + << "set QTDIR=" << QDir::toNativeSeparators(sourcePath) << endl + << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -outdir \"") << fixSeparators(buildPath) << "\"" << endl + << "set QTDIR=" << QDir::toNativeSeparators(buildPath) << endl; + syncqt_bat.close(); + } + } + + // make patch_capabilities and createpackage scripts for Symbian that can be used from the shadow build + QFile patch_capabilities(buildPath + "/bin/patch_capabilities"); + if (patch_capabilities.open(QFile::WriteOnly)) { + QTextStream stream(&patch_capabilities); + stream << "#!/usr/bin/perl -w" << endl + << "require \"" << sourcePath + "/bin/patch_capabilities\";" << endl; + } + QFile patch_capabilities_bat(buildPath + "/bin/patch_capabilities.bat"); + if (patch_capabilities_bat.open(QFile::WriteOnly)) { + QTextStream stream(&patch_capabilities_bat); + stream << "@echo off" << endl + << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/patch_capabilities.bat %*") << endl; + patch_capabilities_bat.close(); + } + QFile createpackage(buildPath + "/bin/createpackage"); + if (createpackage.open(QFile::WriteOnly)) { + QTextStream stream(&createpackage); + stream << "#!/usr/bin/perl -w" << endl + << "require \"" << sourcePath + "/bin/createpackage\";" << endl; + } + QFile createpackage_bat(buildPath + "/bin/createpackage.bat"); + if (createpackage_bat.open(QFile::WriteOnly)) { + QTextStream stream(&createpackage_bat); + stream << "@echo off" << endl + << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/createpackage.bat %*") << endl; + createpackage_bat.close(); + } + + // For Windows CE and shadow builds we need to copy these to the + // build directory. + QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat"); + //copy the mkspecs + buildDir.mkpath("mkspecs"); + if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){ + cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl; + dictionary["DONE"] = "error"; + return; + } + } + + dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath); + dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath); + dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath); + + dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC"); + if (dictionary[ "QMAKESPEC" ].size() == 0) { + dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec(); + dictionary[ "QMAKESPEC_FROM" ] = "detected"; + } else { + dictionary[ "QMAKESPEC_FROM" ] = "env"; + } + + dictionary[ "ARCHITECTURE" ] = "windows"; + dictionary[ "QCONFIG" ] = "full"; + dictionary[ "EMBEDDED" ] = "no"; + dictionary[ "BUILD_QMAKE" ] = "yes"; + dictionary[ "DSPFILES" ] = "yes"; + dictionary[ "VCPROJFILES" ] = "yes"; + dictionary[ "QMAKE_INTERNAL" ] = "no"; + dictionary[ "FAST" ] = "no"; + dictionary[ "NOPROCESS" ] = "no"; + dictionary[ "STL" ] = "yes"; + dictionary[ "EXCEPTIONS" ] = "yes"; + dictionary[ "RTTI" ] = "yes"; + dictionary[ "MMX" ] = "auto"; + dictionary[ "3DNOW" ] = "auto"; + dictionary[ "SSE" ] = "auto"; + dictionary[ "SSE2" ] = "auto"; + dictionary[ "IWMMXT" ] = "auto"; + dictionary[ "SYNCQT" ] = "auto"; + dictionary[ "CE_CRT" ] = "no"; + dictionary[ "CETEST" ] = "auto"; + dictionary[ "CE_SIGNATURE" ] = "no"; + dictionary[ "SCRIPT" ] = "auto"; + dictionary[ "SCRIPTTOOLS" ] = "auto"; + dictionary[ "XMLPATTERNS" ] = "auto"; + dictionary[ "PHONON" ] = "auto"; + dictionary[ "PHONON_BACKEND" ] = "yes"; + dictionary[ "MULTIMEDIA" ] = "yes"; + dictionary[ "AUDIO_BACKEND" ] = "auto"; + dictionary[ "WMSDK" ] = "auto"; + dictionary[ "DIRECTSHOW" ] = "no"; + dictionary[ "WEBKIT" ] = "auto"; + dictionary[ "DECLARATIVE" ] = "auto"; + dictionary[ "DECLARATIVE_DEBUG" ]= "yes"; + dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; + dictionary[ "DIRECTWRITE" ] = "no"; + + QString version; + QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h"); + if (qglobal_h.open(QFile::ReadOnly)) { + QTextStream read(&qglobal_h); + QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\""); + QString line; + while (!read.atEnd()) { + line = read.readLine(); + if (version_regexp.exactMatch(line)) { + version = version_regexp.cap(1).trimmed(); + if (!version.isEmpty()) + break; + } + } + qglobal_h.close(); + } + + if (version.isEmpty()) + version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff); + + dictionary[ "VERSION" ] = version; + { + QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)"); + if (version_re.exactMatch(version)) { + dictionary[ "VERSION_MAJOR" ] = version_re.cap(1); + dictionary[ "VERSION_MINOR" ] = version_re.cap(2); + dictionary[ "VERSION_PATCH" ] = version_re.cap(3); + } + } + + dictionary[ "REDO" ] = "no"; + dictionary[ "DEPENDENCIES" ] = "no"; + + dictionary[ "BUILD" ] = "debug"; + dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly + + dictionary[ "BUILDTYPE" ] = "none"; + + dictionary[ "BUILDDEV" ] = "no"; + dictionary[ "BUILDNOKIA" ] = "no"; + + dictionary[ "SHARED" ] = "yes"; + + dictionary[ "ZLIB" ] = "auto"; + + dictionary[ "GIF" ] = "auto"; + dictionary[ "TIFF" ] = "auto"; + dictionary[ "JPEG" ] = "auto"; + dictionary[ "PNG" ] = "auto"; + dictionary[ "MNG" ] = "auto"; + dictionary[ "LIBTIFF" ] = "auto"; + dictionary[ "LIBJPEG" ] = "auto"; + dictionary[ "LIBPNG" ] = "auto"; + dictionary[ "LIBMNG" ] = "auto"; + dictionary[ "FREETYPE" ] = "no"; + + dictionary[ "QT3SUPPORT" ] = "yes"; + dictionary[ "ACCESSIBILITY" ] = "yes"; + dictionary[ "OPENGL" ] = "yes"; + dictionary[ "OPENVG" ] = "no"; + dictionary[ "IPV6" ] = "yes"; // Always, dynamically loaded + dictionary[ "OPENSSL" ] = "auto"; + dictionary[ "DBUS" ] = "auto"; + dictionary[ "S60" ] = "yes"; + + dictionary[ "STYLE_WINDOWS" ] = "yes"; + dictionary[ "STYLE_WINDOWSXP" ] = "auto"; + dictionary[ "STYLE_WINDOWSVISTA" ] = "auto"; + dictionary[ "STYLE_PLASTIQUE" ] = "yes"; + dictionary[ "STYLE_CLEANLOOKS" ]= "yes"; + dictionary[ "STYLE_WINDOWSCE" ] = "no"; + dictionary[ "STYLE_WINDOWSMOBILE" ] = "no"; + dictionary[ "STYLE_MOTIF" ] = "yes"; + dictionary[ "STYLE_CDE" ] = "yes"; + dictionary[ "STYLE_S60" ] = "no"; + dictionary[ "STYLE_GTK" ] = "no"; + + dictionary[ "SQL_MYSQL" ] = "no"; + dictionary[ "SQL_ODBC" ] = "no"; + dictionary[ "SQL_OCI" ] = "no"; + dictionary[ "SQL_PSQL" ] = "no"; + dictionary[ "SQL_TDS" ] = "no"; + dictionary[ "SQL_DB2" ] = "no"; + dictionary[ "SQL_SQLITE" ] = "auto"; + dictionary[ "SQL_SQLITE_LIB" ] = "qt"; + dictionary[ "SQL_SQLITE2" ] = "no"; + dictionary[ "SQL_IBASE" ] = "no"; + dictionary[ "GRAPHICS_SYSTEM" ] = "raster"; + + QString tmp = dictionary[ "QMAKESPEC" ]; + if (tmp.contains("\\")) { + tmp = tmp.mid(tmp.lastIndexOf("\\") + 1); + } else { + tmp = tmp.mid(tmp.lastIndexOf("/") + 1); + } + dictionary[ "QMAKESPEC" ] = tmp; + + dictionary[ "INCREDIBUILD_XGE" ] = "auto"; + dictionary[ "LTCG" ] = "no"; + dictionary[ "NATIVE_GESTURES" ] = "yes"; + dictionary[ "MSVC_MP" ] = "no"; +} + +Configure::~Configure() +{ + for (int i=0; i<3; ++i) { + QList items = makeList[i]; + for (int j=0; jremove("qconfig-").remove(".h"); + allConfigs << "full"; + + // Try internal configurations first. + QStringList possible_configs = QStringList() + << "minimal" + << "small" + << "medium" + << "large" + << "full"; + int index = possible_configs.indexOf(dictionary["QCONFIG"]); + if (index >= 0) { + for (int c = 0; c <= index; c++) { + qmakeConfig += possible_configs[c] + "-config"; + } + return; + } + + // If the internal configurations failed, try others. + QStringList::Iterator config; + for (config = allConfigs.begin(); config != allConfigs.end(); ++config) { + if ((*config) == dictionary[ "QCONFIG" ]) + break; + } + if (config == allConfigs.end()) { + dictionary[ "HELP" ] = "yes"; + cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ; + } + else + qmakeConfig += (*config) + "-config"; +} +#endif + + +// Output helper functions --------------------------------[ Start ]- +/*! + Determines the length of a string token. +*/ +static int tokenLength(const char *str) +{ + if (*str == 0) + return 0; + + const char *nextToken = strpbrk(str, " _/\n\r"); + if (nextToken == str || !nextToken) + return 1; + + return int(nextToken - str); +} + +/*! + Prints out a string which starts at position \a startingAt, and + indents each wrapped line with \a wrapIndent characters. + The wrap point is set to the console width, unless that width + cannot be determined, or is too small. +*/ +void Configure::desc(const char *description, int startingAt, int wrapIndent) +{ + int linePos = startingAt; + + bool firstLine = true; + const char *nextToken = description; + while (*nextToken) { + int nextTokenLen = tokenLength(nextToken); + if (*nextToken == '\n' // Wrap on newline, duh + || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth + { + printf("\n"); + linePos = 0; + firstLine = false; + if (*nextToken == '\n') + ++nextToken; + continue; + } + if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent + printf("%*s", wrapIndent , ""); + linePos = wrapIndent; + if (*nextToken == ' ') { + ++nextToken; + continue; + } + } + printf("%.*s", nextTokenLen, nextToken); + linePos += nextTokenLen; + nextToken += nextTokenLen; + } +} + +/*! + Prints out an option with its description wrapped at the + description starting point. If \a skipIndent is true, the + indentation to the option is not outputted (used by marked option + version of desc()). Extra spaces between option and its + description is filled with\a fillChar, if there's available + space. +*/ +void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar) +{ + if (!skipIndent) + printf("%*s", optionIndent, ""); + + int remaining = descIndent - optionIndent - strlen(option); + int wrapIndent = descIndent + qMax(0, 1 - remaining); + printf("%s", option); + + if (remaining > 2) { + printf(" "); // Space in front + for (int i = remaining; i > 2; --i) + printf("%c", fillChar); // Fill, if available space + } + printf(" "); // Space between option and description + + desc(description, wrapIndent, wrapIndent); + printf("\n"); +} + +/*! + Same as above, except it also marks an option with an '*', if + the option is default action. +*/ +void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar) +{ + const QString markedAs = dictionary.value(mark_option); + if (markedAs == "auto" && markedAs == mark) // both "auto", always => + + printf(" + "); + else if (markedAs == "auto") // setting marked as "auto" and option is default => + + printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' '); + else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => + + printf(" %c " , checkAvailability(mark_option) ? '+' : ' '); + else // None are "auto", (markedAs == mark) => * + printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' '); + + desc(option, description, true, fillChar); +} + +/*! + Modifies the default configuration based on given -platform option. + Eg. switches to different default styles for Windows CE. +*/ +void Configure::applySpecSpecifics() +{ + if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) { + dictionary[ "STYLE_WINDOWSXP" ] = "no"; + dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; + dictionary[ "STYLE_PLASTIQUE" ] = "no"; + dictionary[ "STYLE_CLEANLOOKS" ] = "no"; + dictionary[ "STYLE_WINDOWSCE" ] = "yes"; + dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes"; + dictionary[ "STYLE_MOTIF" ] = "no"; + dictionary[ "STYLE_CDE" ] = "no"; + dictionary[ "STYLE_S60" ] = "no"; + dictionary[ "FREETYPE" ] = "no"; + dictionary[ "QT3SUPPORT" ] = "no"; + dictionary[ "OPENGL" ] = "no"; + dictionary[ "OPENSSL" ] = "no"; + dictionary[ "STL" ] = "no"; + dictionary[ "EXCEPTIONS" ] = "no"; + dictionary[ "RTTI" ] = "no"; + dictionary[ "ARCHITECTURE" ] = "windowsce"; + dictionary[ "3DNOW" ] = "no"; + dictionary[ "SSE" ] = "no"; + dictionary[ "SSE2" ] = "no"; + dictionary[ "MMX" ] = "no"; + dictionary[ "IWMMXT" ] = "no"; + dictionary[ "CE_CRT" ] = "yes"; + dictionary[ "WEBKIT" ] = "no"; + dictionary[ "PHONON" ] = "yes"; + dictionary[ "DIRECTSHOW" ] = "no"; + // We only apply MMX/IWMMXT for mkspecs we know they work + if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) { + dictionary[ "MMX" ] = "yes"; + dictionary[ "IWMMXT" ] = "yes"; + dictionary[ "DIRECTSHOW" ] = "yes"; + } + dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; + dictionary[ "QT_INSTALL_PREFIX" ] = ""; + + } else if (dictionary[ "XQMAKESPEC" ].startsWith("symbian")) { + dictionary[ "ACCESSIBILITY" ] = "no"; + dictionary[ "STYLE_WINDOWSXP" ] = "no"; + dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; + dictionary[ "STYLE_PLASTIQUE" ] = "no"; + dictionary[ "STYLE_CLEANLOOKS" ] = "no"; + dictionary[ "STYLE_WINDOWSCE" ] = "no"; + dictionary[ "STYLE_WINDOWSMOBILE" ] = "no"; + dictionary[ "STYLE_MOTIF" ] = "no"; + dictionary[ "STYLE_CDE" ] = "no"; + dictionary[ "STYLE_S60" ] = "yes"; + dictionary[ "FREETYPE" ] = "no"; + dictionary[ "QT3SUPPORT" ] = "no"; + dictionary[ "OPENGL" ] = "no"; + dictionary[ "OPENSSL" ] = "yes"; + // On Symbian we now always will have IPv6 with no chance to disable it + dictionary[ "IPV6" ] = "yes"; + dictionary[ "STL" ] = "yes"; + dictionary[ "EXCEPTIONS" ] = "yes"; + dictionary[ "RTTI" ] = "yes"; + dictionary[ "ARCHITECTURE" ] = "symbian"; + dictionary[ "3DNOW" ] = "no"; + dictionary[ "SSE" ] = "no"; + dictionary[ "SSE2" ] = "no"; + dictionary[ "MMX" ] = "no"; + dictionary[ "IWMMXT" ] = "no"; + dictionary[ "CE_CRT" ] = "no"; + dictionary[ "DIRECT3D" ] = "no"; + dictionary[ "WEBKIT" ] = "yes"; + dictionary[ "ASSISTANT_WEBKIT" ] = "no"; + dictionary[ "PHONON" ] = "yes"; + dictionary[ "XMLPATTERNS" ] = "yes"; + dictionary[ "QT_GLIB" ] = "no"; + dictionary[ "S60" ] = "yes"; + dictionary[ "SYMBIAN_DEFFILES" ] = "yes"; + // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested) + // iconv_open seems to return -1 always, so something is probably missing from the platform. + dictionary[ "QT_ICONV" ] = "no"; + dictionary[ "SCRIPTTOOLS" ] = "no"; + dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; + dictionary[ "QT_INSTALL_PREFIX" ] = ""; + dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins"; + dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports"; + dictionary[ "QT_INSTALL_TRANSLATIONS" ] = "\\resource\\qt\\translations"; + dictionary[ "ARM_FPU_TYPE" ] = "softvfp"; + dictionary[ "SQL_SQLITE" ] = "yes"; + dictionary[ "SQL_SQLITE_LIB" ] = "system"; + + // Disable building docs and translations for now + disabledBuildParts << "docs" << "translations"; + + } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong. + //TODO + dictionary[ "STYLE_WINDOWSXP" ] = "no"; + dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; + dictionary[ "KBD_DRIVERS" ] = "tty"; + dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc"; + dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp"; + dictionary[ "QT3SUPPORT" ] = "no"; + dictionary[ "OPENGL" ] = "no"; + dictionary[ "EXCEPTIONS" ] = "no"; + dictionary[ "DBUS"] = "no"; + dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32"; + dictionary[ "QT_SXE" ] = "no"; + dictionary[ "QT_INOTIFY" ] = "no"; + dictionary[ "QT_LPR" ] = "no"; + dictionary[ "QT_CUPS" ] = "no"; + dictionary[ "QT_GLIB" ] = "no"; + dictionary[ "QT_ICONV" ] = "no"; + + dictionary["DECORATIONS"] = "default windows styled"; + } +} + +QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths) +{ + QDir d; + for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) { + // Remove any leading or trailing ", this is commonly used in the environment + // variables + QString path = (*it); + if (path.startsWith("\"")) + path = path.right(path.length() - 1); + if (path.endsWith("\"")) + path = path.left(path.length() - 1); + if (d.exists(path + QDir::separator() + fileName)) { + return (path); + } + } + return QString(); +} + +QString Configure::locateFile(const QString &fileName) +{ + QString file = fileName.toLower(); + QStringList paths; +#if defined(Q_OS_WIN32) + QRegExp splitReg("[;,]"); +#else + QRegExp splitReg("[:]"); +#endif + if (file.endsWith(".h")) + paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts); + else if (file.endsWith(".lib")) + paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts); + else + paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts); + return locateFileInPaths(file, paths); +} + +// Output helper functions ---------------------------------[ Stop ]- + + +bool Configure::displayHelp() +{ + if (dictionary[ "HELP" ] == "yes") { + desc("Usage: configure [-buildkey ]\n" +// desc("Usage: configure [-prefix dir] [-bindir ] [-libdir ]\n" +// "[-docdir ] [-headerdir ] [-plugindir ]\n" +// "[-importdir ] [-datadir ] [-translationdir ]\n" +// "[-examplesdir ] [-demosdir ][-buildkey ]\n" + "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n" + "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n" + "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n" + "[-no-stl] [-stl] [-no-sql-] [-qt-sql-]\n" + "[-plugin-sql-] [-system-sqlite] [-arch ]\n" + "[-D ] [-I ] [-L ]\n" + "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n" + "[-no-qmake] [-qmake] [-dont-process] [-process]\n" + "[-no-style-