diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-17 19:13:04 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-18 16:10:38 (GMT) |
commit | d1779085462e7050a32e2f785767b4ce0d0cbfe0 (patch) | |
tree | 3e4e013ee4ebd1bdffedb1ceaaaeace75ce4fabc | |
parent | 62e1db5793f9395e39091757135f4d96e564e6c2 (diff) | |
download | Qt-d1779085462e7050a32e2f785767b4ce0d0cbfe0.zip Qt-d1779085462e7050a32e2f785767b4ce0d0cbfe0.tar.gz Qt-d1779085462e7050a32e2f785767b4ce0d0cbfe0.tar.bz2 |
configure.exe: Update to the new licensing structure.
Add support for Symbian commercial licenses and adapt to the
possibility from the RT operating systems
Task-number: QT-2518
Reviewed-by: axis
-rw-r--r-- | tools/configure/tools.cpp | 92 |
1 files changed, 66 insertions, 26 deletions
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index c958dd9..1eeb212 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -131,7 +131,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString } char products = licenseParts[0][0]; - char platforms = licenseParts[1][0]; + char* platforms = licenseParts[1]; char* licenseSchema = licenseParts[2]; char licenseFeatures = licenseParts[3][0]; @@ -149,22 +149,76 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString dictionary["EDITION"] = "GUIFramework"; dictionary["QT_EDITION"] = "QT_EDITION_DESKTOPLIGHT"; } - - if (platforms == 'X') { - dictionary["LICENSE_EXTENSION"] = "-ALLOS"; - } else if (strchr("2346789ABCDEGHJKMPQSTUVWX", platforms)) { - dictionary["LICENSE_EXTENSION"] = "-EMBEDDED"; - } else if (strchr("4BFPQRTY", platforms)) { - dictionary["LICENSE_EXTENSION"] = "-DESKTOP"; - } } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) { if (products == 'B') { dictionary["EDITION"] = "Evaluation"; dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION"; - dictionary["LICENSE_EXTENSION"] = "-EVALUATION"; } } + 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); + } + +#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'): + dictionary["LICENSE_EXTENSION"] = "-ALLOS"; + break; + case PL('6', 'M'): + case PL('8', 'M'): + 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')) { + dictionary["DONE"] = "error"; + } else if (dictionary["PLATFORM NAME"].contains("Symbian") + && platformCode != PL('N', '9') && platformCode != PL('S', '9,') + && platformCode != PL('S', 'C') && platformCode != PL('S', 'UCWX9M7') + && platformCode != PL('S', 'W')) { + dictionary["DONE"] = "error"; + } + break; + case PL('R', 'M'): + case PL('F', 'M'): + dictionary["LICENSE_EXTENSION"] = "-DESKTOP"; + if (!dictionary["PLATFORM NAME"].endsWith("Windows")) { + dictionary["DONE"] = "error"; + } + break; + default: + dictionary["DONE"] = "error"; + return; + } +#undef PL + + if (dictionary.value("DONE") == "error") { + cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl; + cout << "Please contact qt-info@nokia.com 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(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) { // Generic, no-suffix license dictionary["LICENSE_EXTENSION"] = QString(); @@ -180,27 +234,13 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString return; } - if (dictionary["PLATFORM NAME"].contains("Windows CE")) { - // verify that we are licensed to use Qt for Windows CE - if (dictionary["LICENSE_EXTENSION"] != "-EMBEDDED" && dictionary["LICENSE_EXTENSION"] != "-ALLOS") { - cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl; - cout << "Please contact qt-info@nokia.com 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; - dictionary["DONE"] = "error"; - return; - } - } - // copy one of .LICENSE-*(-US) to LICENSE QString toLicenseFile = dictionary["QT_SOURCE_TREE"] + "/LICENSE"; QString fromLicenseFile = dictionary["QT_SOURCE_TREE"] + "/.LICENSE" + dictionary["LICENSE_EXTENSION"]; - if (licenseFeatures == 'G') //US + if (licenseFeatures == 'B' || licenseFeatures == 'G' + || licenseFeatures == 'L' || licenseFeatures == 'Y') fromLicenseFile += "-US"; - if (licenseFeatures == '5') //Floating - dictionary["METERED LICENSE"] = "true"; - if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(), (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) { cout << "Failed to copy license file (" << fromLicenseFile << ")"; |