Remove Symbian specific code from qtbase.
Change-Id: I27d37d914b71e1e43c94e2a975ffec49e1ecd456 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
d1a2b53aaf
commit
ba9302b8a9
2
INSTALL
2
INSTALL
@ -10,5 +10,3 @@ Mac OS X: http://qt.nokia.com/doc/%SHORTVERSION%/install-mac.html
|
|||||||
Windows: http://qt.nokia.com/doc/%SHORTVERSION%/install-win.html
|
Windows: http://qt.nokia.com/doc/%SHORTVERSION%/install-win.html
|
||||||
Windows CE: http://qt.nokia.com/doc/%SHORTVERSION%/install-wince.html
|
Windows CE: http://qt.nokia.com/doc/%SHORTVERSION%/install-wince.html
|
||||||
X11 Platforms: http://qt.nokia.com/doc/%SHORTVERSION%/install-x11.html
|
X11 Platforms: http://qt.nokia.com/doc/%SHORTVERSION%/install-x11.html
|
||||||
Symbian Platform: http://qt.nokia.com/doc/%SHORTVERSION%/install-symbian.html
|
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
scriptpath=`dirname $0`
|
|
||||||
perl $scriptpath/createpackage.pl "$@"
|
|
@ -1,44 +0,0 @@
|
|||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
||||||
::
|
|
||||||
:: Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
:: Contact: http://www.qt-project.org/
|
|
||||||
::
|
|
||||||
:: This file is part of the test suite of the Qt Toolkit.
|
|
||||||
::
|
|
||||||
:: $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
:: GNU Lesser General Public License Usage
|
|
||||||
:: 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.
|
|
||||||
::
|
|
||||||
:: GNU General Public License Usage
|
|
||||||
:: Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
:: Public License version 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 the GNU General
|
|
||||||
:: Public License version 3.0 requirements will be met:
|
|
||||||
:: http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
::
|
|
||||||
:: Other Usage
|
|
||||||
:: Alternatively, this file may be used in accordance with the terms and
|
|
||||||
:: conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
::
|
|
||||||
::
|
|
||||||
::
|
|
||||||
::
|
|
||||||
::
|
|
||||||
::
|
|
||||||
:: $QT_END_LICENSE$
|
|
||||||
::
|
|
||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
set scriptpath=%~dp0
|
|
||||||
perl %scriptpath%createpackage.pl %*
|
|
@ -1,439 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
#############################################################################
|
|
||||||
##
|
|
||||||
## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
## Contact: http://www.qt-project.org/
|
|
||||||
##
|
|
||||||
## This file is part of the S60 port of the Qt Toolkit.
|
|
||||||
##
|
|
||||||
## $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
## GNU Lesser General Public License Usage
|
|
||||||
## 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.
|
|
||||||
##
|
|
||||||
## GNU General Public License Usage
|
|
||||||
## Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
## Public License version 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 the GNU General
|
|
||||||
## Public License version 3.0 requirements will be met:
|
|
||||||
## http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
##
|
|
||||||
## Other Usage
|
|
||||||
## Alternatively, this file may be used in accordance with the terms and
|
|
||||||
## conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
## $QT_END_LICENSE$
|
|
||||||
##
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
############################################################################################
|
|
||||||
#
|
|
||||||
# Convenience script for creating signed packages you can install on your phone.
|
|
||||||
#
|
|
||||||
############################################################################################
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
# use a command-line parsing module
|
|
||||||
use Getopt::Long;
|
|
||||||
# Use file name parsing module
|
|
||||||
use File::Basename;
|
|
||||||
# Use File::Spec services mainly rel2abs
|
|
||||||
use File::Spec;
|
|
||||||
# Use File::Path - to make stub sis target directory
|
|
||||||
use File::Path;
|
|
||||||
# use CWD abs_bath, which is exported only on request
|
|
||||||
use Cwd 'abs_path';
|
|
||||||
use File::Copy;
|
|
||||||
|
|
||||||
sub Usage() {
|
|
||||||
print <<ENDUSAGESTRING;
|
|
||||||
|
|
||||||
==============================================================================================
|
|
||||||
Convenience script for creating signed packages you can install on your phone.
|
|
||||||
|
|
||||||
Usage: createpackage.pl [options] templatepkg [target]-[platform] [certificate key [passphrase]]
|
|
||||||
|
|
||||||
Where supported options are as follows:
|
|
||||||
[-i|install] = Install the package right away using PC suite.
|
|
||||||
[-p|preprocess] = Only preprocess the template .pkg file.
|
|
||||||
[-c|certfile <file>] = The file containing certificate information for signing.
|
|
||||||
The file can have several certificates, each specified in
|
|
||||||
separate line. The certificate, key and passphrase in line
|
|
||||||
must be ';' separated. Lines starting with '#' are treated
|
|
||||||
as a comments. Also empty lines are ignored. The paths in
|
|
||||||
<file> can be absolute or relative to <file>.
|
|
||||||
[-u|unsigned] = Preserves the unsigned package.
|
|
||||||
[-o|only-unsigned] = Creates only unsigned package.
|
|
||||||
[-s|stub] = Generates stub sis for ROM.
|
|
||||||
[-n|sisname <name>] = Specifies the final sis name.
|
|
||||||
[-g|gcce-is-armv5] = Convert gcce platform to armv5.
|
|
||||||
[-d|dont-patch] = Skip automatic patching of capabilities and pkg file if default certificate
|
|
||||||
is used. Instead non-self-signable capabilities just cause warnings.
|
|
||||||
[-t|tmp-dir <path>] = Specifies temporary directory to be used for package creation.
|
|
||||||
Defaults to 'createpackage_tmp' under same directory as templatepkg.
|
|
||||||
Where parameters are as follows:
|
|
||||||
templatepkg = Name of .pkg file template
|
|
||||||
target = Either debug or release
|
|
||||||
platform = One of the supported platform
|
|
||||||
winscw | gcce | armv5 | armv6 | armv7
|
|
||||||
Note that when packaging binaries built using gcce and symbian-sbsv2
|
|
||||||
mkspec, armv5 must be used for platform instead of gcce.
|
|
||||||
certificate = The certificate file used for signing
|
|
||||||
key = The certificate's private key file
|
|
||||||
passphrase = The passphrase of the certificate's private key file
|
|
||||||
|
|
||||||
Example:
|
|
||||||
createpackage.pl fluidlauncher_template.pkg release-armv5
|
|
||||||
|
|
||||||
Example with certfile:
|
|
||||||
createpackage.pl -c=mycerts.txt fluidlauncher_template.pkg release-armv5
|
|
||||||
|
|
||||||
Content of 'mycerts.txt' must be something like this:
|
|
||||||
# This is comment line, also the empty lines are ignored
|
|
||||||
rd.cer;rd-key.pem
|
|
||||||
.\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword
|
|
||||||
X:\\QtS60\\s60installs\\selfsigned.cer;X:\\QtS60\\s60installs\\selfsigned.key
|
|
||||||
|
|
||||||
If no certificate and key files are provided, either a RnD certificate or
|
|
||||||
a self-signed certificate from QtDir\\src\\s60installs directory is used.
|
|
||||||
In the latter case the resulting package will also be automatically patched
|
|
||||||
using patch_capabilities.pl script, which makes it unsuitable for distribution.
|
|
||||||
Always specify certificates explicitly if you wish to distribute your package.
|
|
||||||
|
|
||||||
==============================================================================================
|
|
||||||
|
|
||||||
ENDUSAGESTRING
|
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Read given options
|
|
||||||
my $install = "";
|
|
||||||
my $preprocessonly = "";
|
|
||||||
my $certfile = "";
|
|
||||||
my $preserveUnsigned = "";
|
|
||||||
my $stub = "";
|
|
||||||
my $signed_sis_name = "";
|
|
||||||
my $onlyUnsigned = "";
|
|
||||||
my $convertGcce = "";
|
|
||||||
my $dontPatchCaps = "";
|
|
||||||
my $tempPackageDir = "";
|
|
||||||
|
|
||||||
unless (GetOptions('i|install' => \$install,
|
|
||||||
'p|preprocess' => \$preprocessonly,
|
|
||||||
'c|certfile=s' => \$certfile,
|
|
||||||
'u|unsigned' => \$preserveUnsigned,
|
|
||||||
'o|only-unsigned' => \$onlyUnsigned,
|
|
||||||
's|stub' => \$stub,
|
|
||||||
'n|sisname=s' => \$signed_sis_name,
|
|
||||||
'g|gcce-is-armv5' => \$convertGcce,
|
|
||||||
'd|dont-patch' => \$dontPatchCaps,
|
|
||||||
't|tmp-dir=s' => \$tempPackageDir,)) {
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
my $epocroot = $ENV{EPOCROOT};
|
|
||||||
my $epocToolsDir = "";
|
|
||||||
if ($epocroot ne "") {
|
|
||||||
$epocroot =~ s,\\,/,g;
|
|
||||||
if ($epocroot =~ m,[^/]$,) {
|
|
||||||
$epocroot = $epocroot."/";
|
|
||||||
}
|
|
||||||
$epocToolsDir = "${epocroot}epoc32/tools/";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $certfilepath = abs_path(dirname($certfile));
|
|
||||||
|
|
||||||
# Read params to variables
|
|
||||||
my $templatepkg = $ARGV[0];
|
|
||||||
my $targetplatform = lc $ARGV[1];
|
|
||||||
|
|
||||||
if ($targetplatform eq "") {
|
|
||||||
$targetplatform = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
my @tmpvalues = split('-', $targetplatform);
|
|
||||||
my $target;
|
|
||||||
$target = $tmpvalues[0] or $target = "";
|
|
||||||
my $platform;
|
|
||||||
$platform = $tmpvalues[1] or $platform = "";
|
|
||||||
|
|
||||||
if ($platform =~ m/^gcce$/i) {
|
|
||||||
if (($convertGcce ne "")) {
|
|
||||||
$platform = "armv5";
|
|
||||||
} elsif ($ENV{SBS_HOME}) {
|
|
||||||
# Print a informative note in case suspected misuse is detected.
|
|
||||||
print "\nNote: You should use armv5 as platform or specify -g parameter to convert platform\n";
|
|
||||||
print " when packaging gcce binaries built using symbian-sbsv2 mkspec.\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convert visual target to real target (debug->udeb and release->urel)
|
|
||||||
$target =~ s/debug/udeb/i;
|
|
||||||
$target =~ s/release/urel/i;
|
|
||||||
|
|
||||||
my $certificate;
|
|
||||||
$certificate = $ARGV[2] or $certificate = "";
|
|
||||||
my $key;
|
|
||||||
$key = $ARGV[3] or $key = "";
|
|
||||||
my $passphrase;
|
|
||||||
$passphrase = $ARGV[4] or $passphrase = "";
|
|
||||||
|
|
||||||
if ($tempPackageDir eq "") {
|
|
||||||
my ($templateVolume, $templatePath, $templateFileName) = File::Spec->splitpath($templatepkg);
|
|
||||||
$tempPackageDir = File::Spec->catpath($templateVolume, $templatePath."createpackage_tmp", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
mkpath($tempPackageDir);
|
|
||||||
|
|
||||||
# Generate output pkg basename (i.e. file name without extension)
|
|
||||||
my $pkgoutputbasename = $templatepkg;
|
|
||||||
$pkgoutputbasename =~ s/_template/_$targetplatform/g;
|
|
||||||
$pkgoutputbasename =~ s/_installer\.pkg/_installer___temp\.pkg/g;
|
|
||||||
$pkgoutputbasename =~ s/\.pkg//g;
|
|
||||||
|
|
||||||
# Store output file names to variables
|
|
||||||
my ($dummy1, $dummy2, $pkgoutput) = File::Spec->splitpath($pkgoutputbasename.".pkg");
|
|
||||||
$pkgoutput = $tempPackageDir."/".$pkgoutput;
|
|
||||||
my $sisoutputbasename;
|
|
||||||
if ($signed_sis_name eq "") {
|
|
||||||
$sisoutputbasename = $pkgoutputbasename;
|
|
||||||
$sisoutputbasename =~ s/_$targetplatform//g;
|
|
||||||
$sisoutputbasename =~ s/_installer___temp/_installer/g;
|
|
||||||
$signed_sis_name = $sisoutputbasename.".sis";
|
|
||||||
} else {
|
|
||||||
$sisoutputbasename = $signed_sis_name;
|
|
||||||
if ($sisoutputbasename =~ m/(\.sis$|\.sisx$)/i) {
|
|
||||||
$sisoutputbasename =~ s/$1//i;
|
|
||||||
} else {
|
|
||||||
$signed_sis_name = $signed_sis_name.".sis";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $installer_unsigned_app_sis_name = "";
|
|
||||||
my $installer_app_sis_name = "";
|
|
||||||
|
|
||||||
if ($templatepkg =~ m/_installer\.pkg$/i && $onlyUnsigned) {
|
|
||||||
$installer_unsigned_app_sis_name = $templatepkg;
|
|
||||||
$installer_unsigned_app_sis_name =~ s/_installer.pkg$/_unsigned.sis/i;
|
|
||||||
$installer_app_sis_name = $installer_unsigned_app_sis_name;
|
|
||||||
$installer_app_sis_name =~ s/_unsigned.sis$/.sis/;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis";
|
|
||||||
my $stub_sis_name = $sisoutputbasename.".sis";
|
|
||||||
|
|
||||||
my $certtext = $certificate;
|
|
||||||
|
|
||||||
# Check some pre-conditions and print error messages if needed.
|
|
||||||
unless (length($templatepkg)) {
|
|
||||||
print "\nERROR: Template PKG filename is not defined!\n";
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check template exist
|
|
||||||
stat($templatepkg);
|
|
||||||
unless( -e _ ) {
|
|
||||||
print "\nERROR: Package description file '$templatepkg' does not exist!\n";
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check certifcate preconditions and set default certificate variables if needed
|
|
||||||
if (length($certificate)) {
|
|
||||||
unless(length($key)) {
|
|
||||||
print "\nERROR: Custom certificate key file parameter missing.!\n";
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#If no certificate is given, check default options
|
|
||||||
my $scriptpath = dirname(__FILE__);
|
|
||||||
my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs");
|
|
||||||
|
|
||||||
unless (-e $certpath) {
|
|
||||||
my $qmakeCmd = File::Spec->catfile($scriptpath, "qmake");
|
|
||||||
$certpath = `$qmakeCmd -query QT_INSTALL_PREFIX`;
|
|
||||||
$certpath =~ s/\s+$//;
|
|
||||||
$certpath = File::Spec->catdir($certpath, "src/s60installs");
|
|
||||||
}
|
|
||||||
|
|
||||||
$certtext = "RnD";
|
|
||||||
$certificate = File::Spec->catfile($certpath, "rd.cer");
|
|
||||||
$key = File::Spec->catfile($certpath, "rd-key.pem");
|
|
||||||
|
|
||||||
stat($certificate);
|
|
||||||
unless( -e _ ) {
|
|
||||||
$certtext = "Self Signed";
|
|
||||||
$certificate = File::Spec->catfile($certpath, "selfsigned.cer");
|
|
||||||
$key = File::Spec->catfile($certpath, "selfsigned.key");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Read the certificates from file to two dimensional array
|
|
||||||
my @certificates;
|
|
||||||
if (length($certfile)) {
|
|
||||||
open CERTFILE, "<$certfile" or die $!;
|
|
||||||
while(<CERTFILE>){
|
|
||||||
s/#.*//; # ignore comments by erasing them
|
|
||||||
next if /^(\s)*$/; # skip blank lines
|
|
||||||
chomp; # remove trailing newline characters
|
|
||||||
my @certinfo = split(';', $_); # split row to certinfo
|
|
||||||
|
|
||||||
# Trim spaces
|
|
||||||
for(@certinfo) {
|
|
||||||
s/^\s+//;
|
|
||||||
s/\s+$//;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Do some validation
|
|
||||||
unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {
|
|
||||||
print "\nERROR: $certfile line '$_' does not contain valid information!\n";
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
push @certificates, [@certinfo]; # push data to two dimensional array
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove any existing .sis packages
|
|
||||||
unlink $unsigned_sis_name;
|
|
||||||
if (!$onlyUnsigned) {
|
|
||||||
unlink $signed_sis_name;
|
|
||||||
}
|
|
||||||
unlink $pkgoutput;
|
|
||||||
|
|
||||||
# Preprocess PKG
|
|
||||||
|
|
||||||
local $/;
|
|
||||||
# read template file
|
|
||||||
open( TEMPLATE, $templatepkg) or die "ERROR: '$templatepkg': $!";
|
|
||||||
$_=<TEMPLATE>;
|
|
||||||
close (TEMPLATE);
|
|
||||||
|
|
||||||
# If the pkg file does not contain macros, there is no need for platform or target.
|
|
||||||
if (m/\$\(PLATFORM\)/) {
|
|
||||||
unless (length($platform) && length($target)) {
|
|
||||||
print "\nERROR: Platform or target is not defined!\n";
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# replace the PKG variables
|
|
||||||
s/\$\(PLATFORM\)/$platform/gm;
|
|
||||||
s/\$\(TARGET\)/$target/gm;
|
|
||||||
|
|
||||||
if ($installer_unsigned_app_sis_name ne "") {
|
|
||||||
s/$installer_app_sis_name\"/$installer_unsigned_app_sis_name\"/;
|
|
||||||
}
|
|
||||||
|
|
||||||
#write the output
|
|
||||||
open( OUTPUT, ">$pkgoutput" ) or die "ERROR: '$pkgoutput' $!";
|
|
||||||
print OUTPUT $_;
|
|
||||||
close OUTPUT;
|
|
||||||
|
|
||||||
if ($preprocessonly) {
|
|
||||||
# Copy preprocessed file from tmp dir to pkg file dir
|
|
||||||
my ($templateVolume, $templatePath, $templateFileName) = File::Spec->splitpath($templatepkg);
|
|
||||||
my ($dummy1, $dummy2, $copyFileName) = File::Spec->splitpath($pkgoutput);
|
|
||||||
my $copyTarget = File::Spec->catpath($templateVolume, $templatePath, $copyFileName);
|
|
||||||
copy($pkgoutput, $copyTarget) or die "Preprocessed pkg file '$pkgoutput' cannot be copied.";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($stub) {
|
|
||||||
if(!($epocroot)) { die("ERROR: EPOCROOT must be set to create stub sis files"); }
|
|
||||||
my $systeminstall = "${epocroot}epoc32/data/z/system/install";
|
|
||||||
mkpath($systeminstall);
|
|
||||||
my $stub_sis_name = $systeminstall."/".$stub_sis_name;
|
|
||||||
# Create stub SIS.
|
|
||||||
system ("${epocToolsDir}makesis -s $pkgoutput $stub_sis_name");
|
|
||||||
} else {
|
|
||||||
if ($certtext eq "Self Signed"
|
|
||||||
&& !@certificates
|
|
||||||
&& $templatepkg !~ m/_installer\.pkg$/i
|
|
||||||
&& !$onlyUnsigned) {
|
|
||||||
my $patch_capabilities = File::Spec->catfile(dirname($0), "patch_capabilities");
|
|
||||||
if ($dontPatchCaps) {
|
|
||||||
system ("$patch_capabilities -c $pkgoutput") and print ("Warning: Package check for self-signing viability failed. Installing the package on a device will most likely fail!\n\n");
|
|
||||||
} else {
|
|
||||||
print("Auto-patching self-signed package.\n");
|
|
||||||
system ("$patch_capabilities -t $tempPackageDir $pkgoutput") and die ("ERROR: Automatic patching failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create SIS.
|
|
||||||
# The 'and' is because system uses 0 to indicate success.
|
|
||||||
system ("${epocToolsDir}makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed");
|
|
||||||
|
|
||||||
print("\n");
|
|
||||||
|
|
||||||
my $targetInsert = "";
|
|
||||||
if ($targetplatform ne "-") {
|
|
||||||
$targetInsert = " for $targetplatform";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($onlyUnsigned) {
|
|
||||||
stat($unsigned_sis_name);
|
|
||||||
if( -e _ ) {
|
|
||||||
print ("Successfully created unsigned package ${unsigned_sis_name}${targetInsert}!\n");
|
|
||||||
} else {
|
|
||||||
print ("\nUnsigned package creation failed!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
print ("\n");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Sign SIS with certificate info given as an argument.
|
|
||||||
my $relcert = File::Spec->abs2rel($certificate);
|
|
||||||
my $relkey = File::Spec->abs2rel($key);
|
|
||||||
# The 'and' is because system uses 0 to indicate success.
|
|
||||||
system ("${epocToolsDir}signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("ERROR: signsis failed");
|
|
||||||
|
|
||||||
# Check if creating signed SIS Succeeded
|
|
||||||
stat($signed_sis_name);
|
|
||||||
if( -e _ ) {
|
|
||||||
print ("Successfully created signed package ${signed_sis_name}${targetInsert} using certificate: $certtext!\n");
|
|
||||||
|
|
||||||
# Sign with additional certificates & keys
|
|
||||||
for my $row ( @certificates ) {
|
|
||||||
# Get certificate absolute file names, relative paths are relative to certfilepath
|
|
||||||
my $relcert = File::Spec->abs2rel(File::Spec->rel2abs( $row->[0], $certfilepath));
|
|
||||||
my $relkey = File::Spec->abs2rel(File::Spec->rel2abs( $row->[1], $certfilepath));
|
|
||||||
|
|
||||||
system ("${epocToolsDir}signsis $signed_sis_name $signed_sis_name $relcert $relkey $row->[2]");
|
|
||||||
print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
# remove temporary unsigned sis
|
|
||||||
if (!$preserveUnsigned) {
|
|
||||||
unlink $unsigned_sis_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install the sis if requested
|
|
||||||
if ($install) {
|
|
||||||
print ("\nInstalling $signed_sis_name...\n");
|
|
||||||
system ("$signed_sis_name");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
# Lets leave the generated PKG for problem solving purposes
|
|
||||||
print ("\nSIS creation failed!\n");
|
|
||||||
}
|
|
||||||
print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#end of file
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
scriptpath=`dirname $0`
|
|
||||||
perl $scriptpath/elf2e32_qtwrapper.pl "$@"
|
|
@ -1,3 +0,0 @@
|
|||||||
@echo off
|
|
||||||
set scriptpath=%~dp0
|
|
||||||
perl %scriptpath%elf2e32_qtwrapper.pl %*
|
|
@ -1,325 +0,0 @@
|
|||||||
#!/usr/bin/perl -w
|
|
||||||
#############################################################################
|
|
||||||
##
|
|
||||||
## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
## Contact: http://www.qt-project.org/
|
|
||||||
##
|
|
||||||
## This file is part of the utilities of the Qt Toolkit.
|
|
||||||
##
|
|
||||||
## $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
## GNU Lesser General Public License Usage
|
|
||||||
## 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.
|
|
||||||
##
|
|
||||||
## GNU General Public License Usage
|
|
||||||
## Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
## Public License version 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 the GNU General
|
|
||||||
## Public License version 3.0 requirements will be met:
|
|
||||||
## http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
##
|
|
||||||
## Other Usage
|
|
||||||
## Alternatively, this file may be used in accordance with the terms and
|
|
||||||
## conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
## $QT_END_LICENSE$
|
|
||||||
##
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
# A script to get around some shortcomings in elf2e32, namely:
|
|
||||||
# - Returning 0 even when there are errors.
|
|
||||||
# - Excluding symbols from the dso file even when they are present in the ELF file.
|
|
||||||
# - Including symbols in the the dso file even when they are not present in the ELF file.
|
|
||||||
# - Overwriting the old dso file even when there are no changes (increases build time).
|
|
||||||
|
|
||||||
use File::Copy;
|
|
||||||
|
|
||||||
my @args = ();
|
|
||||||
my @definput;
|
|
||||||
my @defoutput;
|
|
||||||
my @dso;
|
|
||||||
my @tmpdso;
|
|
||||||
foreach (@ARGV) {
|
|
||||||
if (/^--definput/o) {
|
|
||||||
@definput = split('=', $_);
|
|
||||||
} elsif (/^--defoutput/o) {
|
|
||||||
@defoutput = split('=', $_);
|
|
||||||
} elsif (/^--dso/o) {
|
|
||||||
@dso = split('=', $_);
|
|
||||||
} elsif (/^--tmpdso/o) {
|
|
||||||
@tmpdso = split('=', $_);
|
|
||||||
$tmpdso[0] = "--dso";
|
|
||||||
} else {
|
|
||||||
push(@args, $_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@definput = () if (!@definput || ! -e $definput[1]);
|
|
||||||
|
|
||||||
if (@dso && !@tmpdso || !@dso && @tmpdso) {
|
|
||||||
print("--dso and --tmpdso must be used together.\n");
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $buildingLibrary = (@defoutput && @dso) ? 1 : 0;
|
|
||||||
|
|
||||||
my $fixupFile = "";
|
|
||||||
my $runCount = 0;
|
|
||||||
my $returnCode = 0;
|
|
||||||
|
|
||||||
# For debugging. Make it nonzero to give verbose output.
|
|
||||||
my $debugScript = 1;
|
|
||||||
my @usedDefFiles;
|
|
||||||
sub recordDefFile {
|
|
||||||
return if (!$debugScript);
|
|
||||||
|
|
||||||
my ($msg, $file) = @_;
|
|
||||||
my $content = "$msg, $file:\n";
|
|
||||||
my $defFileFd;
|
|
||||||
if (!open($defFileFd, "< $file")) {
|
|
||||||
print("Warning: Could not open $file (for debug analysis)\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while (<$defFileFd>) {
|
|
||||||
$content .= $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
push(@usedDefFiles, $content);
|
|
||||||
}
|
|
||||||
sub printRecordedDefFiles {
|
|
||||||
return if (!$debugScript);
|
|
||||||
|
|
||||||
foreach (@usedDefFiles) {
|
|
||||||
print ("$_\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub missingSymbolMismatch
|
|
||||||
{
|
|
||||||
my $missingSymbolSum = $_[0];
|
|
||||||
|
|
||||||
printRecordedDefFiles;
|
|
||||||
|
|
||||||
print("Bug in the native elf2e32 tool: Number of missing symbols does not\n");
|
|
||||||
print("match number of removed symbols in the output DEF file.\n\n");
|
|
||||||
|
|
||||||
print("Original elf2e32 output:\n");
|
|
||||||
print(" $missingSymbolSum Frozen Export\(s\) missing from the ELF file\n\n");
|
|
||||||
|
|
||||||
print("However $defoutput[1] contains more missing entries than that.\n\n");
|
|
||||||
|
|
||||||
print("This needs to be fixed manually in the DEF file.\n");
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($debugScript) {
|
|
||||||
print("PATH: $ENV{PATH}\n");
|
|
||||||
print("EPOCROOT: $ENV{EPOCROOT}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
if (++$runCount > 2) {
|
|
||||||
printRecordedDefFiles if ($debugScript);
|
|
||||||
print("Internal error in $0, link succeeded, but exports may be wrong.\n");
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $elf2e32Pipe;
|
|
||||||
my $elf2e32Cmd = "elf2e32 @args"
|
|
||||||
. " " . join("=", @definput)
|
|
||||||
. " " . join("=", @defoutput)
|
|
||||||
. " " . join("=", @tmpdso);
|
|
||||||
open($elf2e32Pipe, "$elf2e32Cmd 2>&1 |") or die ("Could not run elf2e32");
|
|
||||||
|
|
||||||
my %fixupSymbols;
|
|
||||||
my $foundBrokenSymbols = 0;
|
|
||||||
my $missingSymbolSum = 0;
|
|
||||||
my $missingSymbolCount = 0;
|
|
||||||
my $errors = 0;
|
|
||||||
while (<$elf2e32Pipe>) {
|
|
||||||
print;
|
|
||||||
if (/Error:/io) {
|
|
||||||
$errors = 1;
|
|
||||||
} elsif (/symbol ([a-z0-9_]+) absent in the DEF file, but present in the ELF file/io) {
|
|
||||||
$fixupSymbols{$1} = 1;
|
|
||||||
$foundBrokenSymbols = 1;
|
|
||||||
} elsif (/([0-9]+) Frozen Export\(s\) missing from the ELF file/io) {
|
|
||||||
$missingSymbolSum = $1;
|
|
||||||
$foundBrokenSymbols = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close($elf2e32Pipe);
|
|
||||||
|
|
||||||
if ($debugScript) {
|
|
||||||
recordDefFile("Run no $runCount, elf2e32 DEF file input", "$definput[1]");
|
|
||||||
recordDefFile("Run no $runCount, elf2e32 DEF file output", "$defoutput[1]");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($errors) {
|
|
||||||
$returnCode = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($buildingLibrary && $runCount == 1) {
|
|
||||||
my $tmpDefFile;
|
|
||||||
my $newDefFile;
|
|
||||||
my $origDefFile;
|
|
||||||
my $savedNewDefFileLine = "";
|
|
||||||
if ($definput[1]) {
|
|
||||||
open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]");
|
|
||||||
}
|
|
||||||
open($newDefFile, "< $defoutput[1]") or die("Could not open $defoutput[1]");
|
|
||||||
open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp");
|
|
||||||
print($tmpDefFile "EXPORTS\n") or die("Could not write to temporary DEF file: $!");
|
|
||||||
$fixupFile = "$defoutput[1].tmp";
|
|
||||||
while (1) {
|
|
||||||
my $origDefLine;
|
|
||||||
my $origSym;
|
|
||||||
my $origOrdinal;
|
|
||||||
my $origExtraData;
|
|
||||||
my $newDefLine;
|
|
||||||
my $newSym;
|
|
||||||
my $newOrdinal;
|
|
||||||
my $newExtraData;
|
|
||||||
my $defLine;
|
|
||||||
my $sym;
|
|
||||||
my $ordinal;
|
|
||||||
my $extraData;
|
|
||||||
if ($definput[1]) {
|
|
||||||
# Read from original def file, and skip non-symbol lines
|
|
||||||
while (1) {
|
|
||||||
$origDefLine = <$origDefFile>;
|
|
||||||
if (defined($origDefLine)) {
|
|
||||||
$origDefLine =~ s/[\n\r]//;
|
|
||||||
if ($origDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) {
|
|
||||||
$origSym = $1;
|
|
||||||
$origOrdinal = $2;
|
|
||||||
$origExtraData = $3;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($savedNewDefFileLine) {
|
|
||||||
# This happens if the new def file was missing an entry.
|
|
||||||
$newDefLine = $savedNewDefFileLine;
|
|
||||||
$newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i or die("$0: Shouldn't happen");
|
|
||||||
$newSym = $1;
|
|
||||||
$newOrdinal = $2;
|
|
||||||
$newExtraData = $3;
|
|
||||||
} else {
|
|
||||||
# Read from new def file, and skip non-symbol lines
|
|
||||||
while (1) {
|
|
||||||
$newDefLine = <$newDefFile>;
|
|
||||||
if (defined($newDefLine)) {
|
|
||||||
$newDefLine =~ s/[\n\r]//;
|
|
||||||
if ($newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) {
|
|
||||||
$newSym = $1;
|
|
||||||
$newOrdinal = $2;
|
|
||||||
$newExtraData = $3;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$savedNewDefFileLine = "";
|
|
||||||
last if (!defined($origDefLine) && !defined($newDefLine));
|
|
||||||
|
|
||||||
if (defined($origOrdinal) && (!defined($newOrdinal) || $origOrdinal != $newOrdinal)) {
|
|
||||||
# If the symbol is missing from the new def file, use the original symbol.
|
|
||||||
$savedNewDefFileLine = $newDefLine;
|
|
||||||
$defLine = $origDefLine;
|
|
||||||
$sym = $origSym;
|
|
||||||
$ordinal = $origOrdinal;
|
|
||||||
$extraData = $origExtraData;
|
|
||||||
} else {
|
|
||||||
$defLine = $newDefLine;
|
|
||||||
$sym = $newSym;
|
|
||||||
$ordinal = $newOrdinal;
|
|
||||||
if ($newExtraData =~ /ABSENT/) {
|
|
||||||
# Special case to keep "DATA [0-9]+" data in absent entries.
|
|
||||||
$extraData = $origExtraData;
|
|
||||||
} else {
|
|
||||||
$extraData = $newExtraData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (exists($fixupSymbols{$sym})) {
|
|
||||||
# Fix symbols that have returned after first being marked ABSENT.
|
|
||||||
$extraData =~ s/ ABSENT//;
|
|
||||||
} elsif ($defLine =~ s/; MISSING://) {
|
|
||||||
# Auto-absent symbols.
|
|
||||||
$extraData .= " ABSENT";
|
|
||||||
if (++$missingSymbolCount > $missingSymbolSum) {
|
|
||||||
missingSymbolMismatch($missingSymbolSum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print($tmpDefFile "\t$sym \@ $ordinal $extraData\n") or die("Could not write to temporary DEF file: $!");
|
|
||||||
}
|
|
||||||
print($tmpDefFile "\n") or die("Could not write to temporary DEF file: $!");
|
|
||||||
close($origDefFile) if ($definput[1]);
|
|
||||||
close($newDefFile);
|
|
||||||
close($tmpDefFile);
|
|
||||||
|
|
||||||
$definput[1] = "$defoutput[1].tmp";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (!$foundBrokenSymbols || $errors) {
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
|
|
||||||
print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n");
|
|
||||||
};
|
|
||||||
|
|
||||||
if ($fixupFile) {
|
|
||||||
unlink($defoutput[1]);
|
|
||||||
move($fixupFile, $defoutput[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit $returnCode if ($returnCode != 0);
|
|
||||||
|
|
||||||
if ($buildingLibrary) {
|
|
||||||
my $differenceFound = 0;
|
|
||||||
|
|
||||||
if (-e $dso[1]) {
|
|
||||||
my $dsoFile;
|
|
||||||
my $tmpdsoFile;
|
|
||||||
my $dsoBuf;
|
|
||||||
my $tmpdsoBuf;
|
|
||||||
open($dsoFile, "< $dso[1]") or die("Could not open $dso[1]");
|
|
||||||
open($tmpdsoFile, "< $tmpdso[1]") or die("Could not open $tmpdso[1]");
|
|
||||||
binmode($dsoFile);
|
|
||||||
binmode($tmpdsoFile);
|
|
||||||
while(read($dsoFile, $dsoBuf, 4096) && read($tmpdsoFile, $tmpdsoBuf, 4096)) {
|
|
||||||
if ($dsoBuf ne $tmpdsoBuf) {
|
|
||||||
$differenceFound = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close($tmpdsoFile);
|
|
||||||
close($dsoFile);
|
|
||||||
} else {
|
|
||||||
$differenceFound = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($differenceFound) {
|
|
||||||
copy($tmpdso[1], $dso[1]) or die("Could not copy $tmpdso[1] to $dso[1]: $!");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
scriptpath=`dirname $0`
|
|
||||||
perl $scriptpath/patch_capabilities.pl "$@"
|
|
@ -1 +0,0 @@
|
|||||||
@perl.exe -S %~dp0patch_capabilities.pl %*
|
|
@ -1,398 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
#############################################################################
|
|
||||||
##
|
|
||||||
## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
## Contact: http://www.qt-project.org/
|
|
||||||
##
|
|
||||||
## This file is part of the S60 port of the Qt Toolkit.
|
|
||||||
##
|
|
||||||
## $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
## GNU Lesser General Public License Usage
|
|
||||||
## 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.
|
|
||||||
##
|
|
||||||
## GNU General Public License Usage
|
|
||||||
## Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
## Public License version 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 the GNU General
|
|
||||||
## Public License version 3.0 requirements will be met:
|
|
||||||
## http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
##
|
|
||||||
## Other Usage
|
|
||||||
## Alternatively, this file may be used in accordance with the terms and
|
|
||||||
## conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##
|
|
||||||
## $QT_END_LICENSE$
|
|
||||||
##
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
#
|
|
||||||
# A script for setting binary capabilities based on .pkg file contents.
|
|
||||||
#
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# Note: Please make sure to output all changes done to the pkg file in a print statements
|
|
||||||
# starting with "Patching: " to ease integration into IDEs!
|
|
||||||
#
|
|
||||||
|
|
||||||
use File::Copy;
|
|
||||||
use File::Spec;
|
|
||||||
use File::Path;
|
|
||||||
|
|
||||||
sub Usage() {
|
|
||||||
print("This script can be used to set capabilities of all binaries\n");
|
|
||||||
print("specified for deployment in a .pkg file.\n");
|
|
||||||
print("If no capabilities are given, the binaries will be given the\n");
|
|
||||||
print("capabilities supported by self-signed certificates.\n\n");
|
|
||||||
print(" *** NOTE: If *_template.pkg file is given and one is using symbian-abld or\n");
|
|
||||||
print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n\n");
|
|
||||||
print(" *** NOTE2: When patching gcce binaries built with symbian-sbsv2 toolchain,\n");
|
|
||||||
print(" armv5 must be specified as platform.\n");
|
|
||||||
print("\nUsage: patch_capabilities.pl [-c|-t tmp_path] pkg_filename [target-platform [capability list]]\n");
|
|
||||||
print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n");
|
|
||||||
print("\nThe parameter -c can be used to just check if package is compatible with self-signing\n");
|
|
||||||
print("without actually doing any patching.\n");
|
|
||||||
print("Explicit capability list cannot be used with -c parameter.\n");
|
|
||||||
print("\nThe parameter -t can be used to specify a dir under which the temporary files are created.\n");
|
|
||||||
print("Defaults to 'patch_capabilities_tmp' under the path to pkg file.\n");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
sub trim($) {
|
|
||||||
my $string = shift;
|
|
||||||
$string =~ s/^\s+//;
|
|
||||||
$string =~ s/\s+$//;
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $epocroot = $ENV{EPOCROOT};
|
|
||||||
my $epocToolsDir = "";
|
|
||||||
if ($epocroot ne "") {
|
|
||||||
$epocroot =~ s,\\,/,g;
|
|
||||||
if ($epocroot =~ m,[^/]$,) {
|
|
||||||
$epocroot = $epocroot."/";
|
|
||||||
}
|
|
||||||
$epocToolsDir = "${epocroot}epoc32/tools/";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $nullDevice = "/dev/null";
|
|
||||||
$nullDevice = "NUL" if ($^O =~ /MSWin/);
|
|
||||||
|
|
||||||
my @capabilitiesToAllow = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData", "Location");
|
|
||||||
my @capabilitiesSpecified = ();
|
|
||||||
|
|
||||||
# If arguments were given to the script,
|
|
||||||
if (@ARGV)
|
|
||||||
{
|
|
||||||
# Parse the first given script argument as a ".pkg" file name.
|
|
||||||
my $pkgFileName = shift(@ARGV);
|
|
||||||
my $justCheck = "";
|
|
||||||
my $msgPrefix = "Patching:";
|
|
||||||
my $tempPatchPath = "";
|
|
||||||
|
|
||||||
if ($pkgFileName eq "-c") {
|
|
||||||
$pkgFileName = shift(@ARGV);
|
|
||||||
$justCheck = true;
|
|
||||||
$msgPrefix = "Warning:";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pkgFileName eq "-t") {
|
|
||||||
$tempPatchPath = shift(@ARGV);
|
|
||||||
$pkgFileName = shift(@ARGV);
|
|
||||||
}
|
|
||||||
|
|
||||||
my ($pkgVolume, $pkgPath, $pkgPlainFileName) = File::Spec->splitpath($pkgFileName);
|
|
||||||
if ($tempPatchPath eq "") {
|
|
||||||
$tempPatchPath = File::Spec->catpath($pkgVolume, $pkgPath."patch_capabilities_tmp", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
mkpath($tempPatchPath);
|
|
||||||
|
|
||||||
# These variables will only be set for template .pkg files.
|
|
||||||
my $target;
|
|
||||||
my $platform;
|
|
||||||
|
|
||||||
# Check if using template .pkg and set target/platform variables
|
|
||||||
if (($pkgFileName =~ m|_template\.pkg$|i) && -r($pkgFileName))
|
|
||||||
{
|
|
||||||
my $targetplatform;
|
|
||||||
my $templateFile;
|
|
||||||
my $templateContents;
|
|
||||||
open($templateFile, "< $pkgFileName") or die ("Could not open $pkgFileName");
|
|
||||||
$templateContents = <$templateFile>;
|
|
||||||
close($templateFile);
|
|
||||||
unless (($targetplatform = shift(@ARGV)) || $templateContents !~ /\$\(PLATFORM\)/)
|
|
||||||
{
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
$targetplatform = "-" if (!$targetplatform);
|
|
||||||
my @tmpvalues = split('-', $targetplatform);
|
|
||||||
$target = $tmpvalues[0];
|
|
||||||
$platform = $tmpvalues[1];
|
|
||||||
|
|
||||||
# Convert visual target to real target (debug->udeb and release->urel)
|
|
||||||
$target =~ s/debug/udeb/i;
|
|
||||||
$target =~ s/release/urel/i;
|
|
||||||
|
|
||||||
if (($platform =~ m/^gcce$/i) && ($ENV{SBS_HOME})) {
|
|
||||||
# Print a informative note in case suspected misuse is detected.
|
|
||||||
print "\nNote: You must use armv5 as platform when packaging gcce binaries built using symbian-sbsv2 mkspec.\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# If the specified ".pkg" file exists (and can be read),
|
|
||||||
if (($pkgFileName =~ m|\.pkg$|i) && -r($pkgFileName))
|
|
||||||
{
|
|
||||||
print ("\n");
|
|
||||||
if ($justCheck) {
|
|
||||||
print ("Checking");
|
|
||||||
} else {
|
|
||||||
print ("Patching");
|
|
||||||
}
|
|
||||||
print (" package file and relevant binaries...\n");
|
|
||||||
|
|
||||||
if (!$justCheck) {
|
|
||||||
# If there are more arguments given, parse them as capabilities.
|
|
||||||
if (@ARGV)
|
|
||||||
{
|
|
||||||
@capabilitiesSpecified = ();
|
|
||||||
while (@ARGV)
|
|
||||||
{
|
|
||||||
push (@capabilitiesSpecified, pop(@ARGV));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start with no binaries listed.
|
|
||||||
my @binaries = ();
|
|
||||||
my $binariesDelimeter = "///";
|
|
||||||
|
|
||||||
my $tempPkgFileName = $tempPatchPath."/__TEMP__".$pkgPlainFileName;
|
|
||||||
|
|
||||||
if (!$justCheck) {
|
|
||||||
unlink($tempPkgFileName);
|
|
||||||
open (NEW_PKG, ">>".$tempPkgFileName);
|
|
||||||
}
|
|
||||||
open (PKG, "<".$pkgFileName);
|
|
||||||
|
|
||||||
my $checkFailed = "";
|
|
||||||
my $somethingPatched = "";
|
|
||||||
|
|
||||||
# Parse each line.
|
|
||||||
while (<PKG>)
|
|
||||||
{
|
|
||||||
my $line = $_;
|
|
||||||
my $newLine = $line;
|
|
||||||
|
|
||||||
# Patch pkg UID if it's in protected range
|
|
||||||
if ($line =~ m/^\#.*\((0x[0-7][0-9a-fA-F]*)\).*$/)
|
|
||||||
{
|
|
||||||
my $oldUID = $1;
|
|
||||||
print ("$msgPrefix UID $oldUID is not compatible with self-signing!\n");
|
|
||||||
|
|
||||||
if ($justCheck) {
|
|
||||||
$checkFailed = true;
|
|
||||||
} else {
|
|
||||||
my $newUID = $oldUID;
|
|
||||||
$newUID =~ s/0x./0xE/i;
|
|
||||||
$newLine =~ s/$oldUID/$newUID/;
|
|
||||||
print ("$msgPrefix Package UID changed to: $newUID.\n");
|
|
||||||
$somethingPatched = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# If the line specifies a file, parse the source and destination locations.
|
|
||||||
if ($line =~ m|^ *\"([^\"]+)\"\s*\-\s*\"([^\"]+)\"|)
|
|
||||||
{
|
|
||||||
my $sourcePath = $1;
|
|
||||||
|
|
||||||
# If the given file is a binary, check the target and binary type (+ the actual filename) from its path.
|
|
||||||
if ($sourcePath =~ m:\w+(\.dll|\.exe)$:i)
|
|
||||||
{
|
|
||||||
# Do preprocessing for template pkg,
|
|
||||||
# In case of template pkg target and platform variables are set
|
|
||||||
if(length($target) && length($platform))
|
|
||||||
{
|
|
||||||
$sourcePath =~ s/\$\(PLATFORM\)/$platform/gm;
|
|
||||||
$sourcePath =~ s/\$\(TARGET\)/$target/gm;
|
|
||||||
}
|
|
||||||
|
|
||||||
my ($dummy1, $dummy2, $binaryBaseName) = File::Spec->splitpath($sourcePath);
|
|
||||||
|
|
||||||
if ($justCheck) {
|
|
||||||
push (@binaries, $binaryBaseName.$binariesDelimeter.$sourcePath);
|
|
||||||
} else {
|
|
||||||
# Copy original files over to patching dir
|
|
||||||
# Patching dir will be flat to make it cleanable with QMAKE_CLEAN, so path
|
|
||||||
# will be collapsed into the file name to avoid name collisions in the rare
|
|
||||||
# case where custom pkg rules are used to install files with same names from
|
|
||||||
# different directories (probably using platform checks to choose only one of them.)
|
|
||||||
my $patchedSourcePath = $sourcePath;
|
|
||||||
$patchedSourcePath =~ s/[\/\\:]/_/g;
|
|
||||||
$patchedSourcePath = "$tempPatchPath/$patchedSourcePath";
|
|
||||||
$newLine =~ s/^.*(\.dll|\.exe)(.*)(\.dll|\.exe)/\"$patchedSourcePath$2$3/i;
|
|
||||||
|
|
||||||
copy($sourcePath, $patchedSourcePath) or die "$sourcePath cannot be copied for patching.";
|
|
||||||
push (@binaries, $binaryBaseName.$binariesDelimeter.$patchedSourcePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEW_PKG $newLine;
|
|
||||||
|
|
||||||
chomp ($line);
|
|
||||||
}
|
|
||||||
|
|
||||||
close (PKG);
|
|
||||||
if (!$justCheck) {
|
|
||||||
close (NEW_PKG);
|
|
||||||
|
|
||||||
unlink($pkgFileName);
|
|
||||||
rename($tempPkgFileName, $pkgFileName);
|
|
||||||
}
|
|
||||||
print ("\n");
|
|
||||||
|
|
||||||
my $baseCommandToExecute = "${epocToolsDir}elftran -vid 0x0 -capability \"%s\" ";
|
|
||||||
|
|
||||||
# Actually set the capabilities of the listed binaries.
|
|
||||||
foreach my $binariesItem(@binaries)
|
|
||||||
{
|
|
||||||
$binariesItem =~ m|^(.*)$binariesDelimeter(.*)$|;
|
|
||||||
my $binaryBaseName = $1;
|
|
||||||
my $binaryPath = $2;
|
|
||||||
|
|
||||||
# Create the command line for setting the capabilities.
|
|
||||||
my $commandToExecute = $baseCommandToExecute;
|
|
||||||
my $executeNeeded = "";
|
|
||||||
if (@capabilitiesSpecified)
|
|
||||||
{
|
|
||||||
$commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesSpecified));
|
|
||||||
$executeNeeded = true;
|
|
||||||
my $capString = join(" ", @capabilitiesSpecified);
|
|
||||||
print ("$msgPrefix Patching the the Vendor ID to 0 and the capabilities used to: \"$capString\" in \"$binaryBaseName\".\n");
|
|
||||||
} else {
|
|
||||||
# Test which capabilities are present and then restrict them to the allowed set.
|
|
||||||
# This avoid raising the capabilities of apps that already have none.
|
|
||||||
my $dllCaps;
|
|
||||||
open($dllCaps, "${epocToolsDir}elftran -dump s $binaryPath |") or die ("ERROR: Could not execute elftran");
|
|
||||||
my $capsFound = 0;
|
|
||||||
my $originalVid;
|
|
||||||
my @capabilitiesToSet;
|
|
||||||
my $capabilitiesToAllow = join(" ", @capabilitiesToAllow);
|
|
||||||
my @capabilitiesToDrop;
|
|
||||||
while (<$dllCaps>) {
|
|
||||||
if (/^Secure ID: ([0-7][0-9a-fA-F]*)$/) {
|
|
||||||
my $exeSid = $1;
|
|
||||||
if ($binaryBaseName =~ /\.exe$/) {
|
|
||||||
# Installer refuses to install protected executables in a self signed package, so abort if one is detected.
|
|
||||||
# We can't simply just patch the executable SID, as any registration resources executable uses will be linked to it via SID.
|
|
||||||
print ("$msgPrefix Executable with SID in the protected range (0x$exeSid) detected: \"$binaryBaseName\". A self-signed sis with protected executables is not supported.\n\n");
|
|
||||||
$checkFailed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (/^Vendor ID: ([0-9a-fA-F]*)$/) {
|
|
||||||
$originalVid = "$1";
|
|
||||||
}
|
|
||||||
if (!$capsFound) {
|
|
||||||
$capsFound = 1 if (/Capabilities:/);
|
|
||||||
} else {
|
|
||||||
$_ = trim($_);
|
|
||||||
if ($capabilitiesToAllow =~ /$_/) {
|
|
||||||
push(@capabilitiesToSet, $_);
|
|
||||||
if (Location =~ /$_/i) {
|
|
||||||
print ("$msgPrefix \"Location\" capability detected for binary: \"$binaryBaseName\". This capability is not self-signable for S60 3rd edition feature pack 1 devices, so installing this package on those devices will most likely not work.\n\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
push(@capabilitiesToDrop, $_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close($dllCaps);
|
|
||||||
if ($originalVid !~ "00000000") {
|
|
||||||
print ("$msgPrefix Non-zero vendor ID (0x$originalVid) is incompatible with self-signed packages in \"$binaryBaseName\"");
|
|
||||||
if ($justCheck) {
|
|
||||||
print (".\n\n");
|
|
||||||
$checkFailed = true;
|
|
||||||
} else {
|
|
||||||
print (", setting it to zero.\n\n");
|
|
||||||
$executeNeeded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($#capabilitiesToDrop) {
|
|
||||||
my $capsToDropStr = join("\", \"", @capabilitiesToDrop);
|
|
||||||
$capsToDropStr =~ s/\", \"$//;
|
|
||||||
|
|
||||||
if ($justCheck) {
|
|
||||||
print ("$msgPrefix The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package: \"$capsToDropStr\".\n\n");
|
|
||||||
$checkFailed = true;
|
|
||||||
} else {
|
|
||||||
if ($binaryBaseName =~ /\.exe$/) {
|
|
||||||
# While libraries often have capabilities they do not themselves need just to enable them to be loaded by wider variety of processes,
|
|
||||||
# executables are more likely to need every capability they have been assigned or they won't function correctly.
|
|
||||||
print ("$msgPrefix Executable with capabilities incompatible with self-signing detected: \"$binaryBaseName\". (Incompatible capabilities: \"$capsToDropStr\".) Reducing capabilities is only supported for libraries.\n");
|
|
||||||
$checkFailed = true;
|
|
||||||
} else {
|
|
||||||
print ("$msgPrefix The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n");
|
|
||||||
$executeNeeded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesToSet));
|
|
||||||
}
|
|
||||||
$commandToExecute .= $binaryPath;
|
|
||||||
|
|
||||||
if ($executeNeeded) {
|
|
||||||
# Actually execute the elftran command to set the capabilities.
|
|
||||||
print ("\n");
|
|
||||||
system ("$commandToExecute > $nullDevice");
|
|
||||||
$somethingPatched = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($checkFailed) {
|
|
||||||
print ("\n");
|
|
||||||
if ($justCheck) {
|
|
||||||
print ("$msgPrefix The package is not compatible with self-signing.\n");
|
|
||||||
} else {
|
|
||||||
print ("$msgPrefix Unable to patch the package for self-singing.\n");
|
|
||||||
}
|
|
||||||
print ("Use a proper developer certificate for signing this package.\n\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($justCheck) {
|
|
||||||
print ("Package is compatible with self-signing.\n");
|
|
||||||
} else {
|
|
||||||
if ($somethingPatched) {
|
|
||||||
print ("NOTE: A patched package may not work as expected due to reduced capabilities and other modifications,\n");
|
|
||||||
print (" so it should not be used for any kind of Symbian signing or distribution!\n");
|
|
||||||
print (" Use a proper certificate to avoid the need to patch the package.\n");
|
|
||||||
} else {
|
|
||||||
print ("No patching was required!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print ("\n");
|
|
||||||
} else {
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Usage();
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
# Empty file since Qt 4.6
|
|
||||||
# I'm too lazy to find all places where this file is included
|
|
||||||
|
|
||||||
symbian{
|
|
||||||
TRY_INCLUDEPATHS = $${EPOCROOT}epoc32 $${EPOCROOT}epoc32/include $${EPOCROOT}epoc32/include/stdapis $${EPOCROOT}epoc32/include/stdapis/sys $$OS_LAYER_LIBC_SYSTEMINCLUDE $$QMAKE_INCDIR $$INCLUDEPATH
|
|
||||||
for(p, TRY_INCLUDEPATHS) {
|
|
||||||
pp = $$join(p, "", "", "/openssl")
|
|
||||||
exists($$pp):INCLUDEPATH *= $$pp
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
SOURCES = openssl.cpp
|
SOURCES = openssl.cpp
|
||||||
CONFIG -= x11 qt
|
CONFIG -= x11 qt
|
||||||
mac:CONFIG -= app_bundle
|
mac:CONFIG -= app_bundle
|
||||||
include(openssl.pri)
|
|
||||||
|
3
configure
vendored
3
configure
vendored
@ -7172,9 +7172,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
|
|||||||
[ "$CFG_SXE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
|
[ "$CFG_SXE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
|
||||||
[ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
|
[ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
|
||||||
|
|
||||||
# ATM we need this define to compile Qt. Remove later!
|
|
||||||
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_S60"
|
|
||||||
|
|
||||||
# X11/Unix/Mac only configs
|
# X11/Unix/Mac only configs
|
||||||
[ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
|
[ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
|
||||||
[ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
|
[ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
|
||||||
|
@ -47,29 +47,8 @@
|
|||||||
\c /usr/share/icons/hicolor/64x64/apps directory
|
\c /usr/share/icons/hicolor/64x64/apps directory
|
||||||
and desktop files in the \c /usr/share/applications/hildon directory.
|
and desktop files in the \c /usr/share/applications/hildon directory.
|
||||||
|
|
||||||
\section1 Creating an icon for Symbian
|
|
||||||
|
|
||||||
Symbian uses Scalable Vector Graphics (SVG Tiny 1.1+) to render
|
|
||||||
application icons in the application menu. Therefore icons could be
|
|
||||||
created manually with a text editor, since SVG files are plain text with
|
|
||||||
XML syntax, but usually you would use a vector graphics program that is
|
|
||||||
able to output SVG files. Popular graphics programs such as Adobe
|
|
||||||
Illustrator or Inkscape are able to do so.
|
|
||||||
|
|
||||||
For best results, the icon should be created on a 44x44 pixel canvas.
|
|
||||||
Otherwise the image might be scaled in unexpected ways.
|
|
||||||
|
|
||||||
Once you have created your icon, make sure that it is stored according to
|
|
||||||
the SVG-Tiny 1.1+ standard. Inkscape, for instance, is not able to save
|
|
||||||
images that way, but there are tools that can convert general SVG files
|
|
||||||
into the Tiny format. For instance, the svg2svgt tool that is bundled with
|
|
||||||
Symbian 3rd and 5th editon SDKs under the folder s60tools can do this
|
|
||||||
conversion to some extent. Another tool to convert SVG to SVG Tiny is SVG
|
|
||||||
Pony.
|
|
||||||
|
|
||||||
\section1 Adding the icons to the project
|
\section1 Adding the icons to the project
|
||||||
|
|
||||||
Edit the .pro file and specify the ICON variable for the symbian target.
|
|
||||||
For Maemo, we need to add that the \c .desktop and icon file should be
|
For Maemo, we need to add that the \c .desktop and icon file should be
|
||||||
installed.
|
installed.
|
||||||
|
|
||||||
|
@ -33,13 +33,6 @@
|
|||||||
scans the current directory for HTML files and prints statistics about
|
scans the current directory for HTML files and prints statistics about
|
||||||
them to standard out.
|
them to standard out.
|
||||||
|
|
||||||
\note Standard out is redirected on some platforms. On Symbian using Open
|
|
||||||
C \c stdout is by default directed to the console window, but this window
|
|
||||||
may not always be visible. To redirect to a file instead, locate the \c
|
|
||||||
c:\\system\\data\\config.ini file (on either the emulator or the device)
|
|
||||||
and change \c STDOUT to point to \c MEDIA4. This will redirect the console
|
|
||||||
to \c c:\\system\\data\\out.txt.
|
|
||||||
|
|
||||||
The files are parsed using a QXmlStreamReader object. If the file does
|
The files are parsed using a QXmlStreamReader object. If the file does
|
||||||
not contain a well-formed XML document, a description of the error is
|
not contain a well-formed XML document, a description of the error is
|
||||||
printed to the standard error console.
|
printed to the standard error console.
|
||||||
|
@ -1,192 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/
|
|
||||||
**
|
|
||||||
** This file is part of the documentation of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:FDL$
|
|
||||||
** GNU Free Documentation License
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Free
|
|
||||||
** Documentation License version 1.3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file included in the packaging of
|
|
||||||
** this file.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms
|
|
||||||
** and conditions contained in a signed written agreement between you
|
|
||||||
** and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*! \example widgets/symbianvibration
|
|
||||||
\group all-examples
|
|
||||||
\title Symbian Vibration Example
|
|
||||||
|
|
||||||
The Symbian Vibrator example shows how to get fine-grained vibration
|
|
||||||
control on Symbian devices.
|
|
||||||
|
|
||||||
Native Symbian APIs have to be used to enable vibration, since QtMobility
|
|
||||||
doesn't provide an interface for it yet. It is, however, planned to be
|
|
||||||
included in a future release. In anticipation for that, we make use of the
|
|
||||||
\c XQVibra class that was a part of the Mobile Extensions Technology Preview
|
|
||||||
API for Qt for Symbian. The pre-compiled libraries are no longer compatible
|
|
||||||
with Qt 4.6, but we can include the source code itself with the project.
|
|
||||||
|
|
||||||
\image symbianvibration-example.png Screenshot of the Symbian Vibration example
|
|
||||||
|
|
||||||
The example application divides the window into rectangles, which can be
|
|
||||||
pressed to make the device vibrate. Pressing different rectangles make the
|
|
||||||
device vibrate with different intensities. Each rectangle has a different
|
|
||||||
color and its intensity number is drawn on top of it. Moving the cursor
|
|
||||||
from one rectangle to another changes the vibration intensity to that of
|
|
||||||
the new one. Vibration stops when the mouse button has been released. It
|
|
||||||
is also possible to launch a short burst of vibration through the menu.
|
|
||||||
|
|
||||||
The example consists of four classes:
|
|
||||||
|
|
||||||
\list
|
|
||||||
\o \c XQVibra is the vibration interface class taken from the Mobile
|
|
||||||
Extensions for Qt for Symbian.
|
|
||||||
|
|
||||||
\o \c XQVibraPrivate is the Symbian specific private implementation of the
|
|
||||||
vibration implementation.
|
|
||||||
|
|
||||||
\o \c VibrationSurface is a custom widget that uses a XQVibra instance to
|
|
||||||
vibrate the device depending on where the user presses.
|
|
||||||
|
|
||||||
\o \c MainWindow inherits from QMainWindow and contains a \c VibrationSurface
|
|
||||||
as its central widget, and also has a menu from which it is possible to
|
|
||||||
make the phone vibrate.
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
\section1 XQVibra Class Definition
|
|
||||||
|
|
||||||
The \c XQVibra class uses the pimpl-idiom to hide the platform specific
|
|
||||||
implementation behind a common interface. Technically it would be possible
|
|
||||||
to support more target platforms, with only the addition of a private
|
|
||||||
implementation. The rest of the code would work the same, since only the
|
|
||||||
common interface is used.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/xqvibra.h 0
|
|
||||||
|
|
||||||
\c XQVibra provides a very simple interface for us to use. The interesting
|
|
||||||
part are the three slots \c start(), \c stop() and \c setIntensity(). Calling the start
|
|
||||||
method initiates vibration for the specified duration. Calling it while the
|
|
||||||
device is already vibrating causes it to stop the current one and start the
|
|
||||||
new one, even if the intensities are the same. The \c setIntensity() method
|
|
||||||
should be called before starting vibration.
|
|
||||||
|
|
||||||
|
|
||||||
\section1 VibrationSurface Class Definition
|
|
||||||
|
|
||||||
\c VibrationSurface inherits from QWidget and acts like a controller for a
|
|
||||||
\c XQVibra object. It responds to mouse events and performs custom painting.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.h 0
|
|
||||||
|
|
||||||
The virtual event methods are reimplemented from QWidget. As can be seen,
|
|
||||||
there is no public programmable interface beyond what QWidget provides.
|
|
||||||
|
|
||||||
|
|
||||||
\section1 VibrationSurface Class Implementation
|
|
||||||
|
|
||||||
Mouse events control the intensity of the vibration.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 0
|
|
||||||
\codeline
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 1
|
|
||||||
\codeline
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 2
|
|
||||||
|
|
||||||
Presses starts the vibration, movement changes the intensity and releases
|
|
||||||
stops the vibration. To set the right amount of vibration, the private
|
|
||||||
method \c applyIntensity() is used. It sets the vibration intensity according to
|
|
||||||
which rectangle the mouse currently resides in.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 3
|
|
||||||
|
|
||||||
We make sure only to change the intensity if it is different than last
|
|
||||||
time, so that the vibrator isn't stopped and restarted unnecessarily.
|
|
||||||
|
|
||||||
The range of vibration intensity ranges from 0 to XQVibra::MaxIntensity. We
|
|
||||||
divide this range into a set of levels. The number of levels and the intensity
|
|
||||||
increase for each level are stored in two constants.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 4
|
|
||||||
|
|
||||||
Each rectangle has an intensity of one \c IntensityPerLevel more than the
|
|
||||||
previous one.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 5
|
|
||||||
|
|
||||||
The rectangles are either put in a row, if the widget's width is greater
|
|
||||||
than its height (landscape), otherwise they are put in a column (portrait).
|
|
||||||
Each rectangle's size is thus dependent on the length of the width or the
|
|
||||||
height of the widget, whichever is longer. The length is then divided by
|
|
||||||
the number of levels, which gets us either the height or the width of each
|
|
||||||
rectangle. The dx and dy specify the distance from one rectangle to the
|
|
||||||
next, which is the same as either the width or height of the rectangle.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 6
|
|
||||||
|
|
||||||
For each level of intensity, we draw a rectangle with increasing
|
|
||||||
brightness. On top of the rectangle a text label is drawn, specifying the
|
|
||||||
intesity of this level. We use the rectangle rect as a template for
|
|
||||||
drawing, and move it down or right at each iteration.
|
|
||||||
|
|
||||||
The intensity is calculated by dividing the greater of the width and height
|
|
||||||
into \c NumberOfLevels slices.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 7
|
|
||||||
|
|
||||||
In case the widget's geometry is too small to fit all the levels, the user
|
|
||||||
interface will not work. For simplicity, we just return 0.
|
|
||||||
|
|
||||||
When we know the axis along which the rectangles lie, we can find the one
|
|
||||||
in which the mouse cursor lie.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/vibrationsurface.cpp 8
|
|
||||||
|
|
||||||
The final clamp of the intensity value at the end is necessary in case the
|
|
||||||
mouse coordinate lies outside the widget's geometry.
|
|
||||||
|
|
||||||
|
|
||||||
\section1 MainWindow Class Definition
|
|
||||||
|
|
||||||
Here's the definition of the \c MainWindow class:
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/mainwindow.h 0
|
|
||||||
|
|
||||||
\c MainWindow is a top level window that uses a \c XQVibra and a
|
|
||||||
\c VibrationSurface. It also adds a menu option to the menu bar which can
|
|
||||||
start a short vibration.
|
|
||||||
|
|
||||||
\section1 MainWindow Class Implementation
|
|
||||||
|
|
||||||
In the \c MainWindow constructor the \c XQVibra and the \c VibrationSurface
|
|
||||||
are created. An action is added to the menu and is connected to the vibrate
|
|
||||||
slot.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/mainwindow.cpp 0
|
|
||||||
|
|
||||||
The \c vibrate() slot offers a way to invoke the vibration in case no
|
|
||||||
mouse is present on the device.
|
|
||||||
|
|
||||||
\snippet examples/widgets/symbianvibration/mainwindow.cpp 1
|
|
||||||
|
|
||||||
\section1 Symbian Vibration Library
|
|
||||||
|
|
||||||
The \c XQVibra class requires a platform library to be included. It is
|
|
||||||
included in the \c .pro file for the symbian target.
|
|
||||||
|
|
||||||
\quotefromfile examples/widgets/symbianvibration/symbianvibration.pro
|
|
||||||
\skipto /^symbian \{/
|
|
||||||
\printuntil /^\}/
|
|
||||||
*/
|
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
@ -253,10 +253,6 @@ protected:
|
|||||||
void resizeEvent(QResizeEvent*) {
|
void resizeEvent(QResizeEvent*) {
|
||||||
#if defined(Q_OS_WINCE_WM)
|
#if defined(Q_OS_WINCE_WM)
|
||||||
touchDevice = true;
|
touchDevice = true;
|
||||||
#elif defined(Q_OS_SYMBIAN)
|
|
||||||
// FIXME: use HAL
|
|
||||||
if (width() > 480 || height() > 480)
|
|
||||||
touchDevice = true;
|
|
||||||
#else
|
#else
|
||||||
touchDevice = false;
|
touchDevice = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,8 +2,6 @@ HEADERS = mainwindow.h
|
|||||||
SOURCES = main.cpp \
|
SOURCES = main.cpp \
|
||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
|
|
||||||
# App cannot be with name "calendar" in Symbian due to same named system component.
|
|
||||||
|
|
||||||
# install
|
# install
|
||||||
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext/calendar
|
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext/calendar
|
||||||
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS calendar.pro
|
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS calendar.pro
|
||||||
|
@ -9,8 +9,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/imageviewer
|
|||||||
INSTALLS += target sources
|
INSTALLS += target sources
|
||||||
|
|
||||||
|
|
||||||
#Symbian has built-in component named imageviewer so we use different target
|
|
||||||
|
|
||||||
wince*: {
|
wince*: {
|
||||||
DEPLOYMENT_PLUGIN += qjpeg qgif
|
DEPLOYMENT_PLUGIN += qjpeg qgif
|
||||||
}
|
}
|
||||||
|
30
qtbase.pro
30
qtbase.pro
@ -35,9 +35,9 @@ contains(PROJECTS, tests) {
|
|||||||
message(Unknown PROJECTS: $$PROJECTS)
|
message(Unknown PROJECTS: $$PROJECTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
!symbian: confclean.depends += clean
|
confclean.depends += clean
|
||||||
confclean.commands =
|
confclean.commands =
|
||||||
unix:!symbian {
|
unix {
|
||||||
confclean.commands += (cd config.tests/unix/stl && $(MAKE) distclean); \
|
confclean.commands += (cd config.tests/unix/stl && $(MAKE) distclean); \
|
||||||
(cd config.tests/unix/endian && $(MAKE) distclean); \
|
(cd config.tests/unix/endian && $(MAKE) distclean); \
|
||||||
(cd config.tests/unix/ipv6 && $(MAKE) distclean); \
|
(cd config.tests/unix/ipv6 && $(MAKE) distclean); \
|
||||||
@ -88,32 +88,6 @@ win32 {
|
|||||||
-$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \
|
-$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \
|
||||||
(cd qmake && $(MAKE) distclean)
|
(cd qmake && $(MAKE) distclean)
|
||||||
}
|
}
|
||||||
symbian {
|
|
||||||
confclean.depends += distclean
|
|
||||||
contains(QMAKE_HOST.os, "Windows") {
|
|
||||||
confclean.commands += \
|
|
||||||
(cd src\\tools\\moc && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
(cd src\\tools\\rcc && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
(cd src\\tools\\uic && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) src\\corelib\\global\\qconfig.h $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) src\\corelib\\global\\qconfig.cpp $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) mkspecs\\qconfig.pri $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) mkspecs\\qmodule.pri $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \
|
|
||||||
(cd qmake && $(MAKE) distclean)
|
|
||||||
} else {
|
|
||||||
confclean.commands += \
|
|
||||||
(cd src/tools/moc && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
(cd src/tools/rcc && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
(cd src/tools/uic && $(MAKE) distclean) $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) src/corelib/global/qconfig.h $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) src/corelib/global/qconfig.cpp $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) mkspecs/qconfig.pri $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) mkspecs/qmodule.pri $$escape_expand(\\n\\t) \
|
|
||||||
-$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \
|
|
||||||
(cd qmake && $(MAKE) distclean)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QMAKE_EXTRA_TARGETS += confclean
|
QMAKE_EXTRA_TARGETS += confclean
|
||||||
qmakeclean.commands += (cd qmake && $(MAKE) clean)
|
qmakeclean.commands += (cd qmake && $(MAKE) clean)
|
||||||
QMAKE_EXTRA_TARGETS += qmakeclean
|
QMAKE_EXTRA_TARGETS += qmakeclean
|
||||||
|
@ -1848,8 +1848,6 @@ void tst_QDir::equalityOperator_data()
|
|||||||
//need a path in the root directory that is unlikely to be a symbolic link.
|
//need a path in the root directory that is unlikely to be a symbolic link.
|
||||||
#if defined (Q_OS_WIN)
|
#if defined (Q_OS_WIN)
|
||||||
QString pathinroot("c:/windows/..");
|
QString pathinroot("c:/windows/..");
|
||||||
#elif defined (Q_OS_SYMBIAN)
|
|
||||||
QString pathinroot("c:/data/..");
|
|
||||||
#else
|
#else
|
||||||
QString pathinroot("/sbin/..");
|
QString pathinroot("/sbin/..");
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,5 +25,4 @@ wince* {
|
|||||||
DEFINES += SRCDIR=\\\".\\\"
|
DEFINES += SRCDIR=\\\".\\\"
|
||||||
} else {
|
} else {
|
||||||
DEFINES+= SRCDIR=\\\"$$PWD\\\"
|
DEFINES+= SRCDIR=\\\"$$PWD\\\"
|
||||||
TARGET.CAPABILITY = NetworkServices
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,3 @@ SUBDIRS=\
|
|||||||
qsystemtrayicon \
|
qsystemtrayicon \
|
||||||
qundogroup \
|
qundogroup \
|
||||||
qundostack \
|
qundostack \
|
||||||
|
|
||||||
symbian:SUBDIRS -= \
|
|
||||||
qsystemtrayicon \
|
|
||||||
|
|
||||||
|
@ -44,26 +44,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
#if defined(Q_OS_UNIX)
|
||||||
# include <e32std.h>
|
|
||||||
typedef RMutex NativeMutexType;
|
|
||||||
void NativeMutexInitialize(NativeMutexType *mutex)
|
|
||||||
{
|
|
||||||
mutex->CreateLocal();
|
|
||||||
}
|
|
||||||
void NativeMutexDestroy(NativeMutexType *mutex)
|
|
||||||
{
|
|
||||||
mutex->Close();
|
|
||||||
}
|
|
||||||
void NativeMutexLock(NativeMutexType *mutex)
|
|
||||||
{
|
|
||||||
mutex->Wait();
|
|
||||||
}
|
|
||||||
void NativeMutexUnlock(NativeMutexType *mutex)
|
|
||||||
{
|
|
||||||
mutex->Signal();
|
|
||||||
}
|
|
||||||
#elif defined(Q_OS_UNIX)
|
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
typedef pthread_mutex_t NativeMutexType;
|
typedef pthread_mutex_t NativeMutexType;
|
||||||
|
@ -5,6 +5,3 @@ CONFIG += console
|
|||||||
# Input
|
# Input
|
||||||
SOURCES += qget.cpp
|
SOURCES += qget.cpp
|
||||||
HEADERS += qget.h
|
HEADERS += qget.h
|
||||||
|
|
||||||
symbian: TARGET.CAPABILITY += ReadUserData NetworkServices
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user