📄 symbian-thumb.cf
字号:
# -*- python -*-## ***** BEGIN LICENSE BLOCK *****# Source last modified: $Id: symbian-thumb.cf,v 1.3 2004/08/24 23:28:51 hubbe 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 *****#"""Generic symbian thumb .cf file. Common stuff to all symbian thumb builds."""## Read in the *ARMI* symbian config file.exec_config_file('symbian-armi.cf')# store these for laterplatform.armi_cc_cmd = cc.cmdplatform.armi_cc_args = cc.args['default']platform.armi_cxx_cmd = cxx.cmdplatform.armi_cxx_args = cxx.args['default']platform.include_arg = '-I 'platform.define_arg = '-D'platform.object_suffix = 'o'platform.shared_object_suffix = 'o'platform.path_sep = '/'## Symbian PCF file listplatform.pcf_prefix_list[-1:-1] = ['symbian-thumb']platform.pcf_prefix_list.remove('symbian-armi')## Turn these on for device builds.project.AddDefines('__MARM_THUMB__')project.RemoveDefines('__MARM_ARMI__')project.RemoveSystemLibraries("euser.lib" );## Compiler Classclass SymbianTHUMBCompiler(Compiler): def __init__(self): Compiler.__init__(self) def execute(self, target_file, src_file): extra_args = '' return form_string( platform.form_var(self.make_var), platform.form_var(self.make_flags), extra_args, self.target_arg + target_file, self.source_arg, src_file)platform.cc = SymbianTHUMBCompiler()platform.cxx = SymbianTHUMBCompiler()cc = platform.cccxx = platform.cxxcxx.cmd = cc.cmd = '"%s/EPOC32/gcc/bin/thumb-epoc-pe-gcc"' % platform.tool_rootcxx.source_arg = cc.source_arg = '-c'cxx.target_arg = cc.target_arg = '-o 'cxx.make_var = cc.make_var = 'CC'cxx.make_flags = 'CXXFLAGS'cc.make_flags = 'CCFLAGS'cxx.include_arg = cc.include_arg = '-I'cc.prefix_include_arg = '-include 'cxx.args['default'] = '-s -fomit-frame-pointer -mthumb-interwork -nostdinc -fno-builtin -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -Wno-non-virtual-dtor -ffunction-sections -fdata-sections'cc.args['default'] = '-x c++ ' + cxx.args['default']cxx.args['debug'] = cc.args['debug'] = '-g'## no_optimize: no optimization on release buildsif project.BuildOption('no_optimize'): cc.args['release'] = ''else: cc.args['release'] = '-O2'cxx.args['release'] = cc.args['release']class SymbianTHUMBLinker(Linker2): def link_script_path(self): return "%s.lnk" % (project.TargetName()) def write_link_script(self): ## if there are no exported functions, die here if len(project.exported_func) == 0: umake_lib.fatal("dll target without exported functions") path=self.link_script_path() ## create a gcc link script fil = open(path, "w") for export in project.exported_func: fil.write("EXTERN(%s);\n" % (export)) fil.close() return path def armerge_lib_path(self): libname = "%s_libs.%s" % (project.target_name, platform.library_suffix) return os.path.join(project.output_dir, libname) def armerge_tmp_path(self): return os.path.join(project.object_dir, "lib") def AddARMerge(self, cmd_list, static_libs): # # We use the armerge script to merge all the static libs into # one big one so that our one pass linker won't have troubles # with the circular dependancies. After this armerge is run # use mergedlibpath instead of static_libs. # armerge_cmd = os.path.join(BUILD_ROOT, "bin", "armerge") tmpMergePath = self.armerge_tmp_path() mergedLibPath = self.armerge_lib_path() cmd = "python %s -d %s %s %s" % (armerge_cmd, tmpMergePath, mergedLibPath, static_libs) cmd_list.append(cmd) return mergedLibPath def __init__(self): Linker2.__init__(self) ## these are here to emulate the old linker class ## for Umakefil/*.pcf files which do direct modification ## of this class self.def_file = "" self.implib_file = "" self.args = {} self.args["default"] = "" self.args["debug"] = "/debug" self.args["release"] = "/OPT:REF" self.args["dll"] = "" def read_ordinal_file(self, path): fil = open(path, "r") sym_ord_list = [] for line in fil.readlines(): field_list = string.split(line) symbol = string.strip(field_list[1]) ordinal = string.strip(field_list[0]) sym_ord_list.append((symbol, ordinal)) return sym_ord_list def write_def_file(self, path): fil = open(path, 'w') ordinalFilename = "%s_ordinal.dat" % project.target_name if project.target_type == "dll": ## exported functions fil.write("EXPORTS\n") ## check for the data file which defines ordinally-exported ## methods/functions if project.BuildOption("ordinal") and \ os.path.isfile(ordinalFilename): for (symbol, ordinal) in self.read_ordinal_file(ordinalFilename): if '.' in symbol: symbol = '"%s"' % symbol fil.write("\t%s @ %s NONAME R3UNUSED\n" % (symbol, ordinal)) fil.close() def LinkLIB(self, target_path, objects): cmd_list = [] cmd = '-rm %s' % target_path cmd_list.append(cmd) arg_list = ["rv", target_path, objects] cmd = '"%s/EPOC32/gcc/bin/ar" %s' % (platform.tool_root, string.join(arg_list)) cmd_list.append(cmd) cmd = '"%s/EPOC32/gcc/bin/ranlib" %s' % (platform.tool_root, target_path) cmd_list.append(cmd) return cmd_list def CleanLIB(self, target_path): return [target_path] def LinkDLL(self, target_path, objects, static_libs, dynamic_libs): cmd_list = [] baseName = re.match("^(.+)\.dll$", target_path).group(1) mergedLibPath = self.AddARMerge( cmd_list, static_libs) # Generate .def file for this DLL defFileName = "%s.def" % project.target_name self.write_def_file(defFileName) # Generate first .exp file arg_list = ["-m thumb", "--def %s" % defFileName, "--output-exp %s.exp" % baseName, "--dllname %s" % target_path] cmd = '"%s/EPOC32/gcc/bin/dlltool" %s' % (platform.tool_root, string.join(arg_list)) cmd_list.append(cmd) undefines=self.write_link_script() # First link pass arg_list = ["-s", "--thumb-entry _E32Dll", "-u _E32Dll", undefines, "%s.exp" % baseName, "--dll", "--base-file %s.bas" % baseName, "-o %s" % target_path, GetSymbianLibPath("edll.lib"), objects, mergedLibPath, dynamic_libs, GetSymbianLibPath("egcc.lib"), GetSymbianLibPath("euser.lib")] cmd = "python %s ld %s" % ( os.path.join(BUILD_ROOT,"bin","rlink.py"), string.join(arg_list)) cmd_list.append(cmd) cmd = "rm %s.exp" % baseName cmd_list.append(cmd)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -