×
Namespaces

Variants
Actions

SIS File Production

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
CompatibilityArticle
Created: lenclud (09 May 2009)
Last edited: hamishwillee (30 May 2013)
Producing a SIS file is an important part of any S60 software release process. Over the years I have been using different strategies to produce my SIS files.

Before Symbian OS 9 running a simple makesis from the command line was enough. Since Symbian OS 9 SIS files have to be signed making the production process more complicated.

Acting as a release engineer for third party application developers I came up with a process involving perl scripts and usage of the C++ pre-compiler to pre-process PKG thus providing limitless SIS configuration.

Lately the trend driven by Carbide.C++ has been to use $(ENVVAR) to make your PKG generic. Developers even came up with similar strategy that integrates into the Symbian build tool chain by using makefiles and perl scripts. See How do I use the same pkg file for debug and release builds? .

Inspired by this solution and my previous experiences I came up with the following process:

  • Have a gnumake file generating your SIS file as the final step of your build process
  • Pass your generic PKG template including an HRH file through the C++ pre-compiler
  • Optionally use a perl script to increment your build number in your HRH file


Here is what it looks like.

Contents

BLD.INF file

This is a standard compliant Symbian bld.inf file that will allow you to generate a SIS file with automatic build number increment whenever you do a target build.

PRJ_PLATFORMS
WINSCW ARMV5 GCCE
 
PRJ_EXPORTS
 
PRJ_MMPFILES
 
gnumakefile bldinc.mk
gnumakefile icons_aif_scalable_dc.mk
MyApp.mmp
gnumakefile sis.mk

SIS.MK file

This is the GNU make file responsible to process your PKG template and make and sign the SIS file.

TARGETDIR=../sis
CERTDIR=../../Certificates
TARGETSISFILE=$(TARGETDIR)/MyApp.sis
TARGETPKGFILE=$(TARGETDIR)/MyApp.target.pkg
SOURCEPKGFILE=$(TARGETDIR)/MyApp.pkg
 
SOURCECERFILE=$(CERTDIR)/MyCert.cer
SOURCEKEYFILE=$(CERTDIR)/MyCert.key
PASSWORD=mypassword
 
do_nothing :
@rem do_nothing
 
MAKMAKE : do_nothing
 
BLD : do_nothing
 
CLEAN : do_nothing
 
LIB : do_nothing
 
CLEANLIB : do_nothing
 
RESOURCE : do_nothing
 
FREEZE : do_nothing
 
SAVESPACE : do_nothing
 
RELEASABLES :
@echo $(TARGETSISFILE)
 
ifeq (GCCE,$(findstring GCCE, $(PLATFORM)))
FINAL :
#Ideally we should have dependencies on every file included in PKG, not sure how to do that though
#$(TARGETPKGFILE) $(TARGETSISFILE) : $(SOURCEPKGFILE) $(SOURCEKEYFILE) $(SOURCECERFILE)
@echo EPOCROOT=$(EPOCROOT)
#Delete existing sis file
cmd erase $(TARGETSISFILE)
#Pass the PKG through the CPP precompiler
@echo cpp -P $(SOURCEPKGFILE) $(TARGETPKGFILE)
cpp -P $(SOURCEPKGFILE) $(TARGETPKGFILE)
#Use perl to run maksis as it would not work otherwise
@echo perl -e "print `makesis -d%EPOCROOT% $(TARGETPKGFILE) $(TARGETSISFILE)`"
perl -e "print `makesis -d%EPOCROOT% $(TARGETPKGFILE) $(TARGETSISFILE)`"
#Sign the SIS file
@echo signsis -v -s $(TARGETSISFILE) $(TARGETSISFILE) $(SOURCECERFILE) $(SOURCEKEYFILE) $(PASSWORD)
signsis -v -s $(TARGETSISFILE) $(TARGETSISFILE) $(SOURCECERFILE) $(SOURCEKEYFILE) $(PASSWORD)
else
FINAL : do_nothing
endif

MYAPP.PKG file

You can not pass such a PKG file directly to makesis. You need to run it through the C++ pre-compiler first. The GNU make file above does that for you.

&EN
 
#include "../inc/pkg.hrh"
 
; standard SIS file header
PKG_HEADER { PKG_COMPONENT },( PKG_UID ),PKG_VERSION_MAJOR,PKG_VERSION_MINOR,PKG_VERSION_BUILD
 
;Localised Vendor name
%{ PKG_VENDOR }
 
;Unique Vendor name
: PKG_VENDOR
 
;Supports Series 60 v 3.0
[0x101F7961], 0, 0, 0, {"Series60ProductID"}
 
; Display about informations
"..\data\about.txt"-"", FT, TC
 
;Files to install
"epoc32\release\gcce\urel\MyApp.exe" -"!:\sys\bin\MyApp.exe"
"epoc32\data\z\resource\apps\MyApp.r01" -"!:\resource\apps\MyApp.r01"
"epoc32\data\z\private\10003a3f\apps\MyApp_reg.r01" -"!:\private\10003a3f\import\apps\MyApp_reg.r01"
"epoc32\data\z\resource\apps\MyApp_aif.mif" -"!:\resource\apps\MyApp_aif.mif"
"epoc32\data\z\resource\apps\MyApp.mbm" -"!:\resource\apps\MyApp.mbm"

PKG.HRH file

Can be included from PKG, resource RSS files, or C++ code. It has the great advantage of making the version information available from the distribution package, the resources and the code.

#ifndef __PKG_HRH__
#define __PKG_HRH__
 
//Saves us a pre-compiler warning
#define PKG_HEADER #
 
#define PKG_UID 0xbaadf00d
 
#define PKG_VERSION_MAJOR 3
#define PKG_VERSION_MINOR 4
#define PKG_VERSION_BUILD 75
 
#define PKG_VENDOR "MyVendor"
#define PKG_COMPONENT "MyApp"
 
#endif

BLDINC.MK file

This is the GNU make file that will increment your build number directly in your HRH file. You could also merge that file with SIS.MK if you wanted to.

do_nothing :
@rem do_nothing
 
MAKMAKE : do_nothing
 
BLD : do_nothing
 
CLEAN : do_nothing
 
LIB : do_nothing
 
CLEANLIB : do_nothing
 
ifeq (GCCE,$(findstring GCCE, $(PLATFORM)))
RESOURCE :
#Increment the build number
perl ../../../Perl/bin/bldinc.pl ../inc/pkg.hrh PKG_VERSION_BUILD
else
RESOURCE : do_nothing
endif
 
FREEZE : do_nothing
 
SAVESPACE : do_nothing
 
RELEASABLES :
@echo $(TARGETSISFILE)
 
FINAL : do_nothing

BLDINC.PL file

That perl script parses your HRH file and increments the build number.

#
#Developed by Stéphane Lenclud
#
# Increment the specified integer #define macro from the given file
#
#Usage:
#perl bldinc.pl <filename> <macro>
#Example:
#perl bldinc.pl "C:\Dev\Symbian\MyApp\inc\pkg.hrh" PKG_VERSION_BUILD
#
#
 
use File::Spec;
use File::Copy;
use Cwd 'abs_path';
 
use strict;
use warnings;
 
my $fileName=shift; #The directory path to the template project
my $macro=shift; #
 
$fileName = File::Spec->rel2abs($fileName);
 
#Open input file
open INPUT, "< $fileName" or die "Can't read $fileName\n";
my @lines = <INPUT>;
close INPUT;
 
my $success=0;
my $inc=0;
foreach my $line(@lines)
{
if ($line =~ /^\s*#define\s+$macro\s+(\d+)\s*$/)
{
$inc=$1+1;
$line = "#define $macro $inc\n";
$success=1;
last;
}
}
 
die "ERROR: Can't find $macro!" unless ($success);
 
#Open output file
open OUTPUT, "> $fileName" or die "Can't write $fileName\n";
print OUTPUT @lines;
close OUTPUT;
 
print "Build version incremented to: $inc";
 
exit;
This page was last modified on 30 May 2013, at 07:00.
34 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×