⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symbian-81-armv5.cf

📁 linux下的一款播放器
💻 CF
字号:
# -*- python -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Source last modified: $Id: symbian-81-armv5.cf,v 1.2 2004/12/08 22:36:18 pankajgupta Exp $
# 
# Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
# 
# The contents of this file, and the files included with this file,
# are subject to the current version of the RealNetworks Public
# Source License (the "RPSL") available at
# http://www.helixcommunity.org/content/rpsl unless you have licensed
# the file under the current version of the RealNetworks Community
# Source License (the "RCSL") available at
# http://www.helixcommunity.org/content/rcsl, in which case the RCSL
# will apply. You may also obtain the license terms directly from
# RealNetworks.  You may not use this file except in compliance with
# the RPSL or, if you have a valid RCSL with RealNetworks applicable
# to this file, the RCSL.  Please see the applicable RPSL or RCSL for
# the rights, obligations and limitations governing use of the
# contents of the file.
# 
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the
# "GPL") in which case the provisions of the GPL are applicable
# instead of those above. If you wish to allow use of your version of
# this file only under the terms of the GPL, and not to allow others
# to use your version of this file under the terms of either the RPSL
# or RCSL, indicate your decision by deleting the provisions above
# and replace them with the notice and other provisions required by
# the GPL. If you do not delete the provisions above, a recipient may
# use your version of this file under the terms of any one of the
# RPSL, the RCSL or the GPL.
# 
# This file is part of the Helix DNA Technology. RealNetworks is the
# developer of the Original Code and owns the copyrights in the
# portions it created.
# 
# This file, and the files included with this file, is distributed
# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
# ENJOYMENT OR NON-INFRINGEMENT.
# 
# Technology Compatibility Kit Test Suite(s) Location:
#    http://www.helixcommunity.org/content/tck
# 
# Contributor(s):
# 
# ***** END LICENSE BLOCK *****
#
"""Building with the symbian 8.1 sdk for the ARMV5 devices"""

exec_config_file('symbian-81.cf')
exec_config_file('symbian-armv5.cf')

## Define some symbian utilities...
class SymbianUtils:
    def __init__(self):
        self.rss_files = []
        self.rss_includes = []
        self.uid1 = 0
        self.uid2 = 0
        self.uid3 = 0

    def write_uid_file(self):
        # first uid (what kind of binary image)
        KDynamicLibraryUid  = 0x10000079
        KExecutableImageUid = 0x1000007a

        # second uid (what kind of dll or exe)
        KUidApp             = 0x100039ce
        KUidRecognizer      = 0x10003a19

        # third uid = implementation uid

        #
        # for symbian, target_type is 'exe' for .app and .mdl and .mmf (misleading)
        #
        imageType = "unknown"
        if( project.target_type == "dll" ):
            imageType = "dll"

        elif ( project.target_type == "exe" ):
            if (project.BuildOption('make-app') or project.BuildOption('make-mdl') or project.BuildOption('make-mmf')):
                imageType = "dll"
            else:
                imageType = "exe"

        if( self.uid1 == 0 ):
            # set to default value for target type
            if (imageType == "exe"):
                self.uid1 = KExecutableImageUid
            elif (imageType == "dll"):
                self.uid1 = KDynamicLibraryUid
                
        if( self.uid2 == 0 ):
            # set to default value for specific type of target
            if (project.BuildOption('make-app')):
                # app
                self.uid2 = KUidApp
            elif (project.BuildOption('make-mdl')):
                # recognizer
                self.uid2 = KUidRecognizer

        uidpath = '%s.uid.cpp' %( project.target_name)

        fil = open(uidpath, 'w')
#        fil.write('//Umake generated UID file.\n')
#        fil.write('#include <E32STD.H>\n')
#        fil.write('#pragma data_seg(".E32_UID")\n')
        tmp = '__WINS_UID(0x%x, 0x%x, 0x%x)\n' % (self.uid1,
                                            self.uid2,
                                            self.uid3)
#        fil.write(tmp)
#        fil.write('#pragma data_seg()\n')
        fil.close()

        project.AddSources(uidpath)

    def SetUIDs(self, uid1, uid2, uid3 ):
        self.uid1 = uid1
        self.uid2 = uid2
        self.uid3 = uid3

    def AddResourceFiles(self, *args):
        for x in args:
            self.rss_files.append(x)

    def AddResourceIncludes(self, *args):
        for x in args:
            self.rss_includes.append(x)

    def UseARMICompiler(self):
        if 'symbian-thumb' in sysinfo.family_list:
            cxx.cmd = cc.cmd = platform.armi_cxx_cmd
            cxx.args['default'] = cc.args['default'] = platform.armi_cxx_args
            project.AddDefines('__MARM_ARMI__')
            project.RemoveDefines('__MARM_THUMB__')

    def UseARMCCompiler(self):
        if 'symbian-thumb' in sysinfo.family_list:
            cc.cmd = cxx.cmd = platform.armi_cc_cmd
            cc.args['default'] = cxx.args['default'] = platform.armi_cc_args
            project.AddDefines('__MARM_ARMI__')
            project.RemoveDefines('__MARM_THUMB__')

    def compile_resource(self, rss_name):
        # Generate resource file

        if (not os.path.exists(project.output_dir)):
            os.mkdir(project.output_dir)

        baseName = re.match("(.+)\.rss", rss_name).group(1)

        arg_list = []
        arg_list.append("-v -u -t\".\"")
        arg_list.append("-I \"%s\"" % os.path.join(GetSDKPath('SYMBIANSDK'), 'EPOC32\include'))
        for incFile in self.rss_includes:
            arg_list.append('-I "%s"' % incFile) 
       
        arg_list.append("-h\"%s.rsg\"" % baseName)
        arg_list.append("-o\"%s.rsc\"" % os.path.join(project.output_dir,
                                                      os.path.basename(baseName)))
        arg_list.append("%s.rss" % (baseName))

        cmd = "perl -S epocrc.pl %s" % (string.join(arg_list))
        (status, output) = shell.run(cmd)
        print output

        if status:
            raise "*** resource generation failed (%s) ***" % status

    def compile_resources(self):
        for x in self.rss_files:
            self.compile_resource(x)

    def generate_ordinal_info(self):
        # Add info for the symbol to ordinal function.
        # It should always have ordinal 1 assigned to it
        info = [(1, "GetSymbolOrdinal")]

        # Assign ordinals to the exported functions
        ordinal = 2
        for func in project.exported_func:
            info.append((ordinal, func))
            ordinal = ordinal + 1

        return info

    def create_mbm_file(self, mbmpath, headerpath, options, imagelist):
        sep = " %s" % options
        cmd = "bmconv /h%s %s %s%s" % (headerpath, mbmpath, options, string.join(imagelist, sep))
        (status, output) = shell.run(cmd)
        print output

        if status:
            raise "*** mbm generation failed (%s) ***" % status

    def generate_ordinal_file(self, ordinalInfo):
        ordFileName = "%s_ordinal.dat" % project.target_name

        ordFile = open(ordFileName, 'w')
        for x in ordinalInfo :
            ordFile.write("%d %s\n" % (x[0], x[1]))
        ordFile.close()

    def generate_dll_stub_code(self, ordinalInfo):
        stubSourceName = "%s_dll_stub.c" % project.target_name

        # find ordinal 1's function name
        for x in ordinalInfo:
            if (x[0] == 1):
                symbol2OrdinalFunc = x[1]
                break

        dllStub = open(stubSourceName, "w")
        dllStub.write("#include <e32std.h>\n")
        dllStub.write("#include <string.h>\n")
        if(not project.IsDefined('HELIX_CONFIG_MICROCORE_DLL_STUB')):
            dllStub.write("#include \"hxglobalmgr.h\"\n")
        
        dllStub.write("\n")
        dllStub.write("GLDEF_C TInt E32Dll(TDllReason reason)\n")
        dllStub.write("{\n")
        if(not project.IsDefined('HELIX_CONFIG_MICROCORE_DLL_STUB')):
            dllStub.write("    if (reason == EDllProcessDetach)\n")
            dllStub.write("    {\n")
            dllStub.write("        HXGlobalManager* pGM = HXGlobalManager::Instance();\n")
            dllStub.write("        if (pGM)\n")
            dllStub.write("        {\n")
            dllStub.write("            pGM->Shutdown();\n")
            dllStub.write("        }\n")
            dllStub.write("    }\n")

        dllStub.write("    return(KErrNone);\n")
        dllStub.write("}\n")
        dllStub.write("\n")
        dllStub.write("struct SymbolEntry {\n")
        dllStub.write("    const char* m_pSymbolName;\n")
        dllStub.write("    int m_ordinal;\n")
        dllStub.write("};\n")
        dllStub.write("\n")
        dllStub.write("static const struct SymbolEntry z_symbolTable[] = {\n")
        dllStub.write("    {\"%s\", %d}" % (ordinalInfo[0][1], ordinalInfo[0][0]))

        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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -