Changeset 1030


Ignore:
Timestamp:
Aug 26, 2011, 7:48:22 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Remove suport for system-wide qt.conf files.

This turns not to be necessary. The new code is much simpler and has
less platform-dependent details. Note that hard-coded component paths
are now relative to the parent of the directory containing QtCore4.dll, not
to that directory itself as before. This in particular makes qt.conf not necessary
for the development builds at all.

For official (RPM) release builds, full hard-coded paths will be used so qt.conf
is not necessary at all. It will only be in use in portable ZIP distributions to
override these hard-coded paths of RPM builds.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.cmd

    r1020 r1030  
    350350    G.QT_INSTALL_EXAMPLES = ""
    351351    G.QT_INSTALL_DEMOS = ""
    352     G.QT_INSTALL_SYSCONFFILE = ""
    353352
    354353    G.QT_LIBINFIX = ""
     
    502501                    when (a == "-demosdir") then
    503502                        opt = 'P G.QT_INSTALL_DEMOS'
    504                     when (a == "-sysconffile") then
    505                         opt = 'P G.QT_INSTALL_SYSCONFFILE'
    506503
    507504                    when (a == "-nomake") then
     
    907904    --------------------------------------------------------------------------*/
    908905
     906    /* On OS/2 the hard-coded prefix path is given relative to the directory
     907     * where the module containing QLibraryInfo resides. This will be either a
     908     * directory of QtCore4.dll (normally) or a directory of the .EXE file (if
     909     * Qt is a static library). Therefore, setting QT_INSTALL_PREFIX to ".."
     910     * will make all other paths relative to the parent of that directory which
     911     * in development builds contains "bin", "include", "plugins", etc. In the
     912     * official release builds, these paths are hard-coded to the actually
     913     * used system directories. In portable builds these hard-coded paths are
     914     * overriden with qt.conf */
     915
    909916    /* prefix */
    910917    if (G.QT_INSTALL_PREFIX == "") then
    911         G.QT_INSTALL_PREFIX = "."
     918        G.QT_INSTALL_PREFIX = ".."
    912919    /* docs */
    913920    if (G.QT_INSTALL_DOCS == "") then
     
    10111018'/* Installation Info */'G.EOL
    10121019
    1013     if (G.QT_INSTALL_PREFIX == ".") then
    1014         /* make the prefix path be the directory where the module containing
    1015          * core Qt classes (in particular, QLibraryInfo) resides. Normally, it
    1016          * will be the path to QtCore4.DLL which is useful for separate Qt runtime
    1017          * distros that will have all components along in the same directory */
    1018         config_cpp_str = config_cpp_str||,
    1019 '#define QT_CONFIGURE_PREFIX_PATH qt_module_path()'G.EOL
    1020     else
    1021         config_cpp_str = config_cpp_str||,
    1022 '#define QT_CONFIGURE_PREFIX_PATH "'CPPPath(G.QT_INSTALL_PREFIX)'"'G.EOL
    1023 
    10241020    config_cpp_str = config_cpp_str||,
     1021'#define QT_CONFIGURE_PREFIX_PATH "'CPPPath(G.QT_INSTALL_PREFIX)'"'G.EOL||,
    10251022'#define QT_CONFIGURE_DOCUMENTATION_PATH "'CPPPath(G.QT_INSTALL_DOCS)'"'G.EOL||,
    10261023'#define QT_CONFIGURE_HEADERS_PATH "'CPPPath(G.QT_INSTALL_HEADERS)'"'G.EOL||,
     
    10351032'#define QT_CONFIGURE_DEMOS_PATH "'CPPPath(G.QT_INSTALL_DEMOS)'"'G.EOL
    10361033
    1037     if (G.QT_INSTALL_SYSCONFFILE \== '') then
    1038         config_cpp_str = config_cpp_str||,
    1039 '#define QT_CONFIGURE_QT_SYSCONF_FILE "'CPPPath(G.QT_INSTALL_SYSCONFFILE)'"'G.EOL
    1040 
    10411034    today = date('S')
    10421035    today = insert('-', today, 4)
     
    10551048        call charout qconfig_cpp
    10561049    end
    1057 
    1058     /* create qt.conf in the bin\ subdirectory with the correct paths to the
    1059      * Qt components we will build. This is necessary because the default paths
    1060      * in qconfig.cpp generated above will be relative to QtCore4.DLL while in
    1061      * the development environment they need to be relative to the output tree
    1062      * of the Qt library. Note that we also need to set Demos and Examples
    1063      * because for some strange reason they default to . when reading from a
    1064      * .conf file */
    1065     call MakeDir G.OutPath"\bin"
    1066     qt_conf = G.OutPath"\bin\qt.conf"
    1067     call DeleteFile qt_conf
    1068     call charout qt_conf,,
    1069         '[Paths]'G.EOL||,
    1070         'Prefix = ..'G.EOL||,
    1071         'Settings = $(ETC)/xdg'G.EOL||,
    1072         'Examples = examples'G.EOL||,
    1073         'Demos = demos'G.EOL
    1074     call charout qt_conf
    10751050
    10761051    /*--------------------------------------------------------------------------
  • trunk/doc/src/deployment/qt-conf.qdoc

    r846 r1030  
    4343    libraries look elsewhere.
    4444
    45         Note that on OS/2, the libraries do not use the hard-coded paths
    46         by default. Instead, they look for plugins and other components in a
    47         directory that contains the QtCore DLL library (or the application
    48         executable if Qt is built as a static library). This behavior may
    49         also be overridden using the \c qt.conf file.
    50    
    5145    QLibraryInfo will load \c qt.conf from one of the following locations:
    5246
     
    6155    QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
    6256
     57    \o on OS/2, in the directory containing the QtCore dynamic library
     58    (only after trying all of the above locations)
     59
    6360    \endlist
    6461
    65     On OS/2, if neither of the above locations contains \c qt.conf,
    66     QLibraryInfo will additionally try the following locations, in the
    67     given order:
    68 
    69     \list 1
    70 
    71     \o \c qt.conf in the directory containing the QtCore DLL library
    72     (or the application executable if Qt is built as a static library)
    73 
    74     \o hard-coded system-wide \c .conf file (if set by the given build
    75     of the Qt library)
    76    
    77     \o \c %ETC%\qt.conf
    78    
    79     \endlist
    80    
    8162    The \c qt.conf file is an INI text file, as described in the \l
    8263    {QSettings::Format}{QSettings} documentation. The file should have
  • trunk/qmake/option.cpp

    r847 r1030  
    774774QString qmake_libraryInfoFile()
    775775{
     776    // this is in sync with initBinaryDir() from tools/linguist/lrelease/main.cpp
    776777    QString ret;
    777778#if defined(Q_OS_WIN)
     
    788789        DosQueryModuleName(ppib->pib_hmte, sizeof(appFileName), appFileName);
    789790    }
    790     ret = QFileInfo(QString::fromLocal8Bit(appFileName)).absolutePath() +
    791                     QLatin1String("/qt.conf");
    792     if (!QFile::exists(ret)) {
    793         // search in the system-wide location
    794         ret = QString::fromLocal8Bit(qgetenv("ETC"));
    795         if (ret.isEmpty())
    796             ret = QDir::rootPath();
    797         ret = ret + QLatin1String("/qtsys.conf");
    798     }
    799     return QDir::cleanPath(ret);
     791    ret = QFileInfo(QString::fromLocal8Bit(appFileName)).filePath();
    800792#else
    801793    QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0));
     
    839831    ret = fi.exists() ? fi.canonicalFilePath() : QString();
    840832#endif
    841 #if !defined(Q_OS_OS2)
    842833    if(!ret.isEmpty())
    843834        ret = QDir(QFileInfo(ret).absolutePath()).filePath("qt.conf");
    844835    return ret;
    845 #endif
    846836}
    847837
  • trunk/src/corelib/global/qlibraryinfo.cpp

    r901 r1030  
    176176    if (!QFile::exists(qtconfig)) {
    177177        // search in the directory that contains the DLL or EXE where this
    178         // code is located (e.g. QtCore.dll or app.exe if Qt is a static lib)
     178        // code is located (e.g. QtCore4.dll or app.exe if Qt is a static lib)
    179179        qtconfig = QString::fromLocal8Bit(qt_module_path());
    180         qtconfig = QDir::fromNativeSeparators(qtconfig) +
    181                    QLatin1String("/qt.conf");
     180        qtconfig = QDir::fromNativeSeparators(qtconfig) + QLatin1String("/qt.conf");
    182181        qtconfig = QDir::cleanPath(qtconfig);
    183 
    184         if (!QFile::exists(qtconfig)) {
    185             // search in the system-wide location
    186 #ifdef QT_CONFIGURE_QT_SYSCONF_FILE
    187             qtconfig = expandEnvVars(QString::fromLocal8Bit(QT_CONFIGURE_QT_SYSCONF_FILE));
    188             if (!QFile::exists(qtconfig))
    189 #endif
    190             {
    191                 // search in %ETC% for backward compatibility
    192                 QString etc = QString::fromLocal8Bit(qgetenv("ETC"));
    193                 if (etc.isEmpty())
    194                     etc = QDir::rootPath();
    195                 etc = QDir::fromNativeSeparators(etc);
    196                 qtconfig = QDir::cleanPath(etc + QLatin1String("/qt.conf"));
    197                 if (!QFile::exists(qtconfig)) {
    198                     qtconfig = QDir::cleanPath(etc + QLatin1String("/qtsys.conf"));
    199                 }
    200             }
    201         }
    202182    }
    203183#endif
     
    516496
    517497#ifdef Q_OS_OS2
    518 
    519     // QDir::isRelativePath() isn't precise on OS/2 (see
    520     // QDir::absoluteFilePath()) therefore we don't rely on it
     498    // QDir::isRelativePath() isn't precise on OS/2 (see QDir::absoluteFilePath())
     499    // therefore we don't rely on it
    521500    if (loc == PrefixPath) {
    522501#ifdef BOOTSTRAPPING
     
    526505        QSettings *config = QLibraryInfoPrivate::configuration();
    527506        if (config) {
    528             // if we read paths from qt[sys].conf, the Prefix is relative to
    529             // the directory we load qt[sys].conf from
     507            // if we read paths from qt.conf, we make the prefix path absolute
     508            // to this file's directory
    530509            QFileInfo fi(config->fileName());
    531510            ret = QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
    532511        } else {
    533             // we make the prefix path absolute to the executable's directory
    534             if (QCoreApplication::instance()) {
    535                 ret = QDir::cleanPath(QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(ret));
    536             } else {
    537                 ret = QDir::current().absoluteFilePath(ret);
    538             }
     512            // otherwise we make the prefix path absolute to the DLL/EXE directory
     513            QString path = QString::fromLocal8Bit(qt_module_path());
     514            ret = QDir::cleanPath(QDir(path).absoluteFilePath(ret));
    539515        }
    540516#endif
     
    543519        ret = QDir::cleanPath(QDir(location(PrefixPath)).absoluteFilePath(ret));
    544520    }
    545 
    546521    return QDir::toNativeSeparators(ret);
    547 
    548522#else // Q_OS_OS2
    549 
    550523    if (QDir::isRelativePath(ret)) {
    551524        if (loc == PrefixPath) {
     
    577550    }
    578551    return QDir::cleanPath(ret);
    579 
    580552#endif // Q_OS_OS2
    581553}
  • trunk/tools/linguist/lrelease/main.cpp

    r846 r1030  
    329329        )
    330330{
     331    // this is in sync with qmake_libraryInfoFile() from qmake/option.cpp
    331332#ifdef Q_OS_WIN
    332333    wchar_t module_name[MAX_PATH];
     
    334335    QFileInfo filePath = QString::fromWCharArray(module_name);
    335336    binDir = filePath.filePath();
     337#elif defined(Q_OS_OS2)
     338    QFileInfo filePath;
     339    static char appFileName[CCHMAXPATH] = "\0";
     340    if (!appFileName[0]) {
     341        PPIB ppib;
     342        DosGetInfoBlocks(NULL, &ppib);
     343        DosQueryModuleName(ppib->pib_hmte, sizeof(appFileName), appFileName);
     344    }
     345    binDir = QFileInfo(QString::fromLocal8Bit(appFileName)).filePath();
    336346#else
    337347    QString argv0 = QFile::decodeName(QByteArray(_argv0));
Note: See TracChangeset for help on using the changeset viewer.