summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp12
-rw-r--r--src/corelib/io/qdatastream.cpp2
-rw-r--r--src/corelib/io/qdatastream.h2
-rw-r--r--src/corelib/io/qdatastream_p.h2
-rw-r--r--src/corelib/tools/qbytearray.cpp4
-rw-r--r--src/corelib/tools/qbytearray.h2
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/tools/bootstrap/bootstrap.pri2
-rw-r--r--src/tools/bootstrap/bootstrap.pro8
-rw-r--r--tools/configure/configureapp.cpp3
-rw-r--r--tools/linguist/lrelease/lrelease.pro11
-rw-r--r--tools/linguist/lrelease/main.cpp96
-rw-r--r--tools/linguist/shared/proparserutils.h25
-rw-r--r--tools/linguist/shared/qm.cpp2
-rw-r--r--tools/linguist/shared/translator.cpp10
-rw-r--r--tools/linguist/shared/translator.h12
18 files changed, 170 insertions, 29 deletions
diff --git a/configure b/configure
index aab520e..e5bc013 100755
--- a/configure
+++ b/configure
@@ -7688,7 +7688,7 @@ for file in .projects .projects.3; do
*s60main/s60main.pro) continue ;;
*examples/activeqt/*) continue ;;
*/qmake/qmake.pro) continue ;;
- *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
+ *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*linguist/lrelease*) SPEC=$QMAKESPEC ;;
*) SPEC=$XQMAKESPEC ;;
esac
dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 15325ae..77a86bb 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -46,7 +46,11 @@
#include "qlibraryinfo.h"
#include "qscopedpointer.h"
-#ifdef QT_BUILD_QMAKE
+#if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED)
+# define BOOTSTRAPPING
+#endif
+
+#ifdef BOOTSTRAPPING
QT_BEGIN_NAMESPACE
extern QString qmake_libraryInfoFile();
QT_END_NAMESPACE
@@ -91,7 +95,7 @@ public:
QLibrarySettings::QLibrarySettings()
: settings(QLibraryInfoPrivate::findConfiguration())
{
-#ifndef QT_BUILD_QMAKE
+#ifndef BOOTSTRAPPING
qAddPostRoutine(QLibraryInfoPrivate::cleanup);
#endif
}
@@ -99,7 +103,7 @@ QLibrarySettings::QLibrarySettings()
QSettings *QLibraryInfoPrivate::findConfiguration()
{
QString qtconfig = QLatin1String(":/qt/etc/qt.conf");
-#ifdef QT_BUILD_QMAKE
+#ifdef BOOTSTRAPPING
if(!QFile::exists(qtconfig))
qtconfig = qmake_libraryInfoFile();
#else
@@ -425,7 +429,7 @@ QLibraryInfo::location(LibraryLocation loc)
if (QDir::isRelativePath(ret)) {
if (loc == PrefixPath) {
// we make the prefix path absolute to the executable's directory
-#ifdef QT_BUILD_QMAKE
+#ifdef BOOTSTRAPPING
return QFileInfo(qmake_libraryInfoFile()).absolutePath();
#else
if (QCoreApplication::instance()) {
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 19e86a6..b10d603 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -42,7 +42,7 @@
#include "qdatastream.h"
#include "qdatastream_p.h"
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
#include "qbuffer.h"
#include "qstring.h"
#include <stdio.h>
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index f61a59c..2e4e7c1 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -66,7 +66,7 @@ template <typename T> class QSet;
template <class Key, class T> class QHash;
template <class Key, class T> class QMap;
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
class QDataStreamPrivate;
class Q_CORE_EXPORT QDataStream
{
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index 157fee9..98dd21f 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
class QDataStreamPrivate
{
public:
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index d8557e5..f4fdd26 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -48,9 +48,7 @@
#include "qlocale_p.h"
#include "qunicodetables_p.h"
#include "qscopedpointer.h"
-#ifndef QT_NO_DATASTREAM
#include <qdatastream.h>
-#endif
#ifndef QT_NO_COMPRESS
#include <zlib.h>
@@ -2640,7 +2638,7 @@ void QByteArray::clear()
d->ref.ref();
}
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
/*! \relates QByteArray
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index e258481..e6b828d 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -572,7 +572,7 @@ inline QByteArray &QByteArray::setNum(float n, char f, int prec)
{ return setNum(double(n),f,prec); }
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QByteArray &);
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 55ad28d..1bca983 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -7204,7 +7204,7 @@ QString QString::fromRawData(const QChar *unicode, int size)
*/
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
/*!
\fn QDataStream &operator<<(QDataStream &stream, const QString &string)
\relates QString
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 74f93a4..55d6d03 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1065,7 +1065,7 @@ inline QChar &QString::ref(uint i)
}
#endif
-#ifndef QT_NO_DATASTREAM
+#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &);
#endif
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index b4f9b2f..b3ee948 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -38,7 +38,7 @@ DEPENDPATH += $$INCLUDEPATH \
$$QT_SOURCE_TREE/src/xml
hpux-acc*|hpuxi-acc* {
- LIBS += ../bootstrap/libbootstrap.a
+ LIBS += $$QT_BUILD_TREE/src/tools/bootstrap/libbootstrap.a
} else {
contains(CONFIG, debug_and_release_target) {
CONFIG(debug, debug|release) {
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 1f81a6c..41e6f65 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -48,10 +48,12 @@ SOURCES += \
../../corelib/codecs/qtsciicodec.cpp \
../../corelib/codecs/qutfcodec.cpp \
../../corelib/global/qglobal.cpp \
+ ../../corelib/global/qlibraryinfo.cpp \
../../corelib/global/qmalloc.cpp \
../../corelib/global/qnumeric.cpp \
../../corelib/io/qabstractfileengine.cpp \
../../corelib/io/qbuffer.cpp \
+ ../../corelib/io/qdatastream.cpp \
../../corelib/io/qdir.cpp \
../../corelib/io/qdiriterator.cpp \
../../corelib/io/qfile.cpp \
@@ -62,6 +64,7 @@ SOURCES += \
../../corelib/io/qtemporaryfile.cpp \
../../corelib/io/qtextstream.cpp \
../../corelib/io/qurl.cpp \
+ ../../corelib/io/qsettings.cpp \
../../corelib/kernel/qmetatype.cpp \
../../corelib/kernel/qvariant.cpp \
../../corelib/tools/qbitarray.cpp \
@@ -86,11 +89,12 @@ unix:SOURCES += ../../corelib/io/qfsfileengine_unix.cpp \
../../corelib/io/qfsfileengine_iterator_unix.cpp
win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \
- ../../corelib/io/qfsfileengine_iterator_win.cpp
+ ../../corelib/io/qfsfileengine_iterator_win.cpp \
+ ../../corelib/io/qsettings_win.cpp
macx: {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
- SOURCES += ../../corelib/kernel/qcore_mac.cpp
+ SOURCES += ../../corelib/kernel/qcore_mac.cpp ../../corelib/io/qsettings_mac.cpp
LIBS += -framework CoreServices
}
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index d8c2abd..2797db7 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3394,7 +3394,8 @@ void Configure::buildHostTools()
<< "src/tools/bootstrap"
<< "src/tools/moc"
<< "src/tools/rcc"
- << "src/tools/uic";
+ << "src/tools/uic"
+ << "tools/linguist/lrelease";
if(dictionary["XQMAKESPEC"].startsWith("wince"))
hostToolsDirs << "tools/checksdk";
diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro
index 01091b3..28a741d 100644
--- a/tools/linguist/lrelease/lrelease.pro
+++ b/tools/linguist/lrelease/lrelease.pro
@@ -2,19 +2,10 @@ TEMPLATE = app
TARGET = lrelease
DESTDIR = ../../../bin
-QT -= gui
-
-CONFIG += qt warn_on console
-CONFIG -= app_bundle
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
SOURCES += main.cpp
+include(../../../src/tools/bootstrap/bootstrap.pri)
include(../shared/formats.pri)
include(../shared/proparser.pri)
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index c88c909..c45459a 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -42,7 +42,10 @@
#include "translator.h"
#include "proreader.h"
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QCoreApplication>
+#include <QtCore/QTranslator>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
@@ -51,7 +54,14 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
-#include <QtCore/QTranslator>
+
+#ifdef QT_BOOTSTRAPPED
+static void initBinaryDir(
+#ifndef Q_OS_WIN
+ const char *argv0
+#endif
+ );
+#endif
static void printOut(const QString & out)
{
@@ -157,10 +167,18 @@ static bool releaseTsFile(const QString& tsFileName,
int main(int argc, char **argv)
{
+#ifdef QT_BOOTSTRAPPED
+ initBinaryDir(
+#ifndef Q_OS_WIN
+ argv[0]
+#endif
+ );
+#else
QCoreApplication app(argc, argv);
QTranslator translator;
if (translator.load(QLatin1String("lrelease_") + QLocale::system().name()))
app.installTranslator(&translator);
+#endif
ConversionData cd;
cd.m_verbose = true; // the default is true starting with Qt 4.2
@@ -260,3 +278,79 @@ int main(int argc, char **argv)
return 0;
}
+
+#ifdef QT_BOOTSTRAPPED
+
+#ifdef Q_OS_WIN
+# include <windows.h>
+#endif
+
+static QString binDir;
+
+static void initBinaryDir(
+#ifndef Q_OS_WIN
+ const char *_argv0
+#endif
+ )
+{
+#ifdef Q_OS_WIN
+ wchar_t module_name[MAX_PATH];
+ GetModuleFileName(0, module_name, MAX_PATH);
+ QFileInfo filePath = QString::fromWCharArray(module_name);
+ binDir = filePath.filePath();
+#else
+ QString argv0 = QFile::decodeName(QByteArray(_argv0));
+ QString absPath;
+
+ if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
+ /*
+ If argv0 starts with a slash, it is already an absolute
+ file path.
+ */
+ absPath = argv0;
+ } else if (argv0.contains(QLatin1Char('/'))) {
+ /*
+ If argv0 contains one or more slashes, it is a file path
+ relative to the current directory.
+ */
+ absPath = QDir::current().absoluteFilePath(argv0);
+ } else {
+ /*
+ Otherwise, the file path has to be determined using the
+ PATH environment variable.
+ */
+ QByteArray pEnv = qgetenv("PATH");
+ QDir currentDir = QDir::current();
+ QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":"));
+ for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) {
+ if ((*p).isEmpty())
+ continue;
+ QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0);
+ QFileInfo candidate_fi(candidate);
+ if (candidate_fi.exists() && !candidate_fi.isDir()) {
+ binDir = candidate_fi.canonicalPath();
+ return;
+ }
+ }
+ return;
+ }
+
+ QFileInfo fi(absPath);
+ if (fi.exists())
+ binDir = fi.canonicalPath();
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+// The name is hard-coded in QLibraryInfo
+QString qmake_libraryInfoFile()
+{
+ if (binDir.isEmpty())
+ return QString();
+ return QDir(binDir).filePath(QString::fromLatin1("qt.conf"));
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_BOOTSTRAPPED
diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h
index 9a83733..1ed3d6c 100644
--- a/tools/linguist/shared/proparserutils.h
+++ b/tools/linguist/shared/proparserutils.h
@@ -43,10 +43,35 @@
#define PROPARSERUTILS_H
#include <QtCore/QDir>
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QLibraryInfo>
+#endif
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+// this is a stripped down version of the one found in QtCore
+class QLibraryInfo
+{
+public:
+ enum LibraryLocation
+ {
+ PrefixPath,
+ DocumentationPath,
+ HeadersPath,
+ LibrariesPath,
+ BinariesPath,
+ PluginsPath,
+ DataPath,
+ TranslationsPath,
+ SettingsPath,
+ DemosPath,
+ ExamplesPath
+ };
+ static QString location(LibraryLocation);
+};
+#endif
+
// Pre- and postcondition macros
#define PRE(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)
#define POST(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp
index 99aedef..e4c26bc 100644
--- a/tools/linguist/shared/qm.cpp
+++ b/tools/linguist/shared/qm.cpp
@@ -41,7 +41,9 @@
#include "translator.h"
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/QCoreApplication>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index bc27daf..05fc6e5 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -56,6 +56,16 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+QString QObject::tr(const char *sourceText, const char *, int n)
+{
+ QString ret = QString::fromLatin1(sourceText);
+ if (n >= 0)
+ ret.replace(QLatin1String("%n"), QString::number(n));
+ return ret;
+}
+#endif
+
Translator::Translator() :
m_codecName("ISO-8859-1"),
m_locationsType(AbsoluteLocations)
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index eec704a..f29317b 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -54,6 +54,18 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_BOOTSTRAPPED
+struct QObject {
+ static QString tr(const char *sourceText, const char * = 0, int n = -1);
+};
+struct QCoreApplication : public QObject {
+ enum Encoding { CodecForTr };
+ static QString translate(const char *, const char *sourceText, const char * = 0,
+ Encoding = CodecForTr, int n = -1)
+ { return tr(sourceText, 0, n); }
+};
+#endif
+
class QIODevice;
// A struct of "interesting" data passed to and from the load and save routines