From 4b6bffc49f9d39384c0a54acd63e002f0c299af9 Mon Sep 17 00:00:00 2001 From: Rolland Dudemaine Date: Tue, 22 Feb 2011 16:27:48 +0100 Subject: Add support for the INTEGRITY RTOS build system Adds mkspecs and a qmake generator for Green Hills .gpj files Merge-request: 1101 Reviewed-by: Harald Fernengel --- .gitignore | 10 + mkspecs/unsupported/integrity-ghs/qmake.conf | 72 ++++ mkspecs/unsupported/integrity-ghs/qplatformdefs.h | 173 ++++++++ .../unsupported/qws/integrity-arm-cxarm/qmake.conf | 12 + .../qws/integrity-arm-cxarm/qplatformdefs.h | 42 ++ .../unsupported/qws/integrity-ppc-cxppc/qmake.conf | 12 + .../qws/integrity-ppc-cxppc/qplatformdefs.h | 42 ++ qmake/Makefile.unix | 9 +- qmake/generators/integrity/gbuild.cpp | 437 +++++++++++++++++++++ qmake/generators/integrity/gbuild.h | 69 ++++ qmake/generators/metamakefile.cpp | 28 +- qmake/option.cpp | 2 + qmake/option.h | 2 +- util/integrity/qt.bod | 111 ++++++ 14 files changed, 1007 insertions(+), 14 deletions(-) create mode 100644 mkspecs/unsupported/integrity-ghs/qmake.conf create mode 100644 mkspecs/unsupported/integrity-ghs/qplatformdefs.h create mode 100644 mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf create mode 100644 mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h create mode 100644 mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf create mode 100644 mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h create mode 100644 qmake/generators/integrity/gbuild.cpp create mode 100644 qmake/generators/integrity/gbuild.h create mode 100644 util/integrity/qt.bod diff --git a/.gitignore b/.gitignore index d446680..462f8e4 100644 --- a/.gitignore +++ b/.gitignore @@ -249,3 +249,13 @@ src/network/lib src/xml/lib/ .pc/ + +# INTEGRITY generated files +*.gpj +*.int +*.ael +*.dla +*.dnm +*.dep +*.map +work diff --git a/mkspecs/unsupported/integrity-ghs/qmake.conf b/mkspecs/unsupported/integrity-ghs/qmake.conf new file mode 100644 index 0000000..822d6bb --- /dev/null +++ b/mkspecs/unsupported/integrity-ghs/qmake.conf @@ -0,0 +1,72 @@ +# +# qmake configuration for integrity-ghs +# + +MAKEFILE_GENERATOR = GBUILD +#MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release integrity unix +QT += core gui network + +QMAKE_CFLAGS = -bsp $$INTEGRITY_BSP -os_dir $__OS_DIR +QMAKE_CFLAGS += --diag_suppress=1,228,236,381,611,997 +QMAKE_CFLAGS_WARN_ON = +QMAKE_CFLAGS_WARN_OFF = -w +QMAKE_CFLAGS_RELEASE = -g -Ospeed -Olink --signed_fields --no_commons +QMAKE_CFLAGS_DEBUG = -g --no_commons --signed_fields +QMAKE_CFLAGS_SHLIB = +QMAKE_CFLAGS_THREAD = -D_REENTRANT + +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS --no_implicit_include --link_once_templates +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD + +QMAKE_INCDIR = +QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = +QMAKE_LIBDIR_X11 = +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = +QMAKE_LIBDIR_OPENGL = +QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include +QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib + +QMAKE_LFLAGS = -lposix -livfs -lnet -lsocket -lfbdev -ldl +QMAKE_LFLAGS_RELEASE = -g -Ospeed -Olink --no_commons -non_shared --link_once_templates +QMAKE_LFLAGS_DEBUG = -g --no_commons +QMAKE_LFLAGS_SHLIB = +QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME = +QMAKE_LFLAGS_THREAD = +QMAKE_LFLAGS_RPATH = + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = -ldl +QMAKE_LIBS_X11 = +QMAKE_LIBS_X11SM = +QMAKE_LIBS_QTOPIA = +QMAKE_LIBS_THREAD = + +QMAKE_MOC = $$[QT_INSTALL_BINS]/moc +QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + +QMAKE_AR = ar cqs +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p +load(qt_config) + diff --git a/mkspecs/unsupported/integrity-ghs/qplatformdefs.h b/mkspecs/unsupported/integrity-ghs/qplatformdefs.h new file mode 100644 index 0000000..04156bf --- /dev/null +++ b/mkspecs/unsupported/integrity-ghs/qplatformdefs.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 1992-$THISYEAR$ $TROLLTECH$. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include + +// We are hot - unistd.h should have turned on the specific APIs we requested + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_IPV6IFNAME +#include +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::lstat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::lstat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT ::connect +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#ifndef QT_CLOSE +#define QT_CLOSE ::close +#endif +#ifndef QT_READ +#define QT_READ ::read +#endif +#ifndef QT_WRITE +#define QT_WRITE ::write +#endif +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR ::mkdir +#define QT_RMDIR ::rmdir +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +#define QT_MMAP ::mmap + +// Directory iteration +#define QT_DIR DIR + +#define QT_OPENDIR ::opendir +#define QT_CLOSEDIR ::closedir + + +#if defined(QT_LARGEFILE_SUPPORT) \ + && defined(QT_USE_XOPEN_LFS_EXTENSIONS) \ + && !defined(QT_NO_READDIR64) +# define QT_DIRENT struct dirent64 +# define QT_READDIR ::readdir64 +# define QT_READDIR_R ::readdir64_r +#else +# define QT_DIRENT struct dirent +# define QT_READDIR ::readdir +# define QT_READDIR_R ::readdir_r +#endif + +#define QT_SOCKLEN_T socklen_t + +#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf +#endif + +#ifndef MAXNAMLEN +# define MAXNAMLEN NAME_MAX +#endif + +#ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef NSIG +# define NSIG _SIGMAX +#endif + +#ifndef MAP_ANON +# define MAP_ANON 0 +#endif + +typedef void (*sighandler_t)(int); + +#ifndef QT_NO_MMAP +# define QT_NO_MMAP +#endif + +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif + +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif + diff --git a/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf b/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf new file mode 100644 index 0000000..acaf3c2 --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf @@ -0,0 +1,12 @@ +# +# qmake configuration for integrity-ghs +# + +INTEGRITY_DIR = /enter/your/path/to/INTEGRITY +INTEGRITY_BSP = enter_your_bsp_name_here +QMAKE_CC = ccintarm +QMAKE_CXX = cxintarm +QMAKE_LINK = cxintarm +QMAKE_LINK_SHLIB = cxintarm +include(../../integrity-ghs/qmake.conf) + diff --git a/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h b/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h new file mode 100644 index 0000000..e19f8dd --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../integrity-ghs/qplatformdefs.h" diff --git a/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf new file mode 100644 index 0000000..829e6d3 --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf @@ -0,0 +1,12 @@ +# +# qmake configuration for integrity-ghs +# + +INTEGRITY_DIR = /enter/your/path/to/INTEGRITY +INTEGRITY_BSP = enter_your_bsp_name_here +QMAKE_CC = ccintppc +QMAKE_CXX = cxintppc +QMAKE_LINK = cxintppc +QMAKE_LINK_SHLIB = cxintppc +include(../../integrity-ghs/qmake.conf) + diff --git a/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h new file mode 100644 index 0000000..e19f8dd --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../integrity-ghs/qplatformdefs.h" diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index a24076e..fd502e0 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -11,7 +11,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \ symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \ - symbiancommon.o registry.o epocroot.o + symbiancommon.o registry.o epocroot.o gbuild.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -38,6 +38,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ generaters/symbian/symbiancommon.cpp \ + generators/integrity/gbuild.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ @@ -68,7 +69,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp \ $(QTSRCS) -CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ +CPPFLAGS = -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 \ + -Igenerators/mac -Igenerators/symbian -Igenerators/integrity \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/tools/shared \ @@ -318,6 +320,9 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp +gbuild.o: generators/integrity/gbuild.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/integrity/gbuild.cpp + projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp new file mode 100644 index 0000000..f235a6a --- /dev/null +++ b/qmake/generators/integrity/gbuild.cpp @@ -0,0 +1,437 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +#include "gbuild.h" +#include "option.h" +#include "meta.h" +#include +#include +#include +#include +#include +#include +#ifdef Q_OS_UNIX +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +unsigned int dllbase = 0x01000000; +#define DLLOFFSET 0x600000 + +GBuildMakefileGenerator::GBuildMakefileGenerator() : MakefileGenerator() +{ + nativebins << "moc" << "rcc" << "uic" << "bootstrap"; +} + +bool +GBuildMakefileGenerator::write() +{ + QStringList tmp; + QString filename(Option::output.fileName()); + QString pathtoremove(qmake_getpwd()); + QString relpath(pathtoremove); + QString strtarget(project->first("TARGET")); + bool isnativebin = nativebins.contains(strtarget); + relpath.replace(Option::output_dir, ""); + + /* correct output for non-prl, non-recursive case */ + QString outname(qmake_getpwd()); + outname += QDir::separator(); + outname += fileInfo(Option::output.fileName()).baseName(); + outname += projectSuffix(); + Option::output.close(); + Option::output.setFileName(outname); + MakefileGenerator::openOutput(Option::output, QString()); + + if (strtarget != fileInfo(project->projectFile()).baseName()) { + QString gpjname(strtarget); + QString outputName(qmake_getpwd()); + outputName += QDir::separator(); + outputName += fileInfo(project->projectFile()).baseName(); + outputName += projectSuffix(); + QFile f(outputName); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream t(&f); + t << "#!gbuild\n"; + t << "[Project]\n"; + t << gpjname << projectSuffix() << "\n"; + if ((project->first("TEMPLATE") == "lib") + && project->isActiveConfig("shared")) + t << gpjname << "_shared" << projectSuffix() << "\n"; + t.flush(); + gpjname += projectSuffix(); + Option::output.close(); + Option::output.setFileName(gpjname); + MakefileGenerator::openOutput(Option::output, QString()); + } + + if ((project->first("TEMPLATE") == "app") + && (!isnativebin)) { + QTextStream t(&Option::output); + QString intname(strtarget); + intname += ".int"; + /* this is for bulding an INTEGRITY application. + * generate the .int integrate file and the .gpj INTEGRITY Application + * project file, then go on with regular files */ + t << "#!gbuild" << "\n"; + t << "[INTEGRITY Application]" << "\n"; + t << "\t:binDirRelative=.\n"; + t << "\t-o " << strtarget << "\n"; + t << intname << "\n"; + t << strtarget << "_app" << projectSuffix() << "\n"; + t.flush(); + + /* generate integrate file */ + QFile f(intname); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream ti(&f); + ti << "# This is a file automatically generated by qmake" << "\n"; + ti << "# Modifications will be lost next time you run qmake" << "\n"; + ti << "Kernel" << "\n"; + ti << "\tFilename\tDynamicDownload" << "\n"; + ti << "EndKernel" << "\n" << "\n"; + ti << "AddressSpace" << "\n"; + ti << "\tName\t" << strtarget << "\n"; + ti << "\tFilename\t" << strtarget << "_app" << "\n"; + ti << "\tMemoryPoolSize\t0x100000" << "\n"; + ti << "\tLanguage\tC++" << "\n"; + /* FIXME : heap size is huge to be big enough for every example + * it should probably be tailored for each example, btu there is no + * good way to guess that */ + ti << "\tHeapSize\t0x00D00000" << "\n"; + ti << "\tTask\tInitial" << "\n"; + ti << "\t\tStackSize\t0x30000" << "\n"; + ti << "\tEndTask" << "\n"; + ti << "EndAddressSpace" << "\n"; + ti.flush(); + + /* change current project file to _app.gpj and continue + * generation */ + filename.insert(filename.lastIndexOf("."), "_app"); + Option::output.close(); + Option::output.setFileName(filename); + MakefileGenerator::openOutput(Option::output, QString()); + } else if ((project->first("TEMPLATE") == "lib") + && project->isActiveConfig("shared")) { + QString gpjname(strtarget); + gpjname += "_shared"; + gpjname += projectSuffix(); + QFile f(gpjname); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream t(&f); + t << "#!gbuild\n" + "[Program]\n" + "\t-A libINTEGRITY.so\n" + "\t-A libc.so\n" + "\t-A libscxx.so\n" + "\t-A libQtCore.so\n" + "\t-e __ghsbegin_text\n" + "\t-startfile=-\n" + "\t:syslibraries=-\n" + "\t-Onolink\n"; + t << "\t-o lib" << strtarget << ".so\n"; + t << "\t-l" << strtarget << "\n"; + t << "\t-extractall=-l" << strtarget << "\n"; + t << "\t:outputDir=work/" << filename.section(QDir::separator(), 0, -1).remove(".gpj") << "\n"; + t << strtarget << "_shared.ld\n"; + t << "$(__OS_DIR)/intlib/sharedobjbssinit.c\n"; + t.flush(); + + QFile fl(strtarget + "_shared.ld"); + fl.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream tl(&fl); + tl << "CONSTANTS {\n" + " __INTEGRITY_MinPageAlign = 16K\n" + " __INTEGRITY_MaxPageAlign = 16K\n" + " __INTEGRITY_LibCBaseAddress = \n"; + tl << dllbase << "\n"; + tl << "}\n" + "-sec\n" + "{\n" + " .picbase __INTEGRITY_LibCBaseAddress :\n" + " .text :\n" + " .syscall :\n" + " .intercall :\n" + " .interfunc :\n" + " .secinfo :\n" + " .rodata align(16) :\n" + " .fixaddr :\n" + " .fixtype :\n" + " .rombeg :\n" + " .textchecksum :\n" + " // The above sections may be large. Leave a bigger gap for large pages.\n" + " .pidbase align(__INTEGRITY_MaxPageAlign) :\n" + " .sdabase :\n" + " .data :\n" + " .toc :\n" + " .opd :\n" + " .datachecksum :\n" + " .bss align(__INTEGRITY_MinPageAlign) :\n" + " .heap :\n" + "}\n"; + tl.flush(); + dllbase += DLLOFFSET; + } + + warn_msg(WarnParser, Option::output.fileName().toAscii()); + QTextStream t(&Option::output); + QString primaryTarget(project->values("QMAKE_CXX").at(0)); + + pathtoremove += QDir::separator(); + filename.remove(qmake_getpwd()); + + //HEADER + t << "#!gbuild" << "\n"; + + /* find the architecture out of the compiler name */ + if (filename.endsWith("projects.gpj")) { + primaryTarget.remove(0, 5); + t << "macro QT_BUILD_DIR=%expand_path(.)\n"; + t << "macro __OS_DIR=" << project->values("INTEGRITY_DIR").first() << "\n"; + t << "primaryTarget=" << primaryTarget << "_integrity.tgt" << "\n"; + t << "customization=util/integrity/qt.bod\n"; + } + /* project type */ + if (project->first("TEMPLATE") == "app") { + t << "[Program]" << "\n"; + if (isnativebin) { + t << "\t:binDir=bin\n"; + t << "\t-o " << strtarget << "\n"; + } else { + t << "\t:binDirRelative=.\n"; + t << "\t-o " << strtarget << "_app\n"; + } + } else if (project->first("TEMPLATE") == "lib") { + t << "[Library]" << "\n"; + t << "\t:binDir=lib" << "\n"; + t << "\t-o lib" << strtarget << ".a" << "\n"; + } else if (project->first("TEMPLATE") == "subdirs") + t << "[Project]" << "\n"; + else + t << project->first("TEMPLATE") << "\n"; + + /* compilations options */ + t << "\t:sourceDir=." << "\n"; + + t << "\t:outputDir=work" << relpath << "\n"; + if (filename.endsWith("projects.gpj")) { + t << "\t:sourceDir=work\n"; + t << "\t-Iwork\n"; + t << "\t-Llib\n"; + t << "\t"; + QStringList &l = project->values("QMAKE_CXXFLAGS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).startsWith("-")) + t << "\n" << "\t" << (*it); + else + t << " " << (*it); + } + t << "\n"; + } + t << "\n"; + + t << varGlue("DEFINES", "\t-D", "\n\t-D", "\n"); + + t << "\t-I.\n\t-I" << specdir() << "\n"; + t << varGlue("INCLUDEPATH", "\t-I", "\n\t-I", "\n"); + t << "\t--cxx_include_directory .\n\t--cxx_include_directory " << specdir() << "\n"; + t << varGlue("INCLUDEPATH", "\t--cxx_include_directory ", "\n\t--cxx_include_directory ", "\n"); + + if (project->first("TEMPLATE") == "app") { + /* include linker flags if it's an application */ + QString src[] = { "QMAKE_LFLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", "LIBS", QString() }; + for (int i = 0; !src[i].isNull(); i++) { + /* skip target libraries for native tools */ + if (isnativebin && (i == 0)) + continue; + t << "\t"; + QStringList &l = project->values(src[i]); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).startsWith("-")) + t << "\n" << "\t" << (*it); + else + t << " " << (*it); + } + t << "\n"; + } + } + + /* first subdirectories/subprojects */ + { + QStringList &l = project->values("SUBDIRS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString gpjname((*it)); + /* avoid native tools */ + if (nativebins.contains(gpjname.section("_", -1))) + continue; + if (!project->first((*it) + ".subdir").isEmpty()) + gpjname = project->first((*it) + ".subdir"); + else + gpjname.replace("_", QDir::separator()); + gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1); + gpjname += projectSuffix(); + /* make relative */ + if (!project->values("QT_SOURCE_TREE").isEmpty()) { + gpjname.replace(project->values("QT_SOURCE_TREE").first() + QDir::separator(), ""); + } + t << gpjname << "\n"; + } + } + + { + QStringList &l = project->values("RESOURCES"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr((*it).replace(pathtoremove, "")); + t << tmpstr << "\t[Qt Resource]\n"; + tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1); + tmpstr.remove(".qrc"); + t << "\t-name " << tmpstr << "\n"; + tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "qrc_"); + tmpstr.append(".cpp"); + t << "\t-o work/" << tmpstr << "\n"; + } + } + { + QStringList &l = project->values("FORMS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr((*it).replace(pathtoremove, "")); + t << tmpstr << "\t[Qt Dialog]\n"; + tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1); + tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_"); + tmpstr.remove(".ui"); + tmpstr.append(".h"); + t << "\t-o work/" << tmpstr << "\n"; + } + } + + /* source files for this project */ + QString src[] = { "HEADERS", "SOURCES", QString() }; + for (int i = 0; !src[i].isNull(); i++) { + QStringList &l = project->values(src[i]); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).isEmpty()) + continue; + /* native tools aren't preprocessed */ + if (!isnativebin) + t << writeOne((*it), pathtoremove); + else + t << (*it).remove(pathtoremove) << "\n"; + } + } + t << "\n"; + + { + QStringList &l = project->values("GENERATED_SOURCES"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + t << "work/" << (*it).section(QDir::separator(), -1) << "\n"; + } + } + + return true; +} + +QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove) +{ + QString s(""); + s += filename.remove(pathtoremove); + if (filename.endsWith(Option::h_ext.first())) { + QString corename(filename.section(QDir::separator(), -1)); + corename.remove(Option::h_ext.first()); + corename.append(Option::cpp_ext.first()); + corename.prepend(Option::h_moc_mod); + s += "\t[MOC/Qt Header]\n"; + s += "\t-o "; + s += "work/"; + s += corename; + s += "\n"; + } else if (filename.section(QDir::separator(), -1).startsWith("qrc_")) { + QString tmpstr(filename.section("/", -1).section(".", 0, -1).remove("qrc_").remove(".cpp")); + s += "\n\t:depends="; + s += tmpstr; + s += ".qrc"; + s += "\n"; + } else if (filename.endsWith(Option::cpp_ext.first())) { + QString tmpstr(filename.section("/", -1)); +// QString moctool(project->values("QMAKE_MOC").first()); + QString filepath(pathtoremove); + if (!project->values("QT_SOURCE_TREE").isEmpty()) { + filepath.remove(project->values("QT_SOURCE_TREE").first()); + filepath.remove(0, 1); + } +// if (!project->values("QT_BUILD_TREE").isEmpty()) { +// moctool.remove(project->values("QT_BUILD_TREE").first()); +// moctool.remove(0, 1); +// } + s += "\n\t:preexecShellSafe='${QT_BUILD_DIR}/bin/moc "; +// s += moctool; +// s += " "; + s += varGlue("DEFINES", "-D", " -D", " "); + s += varGlue("INCLUDEPATH", "-I", " -I", " "); + s += filepath; + s += filename; + s += " -o "; + tmpstr.replace(Option::cpp_ext.first(), Option::cpp_moc_ext); + s += "work/"; + s += tmpstr; + s += "\n"; + } else + s += "\n"; + return s; +} + +bool +GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const +{ + debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); + QFileInfo fi(file); + if (fi.filePath().isEmpty()) + file.setFileName(qmake_getpwd() + QDir::separator() + file.fileName()); + if (!file.fileName().endsWith(projectSuffix())) { + QString outputName(file.fileName()); + outputName += QDir::separator(); + outputName += fileInfo(project->projectFile()).baseName(); + outputName += projectSuffix(); + warn_msg(WarnParser, outputName.toAscii()); + file.setFileName(outputName); + } + debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); + bool ret = MakefileGenerator::openOutput(file, QString()); + return ret; +} + +QT_END_NAMESPACE diff --git a/qmake/generators/integrity/gbuild.h b/qmake/generators/integrity/gbuild.h new file mode 100644 index 0000000..3049789 --- /dev/null +++ b/qmake/generators/integrity/gbuild.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +#ifndef GBUILD_H +#define GBUILD_H + +#include "makefile.h" + +QT_BEGIN_NAMESPACE + +class GBuildMakefileGenerator : public MakefileGenerator +{ + virtual bool write(); + + QString projectSuffix() const { return QString(".gpj"); }; + QString writeOne(QString filename, QString pathtoremove = ""); + +public: + GBuildMakefileGenerator(); + ~GBuildMakefileGenerator(); + + virtual bool supportsMetaBuild() { return false; } + virtual bool openOutput(QFile &, const QString &) const; +protected: + bool doPrecompiledHeaders() const { return false; } + virtual bool doDepends() const { return true; } + QStringList nativebins; + +}; + +inline GBuildMakefileGenerator::~GBuildMakefileGenerator() +{ } + +QT_END_NAMESPACE + +#endif // GBUILD_H diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index ae48ddd..a3fba6a 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -138,12 +138,12 @@ BuildsMetaMakefileGenerator::init() Build *build = new Build; build->name = name; build->makefile = createMakefileGenerator(project, false); - if (build->makefile){ + if (build->makefile){ makefiles += build; - }else { - delete build; - return false; - } + }else { + delete build; + return false; + } } return true; } @@ -179,7 +179,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd) using_stdout = true; } else { if(Option::output.fileName().isEmpty() && - Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE) + Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE) Option::output.setFileName(project->first("QMAKE_MAKEFILE")); Option::output_dir = oldpwd; QString build_name = build->name; @@ -306,7 +306,7 @@ SubdirsMetaMakefileGenerator::init() && project->isRecursive()); if(recurse) { QString old_output_dir = Option::output_dir; - QString old_output = Option::output.fileName(); + QString old_output = Option::output.fileName(); QString oldpwd = qmake_getpwd(); QString thispwd = oldpwd; if(!thispwd.endsWith('/')) @@ -387,7 +387,7 @@ SubdirsMetaMakefileGenerator::init() self->input_dir = qmake_getpwd(); self->output_dir = Option::output_dir; if(!recurse || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) - self->output_file = Option::output.fileName(); + self->output_file = Option::output.fileName(); self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); @@ -420,10 +420,10 @@ SubdirsMetaMakefileGenerator::write(const QString &oldpwd) writepwd = oldpwd; if(!(ret = subs.at(i)->makefile->write(writepwd))) break; - //restore because I'm paranoid + //restore because I'm paranoid qmake_setpwd(pwd); - Option::output.setFileName(output_name); - Option::output_dir = output_dir; + Option::output.setFileName(output_name); + Option::output_dir = output_dir; } return ret; } @@ -448,6 +448,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "symmake_abld.h" #include "symmake_sbsv2.h" #include "symbian_makefile.h" +#include "gbuild.h" QT_END_INCLUDE_NAMESPACE MakefileGenerator * @@ -491,6 +492,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) mkfile = new SymbianMakefileTemplate; } else if(gen == "SYMBIAN_MINGW") { mkfile = new SymbianMakefileTemplate; + } else if(gen == "GBUILD") { + mkfile = new GBuildMakefileGenerator; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); } @@ -556,6 +559,9 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen, *host_mode = Option::HOST_WIN_MODE; #endif *target_mode = Option::TARG_SYMBIAN_MODE; + } else if (gen == "GBUILD") { + *host_mode = Option::HOST_UNIX_MODE; + *target_mode = Option::TARG_INTEGRITY_MODE; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); return false; diff --git a/qmake/option.cpp b/qmake/option.cpp index fcbf5fa..1354281 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -260,6 +260,8 @@ Option::parseCommandLine(int argc, char **argv, int skip) Option::host_mode = HOST_WIN_MODE; Option::target_mode = TARG_WIN_MODE; Option::target_mode_overridden = true; + } else if(opt == "integrity") { + Option::target_mode = TARG_INTEGRITY_MODE; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { diff --git a/qmake/option.h b/qmake/option.h index 23be12f..e3ddc9a 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -156,7 +156,7 @@ struct Option enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; static HOST_MODE host_mode; enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, - TARG_SYMBIAN_MODE }; + TARG_SYMBIAN_MODE, TARG_INTEGRITY_MODE }; static TARG_MODE target_mode; static bool target_mode_overridden; static QString user_template, user_template_prefix; diff --git a/util/integrity/qt.bod b/util/integrity/qt.bod new file mode 100644 index 0000000..bdf50ce --- /dev/null +++ b/util/integrity/qt.bod @@ -0,0 +1,111 @@ +CommandOptions { + MOCCommandOptions { + MOCOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + #flags={"OUTPUTNAME"} + } + MOCDefines { + { + name="-D" + } + delimiter="Touching" + merge="Concat" + } + MOCIncludes { + { + name="-I" + } + delimiter="Touching" + merge="Concat" + flags={"RELATIVEPATH"} + } + } + UICommandOptions { + UIOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + flags={"OUTPUTNAME"} + } + } + RCCCommandOptions { + RCCOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + flags={"OUTPUTNAME"} + } + RCCName { + { + name="-name" + } + delimiter="Space" + merge="Replace" + } + } +} + +Commands { + MOCPreprocessor { + name="MOCPreprocessor" + exec="${QT_BUILD_DIR}/bin/moc" + options={ "MOCCommandOptions", "SpecialOptions" } + } + UIPreprocessor { + name="UIPreprocessor" + exec="${QT_BUILD_DIR}/bin/uic" + options={ "UICommandOptions" } + } + RCCPreprocessor { + name="RCCPreprocessor" + exec="${QT_BUILD_DIR}/bin/rcc" + options={ "RCCCommandOptions" } + } +} + +FileTypes { + MocCPP { + name="MOC/Qt Header" + outputExtension="time" + outputType="SourceFile" + command="MOCPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/moc -nn $OPTIONS $INPUTFILE" + progress="MOCing" + extraFiles="$(OUTPUTDIR)/moc_$(OUTPUTNAMEBASE).cpp" + #postExecSafe={"${GHS_TOOLS_DIR}/filechanged work/$(OUTPUTNAME)"} + color="#0020a0" + grepable=true + } + RCC { + name="Qt Resource" + outputExtension="time" + #extensions={"qrc"} + outputType="SourceFile" + command="RCCPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/rcc $OPTIONS $INPUTFILE" + extraFiles="$(OUTPUTDIR)/qrc_$(OUTPUTNAMEBASE).cpp" + progress="Generating Resource source from" + action="Generate Resource source for" + grepable=true + } + UI { + name="Qt Dialog" + outputExtension="time" + #extensions={"ui"} + outputType="SourceFile" + command="UIPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/uic $OPTIONS $INPUTFILE" + extraFiles="$(OUTPUTDIR)/ui_$(OUTPUTNAMEBASE).cpp" + progress="Generating Dialog source from" + action="Generate Dialog source for" + grepable=true + } +} -- cgit v0.12