summaryrefslogtreecommitdiffstats
path: root/tools/configure
diff options
context:
space:
mode:
Diffstat (limited to 'tools/configure')
-rw-r--r--tools/configure/configureapp.cpp38
-rw-r--r--tools/configure/configureapp.h1
-rw-r--r--tools/configure/tools.cpp189
-rw-r--r--tools/configure/tools.h6
4 files changed, 40 insertions, 194 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index fddf99d2da..9cebe6682b 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3388,7 +3388,7 @@ void Configure::generateConfigfiles()
<< endl;
}
tmpStream << "/* License information */" << endl;
- tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
+ tmpStream << "#define QT_PRODUCT_LICENSEE \"" << dictionary[ "LICENSEE" ] << "\"" << endl;
tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
tmpStream << endl;
if (dictionary["BUILDDEV"] == "yes") {
@@ -3508,16 +3508,6 @@ void Configure::generateConfigfiles()
dictionary[ "DONE" ] = "error";
}
- if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL")) {
- FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig_eval.cpp");
-
- tmpStream << "/* Evaluation license key */" << endl
- << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
-
- if (!tmpStream.flush())
- dictionary[ "DONE" ] = "error";
- }
-
}
void Configure::displayConfig()
@@ -3542,10 +3532,10 @@ void Configure::displayConfig()
sout << " PATH=\n " << env << endl;
if (dictionary[QStringLiteral("EDITION")] != QStringLiteral("OpenSource")) {
- QString l1 = licenseInfo[ "LICENSEE" ];
- QString l2 = licenseInfo[ "LICENSEID" ];
+ QString l1 = dictionary[ "LICENSEE" ];
+ QString l2 = dictionary[ "LICENSEID" ];
QString l3 = dictionary["EDITION"] + ' ' + "Edition";
- QString l4 = licenseInfo[ "EXPIRYDATE" ];
+ QString l4 = dictionary[ "EXPIRYDATE" ];
sout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
sout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
sout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
@@ -3877,7 +3867,7 @@ void Configure::generateQConfigCpp()
{
FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.cpp");
tmpStream << "/* Licensed */" << endl
- << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
+ << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << dictionary["LICENSEE"] << "\";" << endl
<< "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
<< endl
<< "/* Build date */" << endl
@@ -4302,7 +4292,7 @@ void Configure::readLicense()
}
if (hasOpenSource && openSource) {
cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
- licenseInfo["LICENSEE"] = "Open Source";
+ dictionary["LICENSEE"] = "Open Source";
dictionary["EDITION"] = "OpenSource";
cout << endl;
if (!showLicense(dictionary["LICENSE FILE"])) {
@@ -4316,20 +4306,14 @@ void Configure::readLicense()
}
#ifdef COMMERCIAL_VERSION
else {
- Tools::checkLicense(dictionary, licenseInfo, firstLicensePath(), sourcePath);
- if (dictionary["DONE"] != "error") {
- // give the user some feedback, and prompt for license acceptance
- cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
- if (!showLicense(dictionary["LICENSE FILE"])) {
- cout << "Configuration aborted since license was not accepted";
- dictionary["DONE"] = "error";
- return;
- }
- }
+ Tools::checkLicense(dictionary, sourcePath, buildPath);
}
#else // !COMMERCIAL_VERSION
else {
- cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
+ cout << endl << "Error: This is the Open Source version of Qt."
+ << endl << "If you want to use Enterprise features of Qt,"
+ << endl << "use the contact form at http://qt.digia.com/contact-us"
+ << endl << "to purchase a license." << endl << endl;
dictionary["DONE"] = "error";
}
#endif
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 36668f18ba..e8de10dcf7 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -147,7 +147,6 @@ private:
QString sybase;
QString sybaseLibs;
- QMap<QString,QString> licenseInfo;
QString outputLine;
QTextStream outStream;
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
index 07c3c82a0b..e2a6f3cc8a 100644
--- a/tools/configure/tools.cpp
+++ b/tools/configure/tools.cpp
@@ -40,191 +40,56 @@
****************************************************************************/
#include "tools.h"
+#include "environment.h"
#include <qdir.h>
#include <qfile.h>
#include <qbytearray.h>
+#include <qstringlist.h>
-
-// std stuff ------------------------------------
#include <iostream>
-#include <windows.h>
-#include <conio.h>
-#define NUMBER_OF_PARTS 7
-std::ostream &operator<<(std::ostream &s, const QString &val); // defined in configureapp.cpp
+std::ostream &operator<<(std::ostream &s, const QString &val);
using namespace std;
-void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString> &licenseInfo,
- const QString &path, const QString &sourcePath)
+void Tools::checkLicense(QMap<QString,QString> &dictionary,
+ const QString &sourcePath, const QString &buildPath)
{
- QString tpLicense = sourcePath + "/LICENSE.PREVIEW.OPENSOURCE";
- if (QFile::exists(tpLicense)) {
- dictionary["EDITION"] = "Preview";
- dictionary["LICENSE FILE"] = tpLicense;
- return; // No license key checking in Tech Preview
- }
- tpLicense = sourcePath + "/LICENSE.PREVIEW.COMMERCIAL";
+ QString tpLicense = sourcePath + "/LICENSE.PREVIEW.COMMERCIAL";
if (QFile::exists(tpLicense)) {
dictionary["EDITION"] = "Preview";
dictionary["LICENSE FILE"] = tpLicense;
- return; // No license key checking in Tech Preview
- }
-
- // Read in the license file
- QFile licenseFile(path);
- if( !path.isEmpty() && licenseFile.open( QFile::ReadOnly ) ) {
- cout << "Reading license file in....." << qPrintable(path) << endl;
-
- QString buffer = licenseFile.readLine(1024);
- while (!buffer.isEmpty()) {
- if( buffer[ 0 ] != '#' ) {
- QStringList components = buffer.split( '=' );
- if ( components.size() >= 2 ) {
- QStringList::Iterator it = components.begin();
- QString key = (*it++).trimmed().remove('"').toUpper();
- QString value = (*it++).trimmed().remove('"');
- licenseInfo[ key ] = value;
- }
- }
- // read next line
- buffer = licenseFile.readLine(1024);
- }
- licenseFile.close();
- } else {
- cout << "License file not found in " << QDir::homePath() << endl;
- cout << "Please put the Qt license file, '.qt-license' in your home "
- << "directory and run configure again.";
- dictionary["DONE"] = "error";
- return;
- }
-
- // Verify license info...
- QString licenseKey = licenseInfo["LICENSEKEYEXT"];
- QByteArray clicenseKey = licenseKey.toLatin1();
- //We check the license
- static const char * const SEP = "-";
- char *licenseParts[NUMBER_OF_PARTS];
- int partNumber = 0;
- for (char *part = strtok(clicenseKey.data(), SEP); part != 0; part = strtok(0, SEP))
- licenseParts[partNumber++] = part;
- if (partNumber < (NUMBER_OF_PARTS-1)) {
- dictionary["DONE"] = "error";
- cout << "License file does not contain proper license key." <<partNumber<< endl;
return;
}
- char products = licenseParts[0][0];
- char* platforms = licenseParts[1];
- char* licenseSchema = licenseParts[2];
- char licenseFeatures = licenseParts[3][0];
+ const QString licenseChecker =
+ QDir::toNativeSeparators(sourcePath + "/bin/licheck.exe");
- // Determine edition ---------------------------------------------------------------------------
- QString licenseType;
- if (strcmp(licenseSchema,"F4M") == 0) {
- licenseType = "Commercial";
- if (products == 'F') {
- dictionary["EDITION"] = "Universal";
- } else if (products == 'B') {
- dictionary["EDITION"] = "FullFramework";
- } else {
- dictionary["EDITION"] = "GUIFramework";
- }
- } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) {
- if (products == 'B') {
- dictionary["EDITION"] = "Evaluation";
- licenseType = "Evaluation";
- }
- }
+ if (QFile::exists(licenseChecker)) {
+ const QString qMakeSpec =
+ QDir::toNativeSeparators(dictionary.value("QMAKESPEC"));
+ const QString xQMakeSpec =
+ QDir::toNativeSeparators(dictionary.value("XQMAKESPEC"));
- if (platforms[2] == 'L') {
- static const char src[] = "8NPQRTZ";
- static const char dst[] = "UCWX9M7";
- const char *p = strchr(src, platforms[1]);
- platforms[1] = dst[p - src];
- }
+ QString command = QString("%1 %2 %3 %4 %5")
+ .arg(licenseChecker,
+ QDir::toNativeSeparators(sourcePath),
+ QDir::toNativeSeparators(buildPath),
+ qMakeSpec, xQMakeSpec);
-#define PL(a,b) (int(a)+int(b)*256)
- int platformCode = PL(platforms[0],platforms[1]);
- switch (platformCode) {
- case PL('X','9'):
- case PL('X','C'):
- case PL('X','U'):
- case PL('X','W'):
- case PL('X','M'): // old license key
- dictionary["LICENSE_EXTENSION"] = "-ALLOS";
- break;
+ int returnValue = 0;
+ QString licheckOutput = Environment::execute(command, &returnValue);
- case PL('6', 'M'):
- case PL('8', 'M'):
- case PL('K', 'M'): // old license key
- case PL('N', '7'):
- case PL('N', '9'):
- case PL('N', 'X'):
- case PL('S', '9'):
- case PL('S', 'C'):
- case PL('S', 'U'):
- case PL('S', 'W'):
- dictionary["LICENSE_EXTENSION"] = "-EMBEDDED";
- if (dictionary["PLATFORM NAME"].contains("Windows CE")
- && platformCode != PL('6', 'M') && platformCode != PL('S', '9')
- && platformCode != PL('S', 'C') && platformCode != PL('S', 'U')
- && platformCode != PL('S', 'W') && platformCode != PL('K', 'M')) {
- dictionary["DONE"] = "error";
- }
- break;
- case PL('R', 'M'):
- case PL('F', 'M'):
- dictionary["LICENSE_EXTENSION"] = "-DESKTOP";
- if (!dictionary["PLATFORM NAME"].endsWith("Windows")) {
+ if (returnValue) {
dictionary["DONE"] = "error";
+ } else {
+ foreach (const QString &var, licheckOutput.split('\n'))
+ dictionary[var.section('=', 0, 0).toUpper()] = var.section('=', 1, 1);
}
- break;
- default:
- dictionary["DONE"] = "error";
- break;
- }
-#undef PL
-
- if (dictionary.value("DONE") == "error") {
- cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl;
- cout << "Please use the contact form at http://qt.digia.com/contact-us to upgrade your license" << endl;
- cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl;
- cout << "Qt Open Source Edition if you intend to develop free software." << endl;
- return;
- }
-
- // Override for evaluation licenses
- if (dictionary["EDITION"] == "Evaluation")
- dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
-
- if (QFile::exists(sourcePath + "/.LICENSE")) {
- // Generic, no-suffix license
- dictionary["LICENSE_EXTENSION"].clear();
- } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
- cout << "License file does not contain proper license key." << endl;
- dictionary["DONE"] = "error";
- }
- if (licenseType.isEmpty()
- || dictionary["EDITION"].isEmpty()) {
- cout << "License file does not contain proper license key." << endl;
- dictionary["DONE"] = "error";
- return;
- }
-
- // copy one of .LICENSE-*(-US) to LICENSE
- QString toLicenseFile = sourcePath + "/LICENSE";
- QString fromLicenseFile = sourcePath + "/.LICENSE" + dictionary["LICENSE_EXTENSION"];
- if (licenseFeatures == 'B' || licenseFeatures == 'G'
- || licenseFeatures == 'L' || licenseFeatures == 'Y')
- fromLicenseFile += "-US";
-
- if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
- (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) {
- cout << "Failed to copy license file (" << fromLicenseFile << ")";
+ } else {
+ cout << endl << "Error: Could not find licheck.exe" << endl
+ << "Try re-installing." << endl << endl;
dictionary["DONE"] = "error";
- return;
}
- dictionary["LICENSE FILE"] = toLicenseFile;
}
diff --git a/tools/configure/tools.h b/tools/configure/tools.h
index 888a5e07b5..719dae9b90 100644
--- a/tools/configure/tools.h
+++ b/tools/configure/tools.h
@@ -43,15 +43,13 @@
#define _TOOLS_H_
#include <qstring.h>
-#include <qstringlist.h>
#include <qmap.h>
-
class Tools
{
public:
- static void checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString> &licenseInfo,
- const QString &path, const QString &sourcePath);
+ static void checkLicense(QMap<QString,QString> &dictionary,
+ const QString &sourcePath, const QString &buildPath);
};
#endif // _TOOLS_H_