From c2bfd3a4e13515bc9507250a71e2f04612d78a04 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 27 Aug 2009 08:14:03 +0300 Subject: Added support for 'make sisx' target in Symbian OS. Commit f189e00 added support for template PKG file. This commit extends the template PKG file usage with new make target, i.e. the commit adds a new make target called sisx, which can be used to generate signed sisx files. The sisx target is basically wrapper for calling createpackage.bat, but it also adds support for default platform/target and environment variables. Default platform/target feature means that SIS packages are automatically created for last build target. For example: >qmake >make release-armv5 >make sisx <- Creates sisx for release-armv5 It is also possible to override the platform and target for which the SISX is created as follows: >qmake >make release-armv5 debug-winscw >make sisx PLATFORM=ARMV5 TARGET=UREL <- Creates sisx for release-armv5 Since PLATFORM and TARGET are make variables they can also be defined as an environment variables instead of passing them for make. I.e. the following is indentical to previous example: >set PLATFORM=ARMV5 >set TARGET=UREL >qmake >make release-armv5 debug-winscw >make sisx <- Creates sisx for release-armv5 The environment variables are also useful if you have your own developer certificate what you want to use for signing SIS files. For example: >set CERTIFICATE=mycert.cer >set KEY=mykey.key >qmake >make release-armv5 >make sisx The above example creates release-armv5 SIS package with custom certificate and key (key without password). If certificate and key are not defined, the same logic as in old createpackage.bat will be used i.e. if RD cert is available in Qt root it will be used, and if not self-signed cerfificate will be used. The environment variables supported by 'make sisx' are: PLATFORM TARGET CERTIFICATE KEY PASSPHRASE The createpackage.bat can still be called directly but preferred way is to use new make target directly as examples above demonstrated. Task: 259037 RevBy: Miikka Heikkinen --- mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm | 35 ++++++++++++++++++ mkspecs/symbian-sbsv2/flm/qt/qt.xml | 4 +++ qmake/generators/symbian/symmake.cpp | 42 +++++++++++++++++++++- qmake/generators/symbian/symmake.h | 2 ++ qmake/generators/symbian/symmake_abld.cpp | 32 +++++++++++++++-- qmake/generators/symbian/symmake_abld.h | 1 + qmake/generators/symbian/symmake_sbsv2.cpp | 6 ++++ 7 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm new file mode 100644 index 0000000..101f942 --- /dev/null +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -0,0 +1,35 @@ +# /**************************************************************************** +# ** +# ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# ** Contact: Nokia Corporation (qt-info@nokia.com) +# ** +# ** This file is part of symbian-sbsv2 mkspec. +# ** +# ****************************************************************************/ + +include $(FLMHOME)/metaflm.mk + +STORE_BUILD_TARGET:=$(call sanitise,TSTORE_BUILD_$(PLATFORM_PATH)_$(CFG_PATH)_$(EXTENSION_ROOT)) +CACHE_FILENAME:=$(EXTENSION_ROOT)/.make.cache + +define qmake_store_build +FINAL:: $(STORE_BUILD_TARGET) + +$(STORE_BUILD_TARGET): + $(call startrule,qmake_store_build) \ + echo "# ==============================================================================" > $(CACHE_FILENAME) && \ + echo "# This file is generated by make and should not be modified by the user" >> $(CACHE_FILENAME) && \ + echo "# Name : .make.cache" >> $(CACHE_FILENAME) && \ + echo "# Part of : " >> $(CACHE_FILENAME) && \ + echo "# Description : This file is used to cache last build target for" >> $(CACHE_FILENAME) && \ + echo "# make sisx target." >> $(CACHE_FILENAME) && \ + echo "# Version : " >> $(CACHE_FILENAME) && \ + echo "# ==============================================================================" >> $(CACHE_FILENAME) && \ + echo PLATFORM ?= $(PLATFORM_PATH) >> $(CACHE_FILENAME) && \ + echo TARGET ?= $(CFG_PATH) >> $(CACHE_FILENAME) \ + $(call endrule,qmake_store_build) +endef + +$(eval $(qmake_store_build)) +$(eval $(call GenerateStandardCleanTarget,$(CACHE_FILENAME),'')) + diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 2c46f78..5074e47 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -39,4 +39,8 @@ flm="qmake_generate_temp_dirs.flm"> + + + diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index b4d693c..13feb25 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -72,6 +72,12 @@ #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" +#define SISX_TARGET "sisx" +#define OK_SISX_TARGET "ok_sisx" +#define FAIL_SISX_NOPKG_TARGET "fail_sisx_nopkg" +#define FAIL_SISX_NOCACHE_TARGET "fail_sisx_nocache" +#define RESTORE_BUILD_TARGET "restore_build" + #define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) @@ -1624,6 +1630,41 @@ void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) str.replace(QString(" "), QString("_")); } +void SymbianMakefileGenerator::writeSisxTargets(QTextStream &t) +{ + t << SISX_TARGET ": " RESTORE_BUILD_TARGET << endl; + QString sisxcommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3),$(MAKE) -s %4,$(MAKE) -s %5),$(MAKE) -s %6)") + .arg(fileInfo(project->projectFile()).completeBaseName()) + .arg("pkg") + .arg(MAKE_CACHE_NAME) + .arg(OK_SISX_TARGET) + .arg(FAIL_SISX_NOCACHE_TARGET) + .arg(FAIL_SISX_NOPKG_TARGET); + t << sisxcommand << endl; + t << endl; + + t << OK_SISX_TARGET ":" << endl; + + QString pkgcommand = QString("\tcreatepackage.bat %1_template.%2 $(PLATFORM) $(TARGET) $(CERTIFICATE) $(KEY) $(PASSPHRASE)") + .arg(fileInfo(project->projectFile()).completeBaseName()) + .arg("pkg"); + t << pkgcommand << endl; + t << endl; + + t << FAIL_SISX_NOPKG_TARGET ":" << endl; + t << "\t$(error PKG file does not exist, 'SISX' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; + t << endl; + + t << FAIL_SISX_NOCACHE_TARGET ":" << endl; + t << "\t$(error Project has to be build before calling 'SISX' target)" << endl; + t << endl; + + + t << RESTORE_BUILD_TARGET ":" << endl; + t << "-include " MAKE_CACHE_NAME << endl; + t << endl; +} + void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) { t << "dodistclean:" << endl; @@ -1677,4 +1718,3 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) t << "distclean: clean dodistclean" << endl; t << endl; } - diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 2fea29b..b4b3022 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" #define QT_EXTRA_INCLUDE_DIR "tmp" +#define MAKE_CACHE_NAME ".make.cache" class SymbianMakefileGenerator : public MakefileGenerator { @@ -136,6 +137,7 @@ protected: const QString& itemPrefix, const QString& itemSuffix); + void writeSisxTargets(QTextStream &t); void generateDistcleanTargets(QTextStream& t); // Subclass implements diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 271d210..d66557a 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -58,6 +58,7 @@ #define ALL_SOURCE_DEPS_TARGET "all_source_deps" #define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" #define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" +#define STORE_BUILD_TARGET "store_build" SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } @@ -108,7 +109,7 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); wrapperTargets << WINSCW_DEPLOYMENT_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET; } else { - buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET); + buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); cleanDeps.append(EXTENSION_CLEAN); cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); finalDeps.append(FINALIZE_TARGET); @@ -118,7 +119,8 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b << EXTENSION_CLEAN << FINALIZE_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET - << WINSCW_DEPLOYMENT_TARGET; + << WINSCW_DEPLOYMENT_TARGET + << STORE_BUILD_TARGET; } t << "MAKMAKE: " << buildDeps << endl << endl; @@ -143,7 +145,7 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); foreach(QString target, wrapperTargets) { t << target << " : " << makefile << endl; - t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << endl << endl; + t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " PLATFORM=$(PLATFORM) TARGET=$(CFG)" << endl << endl; } t << endl; @@ -353,6 +355,10 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool writeDeploymentTargets(t); + writeSisxTargets(t); + + writeStoreBuildTarget(t); + generateDistcleanTargets(t); t << "clean: $(ABLD)" << endl; @@ -408,6 +414,26 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) return true; } +void SymbianAbldMakefileGenerator::writeStoreBuildTarget(QTextStream &t) +{ + t << STORE_BUILD_TARGET ":" << endl; + t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl; + t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Name : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Part of : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # make sisx target. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Version : >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME << endl; + t << "\t@echo. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo PLATFORM ?= $(PLATFORM) >> " MAKE_CACHE_NAME << endl; + t << "\t@echo TARGET ?= $(TARGET) >> " MAKE_CACHE_NAME << endl; + t << endl; + + generatedFiles << MAKE_CACHE_NAME; +} + void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) { // Normally emulator deployment gets done via regular makefile, but since subdirs diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 7709d5d..67da43e 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -56,6 +56,7 @@ protected: virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); + void writeStoreBuildTarget(QTextStream &t); bool writeDeploymentTargets(QTextStream &t); public: diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 2471a2b..8b38f3b 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -219,6 +219,8 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo qDeleteAll(subtargets); } + writeSisxTargets(t); + generateDistcleanTargets(t); t << "clean: " << BLD_INF_FILENAME << endl; @@ -402,6 +404,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "END" << endl; t << endl; + t << "START EXTENSION qt/qmake_store_build" << endl; + t << "END" << endl; + t << endl; + t << endl; } -- cgit v0.12