Changeset 357 for trunk


Ignore:
Timestamp:
Nov 28, 2009, 8:49:40 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Make the Qt library portable on OS/2 by replacing hard-coded paths with paths relative to the QtCore DLL (or the application executable if Qt is built as a static library). Add two new locations to search for qt.conf/qtsys.conf for providing more portability and easier system integration. See #78 for more details.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.cmd

    r315 r357  
    299299    G.CFG_GRAPHICS_SYSTEM = "default"
    300300
    301     /* initalize variables used for installation */
     301    /* */
    302302    G.QT_INSTALL_PREFIX = ""
    303303    G.QT_INSTALL_DOCS = ""
     
    545545    /* prefix */
    546546    if (G.QT_INSTALL_PREFIX == "") then
    547         G.QT_INSTALL_PREFIX = G.OutPath
     547        G.QT_INSTALL_PREFIX =
    548548    /* docs */
    549549    if (G.QT_INSTALL_DOCS == "") then
    550         G.QT_INSTALL_DOCS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\docs"
     550        G.QT_INSTALL_DOCS = "
    551551    /* headers */
    552552    if (G.QT_INSTALL_HEADERS == "") then
    553         G.QT_INSTALL_HEADERS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\include"
     553        G.QT_INSTALL_HEADERS = include"
    554554    /* libs */
    555555    if (G.QT_INSTALL_LIBS == "") then
    556         G.QT_INSTALL_LIBS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\lib"
     556        G.QT_INSTALL_LIBS = lib"
    557557    /* bins */
    558558    if (G.QT_INSTALL_BINS == "") then
    559         G.QT_INSTALL_BINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\bin"
     559        G.QT_INSTALL_BINS = bin"
    560560    /* plugins */
    561561    if (G.QT_INSTALL_PLUGINS == "") then
    562         G.QT_INSTALL_PLUGINS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\plugins"
     562        G.QT_INSTALL_PLUGINS = plugins"
    563563    /* data */
    564564    if (G.QT_INSTALL_DATA == "") then
    565         G.QT_INSTALL_DATA = FixDirNoSlash(G.QT_INSTALL_PREFIX)
     565        G.QT_INSTALL_DATA =
    566566    /* translations */
    567567    if (G.QT_INSTALL_TRANSLATIONS == "") then
    568         G.QT_INSTALL_TRANSLATIONS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\translations"
     568        G.QT_INSTALL_TRANSLATIONS = translations"
    569569    /* settings */
    570570    if (G.QT_INSTALL_SETTINGS == "") then
    571         G.QT_INSTALL_SETTINGS = SysBootDrive()"\OS2\xdg"
     571        G.QT_INSTALL_SETTINGS = "
    572572    /* examples */
    573573    if (G.QT_INSTALL_EXAMPLES == "") then
    574         G.QT_INSTALL_EXAMPLES = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\examples"
     574        G.QT_INSTALL_EXAMPLES = examples"
    575575    /* demos */
    576576    if (G.QT_INSTALL_DEMOS == "") then
    577         G.QT_INSTALL_DEMOS = FixDirNoSlash(G.QT_INSTALL_PREFIX)"\demos"
     577        G.QT_INSTALL_DEMOS = demos"
    578578
    579579    /*--------------------------------------------------------------------------
     
    634634    --------------------------------------------------------------------------*/
    635635
    636     if (\DirExists(G.OutPath"\src\corelib\global")) then
    637         call MakeDir G.OutPath"\src\corelib\global"
     636    call MakeDir G.OutPath"\src\corelib\global"
    638637
    639638    qconfig_cpp = G.OutPath"\src\corelib\global\qconfig.cpp"
     
    641640    config_cpp_str =,
    642641'/* License Info */'G.EOL||,
    643 'static const char qt_configure_licensee_str          [260 + 12] = "qt_lcnsuser='CPPPath(MaxLen(G.Licensee,259))'";'G.EOL||,
    644 'static const char qt_configure_licensed_products_str [260 + 12] = "qt_lcnsprod='CPPPath(MaxLen(G.Edition,259))'";'G.EOL||,
    645 '/* Installation Info */'G.EOL||,
    646 'static const char qt_configure_prefix_path_str       [260 + 12] = "qt_prfxpath='CPPPath(MaxLen(G.QT_INSTALL_PREFIX,259))'";'G.EOL||,
    647 'static const char qt_configure_documentation_path_str[260 + 12] = "qt_docspath='CPPPath(MaxLen(G.QT_INSTALL_DOCS,259))'";'G.EOL||,
    648 'static const char qt_configure_headers_path_str      [260 + 12] = "qt_hdrspath='CPPPath(MaxLen(G.QT_INSTALL_HEADERS,259))'";'G.EOL||,
    649 'static const char qt_configure_libraries_path_str    [260 + 12] = "qt_libspath='CPPPath(MaxLen(G.QT_INSTALL_LIBS,259))'";'G.EOL||,
    650 'static const char qt_configure_binaries_path_str     [260 + 12] = "qt_binspath='CPPPath(MaxLen(G.QT_INSTALL_BINS,259))'";'G.EOL||,
    651 'static const char qt_configure_plugins_path_str      [260 + 12] = "qt_plugpath='CPPPath(MaxLen(G.QT_INSTALL_PLUGINS,259))'";'G.EOL||,
    652 'static const char qt_configure_data_path_str         [260 + 12] = "qt_datapath='CPPPath(MaxLen(G.QT_INSTALL_DATA,259))'";'G.EOL||,
    653 'static const char qt_configure_translations_path_str [260 + 12] = "qt_trnspath='CPPPath(MaxLen(G.QT_INSTALL_TRANSLATIONS,259))'";'G.EOL||,
    654 'static const char qt_configure_settings_path_str     [260 + 12] = "qt_stngpath='CPPPath(MaxLen(G.QT_INSTALL_SETTINGS,259))'";'G.EOL||,
    655 'static const char qt_configure_examples_path_str     [260 + 12] = "qt_xmplpath='CPPPath(MaxLen(G.QT_INSTALL_EXAMPLES,259))'";'G.EOL||,
    656 'static const char qt_configure_demos_path_str        [260 + 12] = "qt_demopath='CPPPath(MaxLen(G.QT_INSTALL_DEMOS,259))'";'G.EOL||,
    657 '/* strlen( "qt_lcnsxxxx" ) == 12 */'G.EOL||,
    658 '#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;'G.EOL||,
    659 '#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;'G.EOL||,
    660 '#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;'G.EOL||,
    661 '#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;'G.EOL||,
    662 '#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;'G.EOL||,
    663 '#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;'G.EOL||,
    664 '#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;'G.EOL||,
    665 '#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;'G.EOL||,
    666 '#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;'G.EOL||,
    667 '#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;'G.EOL||,
    668 '#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;'G.EOL||,
    669 '#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;'G.EOL||,
    670 '#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;'G.EOL||,
     642'#define QT_CONFIGURE_LICENSEE "'CPPPath(MaxLen(G.Licensee,259))'"'G.EOL||,
     643'#define QT_CONFIGURE_LICENSED_PRODUCTS "'CPPPath(MaxLen(G.Edition,259))'"'G.EOL||,
     644'/* Installation Info */'G.EOL
     645
     646    if (G.QT_INSTALL_PREFIX == ".") then
     647        /* make the prefix path be the directory where the module containing
     648         * core Qt classes (in particular, QLibraryInfo) resides. Normally, it
     649         * will be the path to QtCore4.DLL which is useful for separate Qt runtime
     650         * distros that will have all components along in the same directory */
     651        config_cpp_str = config_cpp_str||,
     652'#define QT_CONFIGURE_PREFIX_PATH qt_module_path()'G.EOL
     653    else
     654        config_cpp_str = config_cpp_str||,
     655'#define QT_CONFIGURE_PREFIX_PATH "'CPPPath(G.QT_INSTALL_PREFIX)'"'G.EOL
     656
     657    config_cpp_str = config_cpp_str||,
     658'#define QT_CONFIGURE_DOCUMENTATION_PATH "'CPPPath(G.QT_INSTALL_DOCS)'"'G.EOL||,
     659'#define QT_CONFIGURE_HEADERS_PATH "'CPPPath(G.QT_INSTALL_HEADERS)'"'G.EOL||,
     660'#define QT_CONFIGURE_LIBRARIES_PATH "'CPPPath(G.QT_INSTALL_LIBS)'"'G.EOL||,
     661'#define QT_CONFIGURE_BINARIES_PATH "'CPPPath(G.QT_INSTALL_BINS)'"'G.EOL||,
     662'#define QT_CONFIGURE_PLUGINS_PATH "'CPPPath(G.QT_INSTALL_PLUGINS)'"'G.EOL||,
     663'#define QT_CONFIGURE_DATA_PATH "'CPPPath(G.QT_INSTALL_DATA)'"'G.EOL||,
     664'#define QT_CONFIGURE_TRANSLATIONS_PATH "'CPPPath(G.QT_INSTALL_TRANSLATIONS)'"'G.EOL||,
     665'#define QT_CONFIGURE_SETTINGS_PATH "'CPPPath(G.QT_INSTALL_SETTINGS)'"'G.EOL||,
     666'#define QT_CONFIGURE_EXAMPLES_PATH "'CPPPath(G.QT_INSTALL_EXAMPLES)'"'G.EOL||,
     667'#define QT_CONFIGURE_DEMOS_PATH "'CPPPath(G.QT_INSTALL_DEMOS)'"'G.EOL||,
    671668G.EOL
    672669
     
    679676        call charout qconfig_cpp
    680677    end
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
    681688
    682689    /*--------------------------------------------------------------------------
     
    18291836
    18301837MakeDir: procedure expose (Globals)
    1831     /* @todo teach it to create all non-existing intermediate dirs */
    18321838    parse arg aDir
    1833     rc = SysMkDir(aDir)
    1834     if (rc \= 0) then do
    1835         call SayErr 'FATAL: Could not create directory '''aDir'''!'
    1836         call SayErr 'SysMkDir returned 'rc
    1837         call Done 1
     1839    aDir = translate(aDir, '\', '/')
     1840    curdir = directory()
     1841    base = aDir
     1842    todo.0 = 0
     1843    do while 1
     1844        d = directory(base)
     1845        if (d \== '') then
     1846            leave
     1847        i = todo.0 + 1
     1848        todo.i = filespec('N', base)
     1849        todo.0 = i
     1850        drv = filespec('D', base)
     1851        path = filespec('P', base)
     1852        if (path == '\' | path == '') then do
     1853            base = drv||path
     1854            leave
     1855        end
     1856        base = drv||strip(path, 'T', '\')
     1857    end
     1858    call directory curdir
     1859    do i = todo.0 to 1 by -1
     1860        if (i < todo.0 | (base \== '' & right(base,1) \== '\' &,
     1861                                        right(base,1) \== ':')) then
     1862            base = base'\'
     1863        base = base||todo.i
     1864        rc = SysMkDir(base)
     1865        if (rc \= 0) then do
     1866            call SayErr 'FATAL: Could not create directory '''base'''!'
     1867            call SayErr 'SysMkDir returned 'rc
     1868            call Done 1
     1869        end
    18381870    end
    18391871    return
     
    22382270
    22392271/**
    2240  *  Returns the name of the temporary directory.
     2272 *  Returns the the temporary directory.
    22412273 *  The returned value doesn't end with a slash.
    22422274 */
  • trunk/doc/src/qt-conf.qdoc

    r2 r357  
    5858    libraries look elsewhere.
    5959
     60
     61
     62
     63
     64
     65
    6066    QLibraryInfo will load \c qt.conf from one of the following locations:
    6167
     
    7278    \endlist
    7379
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
    7492    The \c qt.conf file is an INI text file, as described in the \l
    7593    {QSettings::Format}{QSettings} documentation. The file should have
     
    106124    need to be placed in specific sub-directories under the
    107125    \c{plugins} directory (see \l{How to Create Qt Plugins} for
    108     details).
    109 
     126    details). On OS/2, the \c Prefix is always relative to the directory
     127    where \c qt.conf or \c qtsys.conf is loaded from.
     128   
    110129    For example, a \c qt.conf file could contain the following:
    111130
  • trunk/src/corelib/global/qlibraryinfo.cpp

    r2 r357  
    4141
    4242#include "qdir.h"
    43 #include "qfile.h"   
     43#include "qfile.h"
    4444#include "qconfig.h"
    4545#include "qsettings.h"
     
    5858#  include "private/qcore_mac_p.h"
    5959#endif
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
    6082
    6183#include "qconfig.cpp"
     
    137159                qtconfig = pwd.filePath(QLatin1String("qt.conf"));
    138160            }
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
    139181    }
    140182#endif
     
    296338        }
    297339
    298         if (path)
     340        if (path)
    299341            ret = QString::fromLocal8Bit(path);
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
    300354    } else {
    301355        QString key;
     
    431485            // we make the prefix path absolute to the executable's directory
    432486#ifdef QT_BUILD_QMAKE
    433             return QFileInfo(qmake_libraryInfoFile()).absolutePath();
     487            QFileInfo fi(qmake_libraryInfoFile());
     488            return QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
    434489#else
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
    435500            if (QCoreApplication::instance()) {
    436501#ifdef Q_OS_MAC
     
    444509                }
    445510#endif
    446                 return QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(ret);
     511                return QDir);
    447512            } else {
    448513                return QDir::current().absoluteFilePath(ret);
     
    451516        } else {
    452517            // we make any other path absolute to the prefix directory
    453             return QDir(location(PrefixPath)).absoluteFilePath(ret);
     518            return QDir);
    454519        }
    455520    }
    456     return ret;
     521    return ;
    457522}
    458523
Note: See TracChangeset for help on using the changeset viewer.