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

📄 gen_win.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 3 页
字号:
          for cobj in self.graph.get_sources(gen_base.DT_OBJECT, obj):            if isinstance(cobj, gen_base.SWIGObject):              csrc = self.path(cobj.filename)              cout = csrc              # included header files that the generated c file depends on              user_deps = swig_deps[:]              for iobj in self.graph.get_sources(gen_base.DT_SWIG_C, cobj):                isrc = self.path(str(iobj))                if not isinstance(iobj, gen_base.SWIGSource):                  user_deps.append(isrc)                  continue                cbuild = '%s %s -o %s $(InputPath)' \                         % (self.swig_exe, string.join(swig_options), cout)                sources.append(ProjectItem(path=isrc, reldir=None,                                           custom_build=cbuild,                                           custom_target=csrc,                                           user_deps=user_deps))    def_file = self.get_def_file(target)    if def_file is not None:      gsrc = self.path("build/generator/extractor.py")      deps = []      for header in target.msvc_export:        deps.append(self.path(target.path, header))      cbuild = "python $(InputPath) %s > %s" \               % (string.join(deps), def_file)      sources.append(ProjectItem(path=gsrc, reldir=None, custom_build=cbuild,                                 user_deps=deps, custom_target=def_file))      sources.append(ProjectItem(path=def_file, reldir=None,                                  custom_build=None, user_deps=[]))    sources.sort(lambda x, y: cmp(x.path, y.path))    return sources  def get_output_name(self, target):    if isinstance(target, gen_base.TargetExe):      return target.name + '.exe'    elif isinstance(target, gen_base.TargetJava):      ### This target file is not actually built, but we need it to keep      ### the VC Express build happy.      return target.name    elif isinstance(target, gen_base.TargetApacheMod):      return target.name + '.so'    elif isinstance(target, gen_base.TargetLib):      if target.msvc_static:        return '%s-%d.lib' % (target.name, self.version)      else:        return os.path.basename(target.filename)    elif isinstance(target, gen_base.TargetProject):      ### Since this target type doesn't produce any output, we shouldn't      ### need to specify an output filename. But to keep the VC.NET template      ### happy for now we have to return something      return target.name + '.exe'    elif isinstance(target, gen_base.TargetI18N):      return target.name  def get_output_pdb(self, target):    name = self.get_output_name(target)    name = os.path.splitext(name)    return name[0] + '.pdb'  def get_output_dir(self, target):    if isinstance(target, gen_base.TargetJavaHeaders):      return msvc_path("../" + target.headers)    elif isinstance(target, gen_base.TargetJavaClasses):      return msvc_path("../" + target.classes)    else:      return msvc_path(target.path)  def get_intermediate_dir(self, target):    if isinstance(target, gen_base.TargetSWIG):      return msvc_path_join(msvc_path(target.path), target.name)    else:      return self.get_output_dir(target)  def get_def_file(self, target):    if isinstance(target, gen_base.TargetLib) and target.msvc_export:      return self.path(target.path, target.name + ".def")    return None  def gen_proj_names(self, install_targets):    "Generate project file names for the targets"    # Generate project file names for the targets: replace dashes with    # underscores and replace *-test with test_* (so that the test    # programs are visually separare from the rest of the projects)    for target in install_targets:      if target.msvc_name:        target.proj_name = target.msvc_name        continue      name = target.name      pos = string.find(name, '-test')      if pos >= 0:        proj_name = 'test_' + string.replace(name[:pos], '-', '_')      elif isinstance(target, gen_base.TargetSWIG):        proj_name = 'swig_' + string.replace(name, '-', '_')      else:        proj_name = string.replace(name, '-', '_')      target.proj_name = proj_name  def get_external_project(self, target, proj_ext):    if not ((isinstance(target, gen_base.TargetLinked)             or isinstance(target, gen_base.TargetI18N))            and target.external_project):      return None    if target.external_project[:10] == 'apr-iconv/':      path = self.apr_iconv_path + target.external_project[9:]    elif target.external_project[:9] == 'apr-util/':      path = self.apr_util_path + target.external_project[8:]    elif target.external_project[:4] == 'apr/':      path = self.apr_path + target.external_project[3:]    elif target.external_project[:5] == 'neon/':      path = self.neon_path + target.external_project[4:]    elif target.external_project[:5] == 'serf/' and self.serf_path:      path = self.serf_path + target.external_project[4:]    else:      path = target.external_project    return "%s.%s" % (gen_base.native_path(path), proj_ext)  def adjust_win_depends(self, target, name):    "Handle special dependencies if needed"    if name == '__CONFIG__':      depends = []    else:      depends = self.sections['__CONFIG__'].get_dep_targets(target)    depends.extend(self.get_win_depends(target, FILTER_PROJECTS))    # Make the default target generate the .mo files, too    if self.enable_nls and name == '__ALL__':      depends.extend(self.sections['locale'].get_targets())    # Build ZLib as a dependency of Neon if we have it    if  self.zlib_path and name == 'neon':      depends.extend(self.sections['zlib'].get_targets())    # To set the correct build order of the JavaHL targets, the javahl-javah     # and libsvnjavahl targets are defined with extra dependencies in build.conf    # like this:    # add-deps = $(javahl_javah_DEPS) $(javahl_java_DEPS)    #    # This section parses those dependencies and adds them to the dependency list    # for this target.    if name == 'javahl-javah' or name == 'libsvnjavahl':      for dep in re.findall('\$\(([^\)]*)_DEPS\)', target.add_deps):        dep = string.replace(dep, '_', '-')        depends.extend(self.sections[dep].get_targets())    return depends  def get_win_depends(self, target, mode):    """Return the list of dependencies for target"""    dep_dict = {}    if isinstance(target, gen_base.TargetLib) and target.msvc_static:      self.get_static_win_depends(target, dep_dict)    else:      self.get_linked_win_depends(target, dep_dict)    deps = []    if mode == FILTER_PROJECTS:      for dep, (is_proj, is_lib, is_static) in dep_dict.items():        if is_proj:          deps.append(dep)    elif mode == FILTER_LIBS:      for dep, (is_proj, is_lib, is_static) in dep_dict.items():        if is_static or (is_lib and not is_proj):          deps.append(dep)    else:      raise NotImplementedError    deps.sort(lambda d1, d2: cmp(d1.name, d2.name))    return deps  def get_direct_depends(self, target):    """Read target dependencies from graph    return value is list of (dependency, (is_project, is_lib, is_static)) tuples    """    deps = []    for dep in self.graph.get_sources(gen_base.DT_LINK, target.name):      if not isinstance(dep, gen_base.Target):        continue      is_project = hasattr(dep, 'proj_name')      is_lib = isinstance(dep, gen_base.TargetLib)      is_static = is_lib and dep.msvc_static      deps.append((dep, (is_project, is_lib, is_static)))    for dep in self.graph.get_sources(gen_base.DT_NONLIB, target.name):      is_project = hasattr(dep, 'proj_name')      is_lib = isinstance(dep, gen_base.TargetLib)      is_static = is_lib and dep.msvc_static      deps.append((dep, (is_project, is_lib, is_static)))    return deps  def get_static_win_depends(self, target, deps):    """Find project dependencies for a static library project"""    for dep, dep_kind in self.get_direct_depends(target):      is_proj, is_lib, is_static = dep_kind      # recurse for projectless targets      if not is_proj:        self.get_static_win_depends(dep, deps)      # Only add project dependencies on non-library projects. If we added      # project dependencies on libraries, MSVC would copy those libraries      # into the static archive. This would waste space and lead to linker      # warnings about multiply defined symbols. Instead, the library      # dependencies get added to any DLLs or EXEs that depend on this static      # library (see get_linked_win_depends() implementation).      if not is_lib:        deps[dep] = dep_kind      # a static library can depend on another library through a fake project      elif dep.msvc_fake:        deps[dep.msvc_fake] = dep_kind  def get_linked_win_depends(self, target, deps, static_recurse=0):    """Find project dependencies for a DLL or EXE project"""    for dep, dep_kind in self.get_direct_depends(target):      is_proj, is_lib, is_static = dep_kind      # recurse for projectless dependencies      if not is_proj:        self.get_linked_win_depends(dep, deps, 0)      # also recurse into static library dependencies      elif is_static:        self.get_linked_win_depends(dep, deps, 1)      # add all top level dependencies and any libraries that      # static library dependencies depend on.      if not static_recurse or is_lib:        deps[dep] = dep_kind  def get_win_defines(self, target, cfg):    "Return the list of defines for target"    fakedefines = ["WIN32","_WINDOWS","alloca=_alloca",                   "snprintf=_snprintf", "_CRT_SECURE_NO_DEPRECATE=",                   "_CRT_NONSTDC_NO_DEPRECATE="]    if isinstance(target, gen_base.TargetApacheMod):      if target.name == 'mod_dav_svn':        fakedefines.extend(["AP_DECLARE_EXPORT"])    if isinstance(target, gen_base.TargetSWIG):      fakedefines.append("SWIG_GLOBAL")    if cfg == 'Debug':      fakedefines.extend(["_DEBUG","SVN_DEBUG"])    # XXX: Check if db is present, and if so, let apr-util know    # XXX: This is a hack until the apr build system is improved to    # XXX: know these things for itself.    if self.bdb_lib:      fakedefines.append("APU_HAVE_DB=1")      fakedefines.append("SVN_LIBSVN_FS_LINKS_FS_BASE=1")    # check if they wanted nls    if self.enable_nls:      fakedefines.append("ENABLE_NLS")          # check if we have a newer neon (0.25.x)    if self.neon_ver >= 25000:      fakedefines.append("SVN_NEON_0_25=1")    # check for neon 0.26.x or newer    if self.neon_ver >= 26000:      fakedefines.append("SVN_NEON_0_26=1")    return fakedefines  def get_win_includes(self, target):    "Return the list of include directories for target"        fakeincludes = [ self.path("subversion/include"),                     self.path("subversion"),                     self.apath(self.apr_path, "include"),                     self.apath(self.apr_util_path, "include") ]    if isinstance(target, gen_base.TargetApacheMod):      fakeincludes.extend([ self.apath(self.apr_util_path, "xml/expat/lib"),                            self.apath(self.httpd_path, "include"),                            self.apath(self.bdb_path, "include") ])    elif isinstance(target, gen_base.TargetSWIG):      util_includes = "subversion/bindings/swig/%s/libsvn_swig_%s" \                      % (target.lang,                         gen_base.lang_utillib_suffix[target.lang])      fakeincludes.extend([ self.path("subversion/bindings/swig"),                            self.path("subversion/bindings/swig/proxy"),                            self.path("subversion/bindings/swig/include"),                            self.path(util_includes) ])    else:      fakeincludes.extend([ self.apath(self.apr_util_path, "xml/expat/lib"),                            self.apath(self.neon_path, "src"),                            self.path("subversion/bindings/swig/proxy"),                            self.apath(self.bdb_path, "include") ])    if self.libintl_path:      fakeincludes.append(self.apath(self.libintl_path, 'inc'))        if self.serf_path:       fakeincludes.append(self.apath(self.serf_path, ""))    if self.swig_libdir \       and (isinstance(target, gen_base.TargetSWIG)            or isinstance(target, gen_base.TargetSWIGLib)):      fakeincludes.append(self.swig_libdir)    fakeincludes.append(self.apath(self.zlib_path))        return fakeincludes  def get_win_lib_dirs(self, target, cfg):    "Return the list of library directories for target"    libcfg = string.replace(string.replace(cfg, "Debug", "LibD"),                            "Release", "LibR")    fakelibdirs = [ self.apath(self.bdb_path, "lib"),                    self.apath(self.neon_path),                    self.apath(self.zlib_path) ]    if isinstance(target, gen_base.TargetApacheMod):      fakelibdirs.append(self.apath(self.httpd_path, cfg))      if target.name == 'mod_dav_svn':        fakelibdirs.append(self.apath(self.httpd_path, "modules/dav/main",                                       cfg))    return fakelibdirs  def get_win_libs(self, target, cfg):    "Return the list of external libraries needed for target"

⌨️ 快捷键说明

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