?? symbian.cf
字號:
for x in ordinalInfo[1:] : dllStub.write(",\n") dllStub.write(" {\"%s\", %d}" % (x[1], x[0])) dllStub.write("\n};\n") dllStub.write("\n") dllStub.write("extern \"C\"\n") if(project.IsDefined('HELIX_CONFIG_MICROCORE_DLL_STUB')): dllStub.write("int %s(const SymbolEntry*& pMap, int& magic)\n" % symbol2OrdinalFunc) dllStub.write("{\n") dllStub.write(" magic = 0x23aaff42;\n") dllStub.write(" pMap = z_symbolTable;\n") dllStub.write(" return sizeof(z_symbolTable) / sizeof(SymbolEntry);\n") dllStub.write("}\n") else: dllStub.write("int %s(const char* pSymbolName)\n" % symbol2OrdinalFunc) dllStub.write("{\n") dllStub.write(" int ret = 0;\n") dllStub.write(" int numSymbols = sizeof(z_symbolTable) / sizeof(struct SymbolEntry);\n") dllStub.write(" int i;\n") dllStub.write(" if( NULL != pSymbolName )\n") dllStub.write(" {\n") dllStub.write(" for(i = 0; !ret && (i < numSymbols); i++)\n") dllStub.write(" {\n") dllStub.write(" if (!strcmp(pSymbolName, z_symbolTable[i].m_pSymbolName))\n") dllStub.write(" {\n"); dllStub.write(" ret = z_symbolTable[i].m_ordinal;\n") dllStub.write(" break;\n") dllStub.write(" }\n") dllStub.write(" }\n") dllStub.write(" }\n") dllStub.write(" return ret;\n") dllStub.write("}\n") dllStub.close() # Add the stub to the source list project.AddSources(stubSourceName)## Create a global instance to use.project.symbianUtil = SymbianUtils()def HandleSymbianStuff(args): # Generate the DLL stubs if we need to if project.target_type == "dll": ordinalInfo = project.symbianUtil.generate_ordinal_info() project.symbianUtil.generate_ordinal_file(ordinalInfo) project.symbianUtil.generate_dll_stub_code(ordinalInfo) # Compile any symbian resource files that # were specified project.symbianUtil.compile_resources() # Create UID file if we need to if ((project.target_type == "dll") or (project.target_type == "exe")): project.symbianUtil.write_uid_file()AddUmakeCallback(HandleSymbianStuff, None)def SetSymbianProgramTargetType(type): """ Set exe suffix and build type for Symbian polymorphic dll. Used with ProgramTarget() in module pcf. """ if (type not in ['mdl', 'app', 'mmf']): raise "unrecognized Symbian program target type '%s'" % type project.AddBuildOption("make-%s" % type) # in most cases (app, mdl) the type is the same as the dll extension if(type == "mmf"): platform.exe_suffix="dll" else: platform.exe_suffix=type class SymbianPkg: def __init__(self, name, appFolderName, langs = ["EN"]): self.name = name self.langs = langs self.files = [] self.depends = [] self.names = None self.uid = None self.major = None self.minor = None self.build = None self.options = None self.type = None self.appDest = "!:\\system\\apps\\%s" % (appFolderName) def SetHeader(self, names, uid, major, minor, build, options = None, type = None): self.names = names self.uid = uid self.major = major self.minor = minor self.build = build self.options = options self.type = type def AddPackageDependency(self, uid, major, minor, build, type): self.depends.append((uid, major, minor, build, type)) def AddFile(self, source, dest = None, args = None): ''' if dest is empty, install to app dir if dest begins with '!' install to dest if dest does not begin with '!', assume relative to app dir ''' if not dest: # install to app dir #path = string.split(source, "\\") #dest = "%s\\%s" % (self.appDest, path[-1]) file = os.path.basename(source) if not file: raise "bad input to AddFile" dest = "%s\\%s" % (self.appDest, file) elif (dest[0] != "!"): # intall to dest # get rid of leading backslash if (dest[0] == "\\"): dest = dest[1:] dest = "%s\\%s" % (self.appDest, dest) self.files.append((source, dest, args)) def Generate(self): ''' write out the package file ''' pkgname = "%s.pkg" % self.name f = open(pkgname, "w") # format langs f.write("&%s\n" % string.join(self.langs, ", ")) # format header names = string.join(self.names, "\"}, {\"") if self.options: options = ", %s" % string.join(self.options, ", ") else: options = "" if self.type: type = ", TYPE=%s" % self.type else: type = "" f.write("# {\"%s\"}, (0x%08x), %u, %u, %u%s%s\n" % (names, self.uid, self.major, self.minor, self.build, options, type)) # format dependency headers for (uid, major, minor, build, type) in self.depends: f.write("(0x%08x), %u, %u, %u, {\"%s\"}\n" % (uid, major, minor, build, type)) # format files for (source, dest, args) in self.files: if args: args = ", %s" % string.join(args, ",") else: args = "" f.write("\"%s\" - \"%s\"%s\n" % (source, dest, args)) f.close() def CreateMakefile(self, sisname = None): ''' write makefile that builds sis ''' pkgname = "%s.pkg" % self.name if not sisname: sisname = "%s.sis" % self.name # output makefile instructions to build the .sis project.writeln("all: %s" % sisname) project.writeln("\n") project.writeln("%s:" % sisname) project.writeln("\tmakesis -v %s %s" % (pkgname, sisname)) project.writeln("\n") project.writeln("depend:") project.writeln("\n") project.writeln("clean:") project.writeln("\trm -rf %s" % sisname) project.writeln("\n") project.writeln("copy:") project.writeln("\tcopy %s %s" % (sisname, project.target_dir)) project.writeln("\n") project.writeln("install: %s" % sisname) if (string.find(sysinfo.id, 'emulator') != -1): # copy to emulator install folder so you can use emulator installer to install sis emulSisInstallDir = os.path.join(GetSDKPath('SYMBIANSDK'), "Epoc32\\wins\\c\\nokia\\installs\\") project.writeln("\tcopy %s %s" % (sisname, emulSisInstallDir)) project.writeln("\n")## Add in the symbian SDK specific paths here....for inc in ['EPOC32\include', 'EPOC32\include\libc']: project.AddIncludes('%s' % os.path.join(GetSDKPath('SYMBIANSDK'), inc))project.AddSystemLibraries("estlib.lib", "euser.lib" );#### The MakeDir, SubDirMake, MakeDepend and Versioning classes are## common to all SDK targets. The compiler and linker classes## will differ however.## class SymbianMakeDir(Command): def __init__(self): self.make_var = '' self.make_flags = '' def execute(self, dir): return 'if NOT exist "%s" mkdir "%s"' % (dir, dir)platform.mkdir = SymbianMakeDir()class SymbianSubdirMake(Command): def __init__(self): self.make_var = '' self.make_flags = '' def execute(self, subdir, indent, post_str): return indent + 'cd ' + subdir + '\n' + \ indent + platform.make.execute() + post_str + '\n' + \ indent + 'cd ' + os.pardir platform.subdir_make = SymbianSubdirMake()class SymbianVersioning(Versioning): def create_dll_name(self, target, path = ''): if project.versioning_off: return '%s.%s' % (target, platform.dll_suffix) self.get_version(target, path) new_name = self.get_name(target, path) if new_name == '': new_name = target[0:4] return '%s%s%s%s.%s' % ( new_name, platform.name[3:6], self.version[0], self.version[1], platform.dll_suffix) platform.versioning = SymbianVersioning()class SymbianMakeDepend(MakeDepend): def execute(self, sources, output_dir): list = [] if project.object_dir: list.append("/t%s" % (project.object_dir)) list.append("/m%s" % (project.makefile_name)) cmd = "python %s %s %s %s %s" % ( os.path.join(BUILD_ROOT, "bin", "mkdepend"), string.join(list), platform.form_var("DEFINES"), platform.form_var("INCLUDES"), sources) return cmd def setup_flags_var(self): return ""platform.make_dep = SymbianMakeDepend()## ************** class Symbian AIF *************#class SymbianAIF: ''' for creating Symbian application information file ''' def __init__(self, sourceDir, inputRssName, iconList): ''' source dir is where input rss and icons are located ''' self.sourceDir = sourceDir self.inputRss = os.path.join(sourceDir, inputRssName) self.iconList = iconList self.tempDir = os.getcwd() self.includeDirs = [] def SetTempDir(self, dir): ''' optional: specify working directory ''' self.tempDir = dir def AddIncludeDir(self, dir): ''' optional: add an include directory to pass to aif compiler ''' self.includeDirs.append(dir) def Generate(self, aifOutputName): ''' generate aif named 'aifOutputName' ''' # add '/c12{sourcedir}\' to each icon name for aif compiler argument iconArgPrefix = "/c12%s\\" % self.sourceDir finalIconList = AddPrefixForEach(iconArgPrefix , self.iconList) iconArg = '-b"' + string.join(finalIconList, " ") + '"' # include path includeArg = "" for dir in self.includeDirs: includeArg = includeArg + '-I"%s" ' % dir # run command to build aif cmd = 'perl -S epocaif.pl -o"%s" "%s" -t"%s" %s %s' % (aifOutputName, self.inputRss, self.tempDir, iconArg, includeArg) os.system("echo %s" % cmd) res = os.system(cmd) if res: raise "*** aif generation failed (%s) ***" % res## ************* helper functions used in some symbian python scripts ***************#def AddPrefixForEach(base, nameList): '''add 'base' prefix to each item in the list''' newList = [] for name in nameList: newList.append(base + name) return newListdef EnsureDirExists(path): '''ensure path exists, creating all intermediate directories if necessary''' if (not os.path.exists(path) ): os.path.makedirs(path)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -