Author: brane
Date: Mon Jan 21 17:49:57 2013
New Revision: 1436512

URL: http://svn.apache.org/viewvc?rev=1436512&view=rev
Log:
On the windows-build-update: Add branch readme file and checkpoint current
minimal prototype of the build generator changes.

* BRANCH-README: New.

* gen-make.py: Accept new option --with-deps-package.
   Based on that, select a differend build generator.
   Print a number of warnings related to option usage.

Added:
    subversion/trunk/BRANCH-README
    subversion/trunk/build/generator/gen_vcnet_vcproj_packaged_deps.py
      - copied, changed from r1435904, 
subversion/trunk/build/generator/gen_vcnet_vcproj.py
    subversion/trunk/build/generator/gen_win_packaged_deps.py
      - copied, changed from r1435904, 
subversion/trunk/build/generator/gen_win.py
Modified:
    subversion/trunk/gen-make.py

Added: subversion/trunk/BRANCH-README
URL: 
http://svn.apache.org/viewvc/subversion/trunk/BRANCH-README?rev=1436512&view=auto
==============================================================================
--- subversion/trunk/BRANCH-README (added)
+++ subversion/trunk/BRANCH-README Mon Jan 21 17:49:57 2013
@@ -0,0 +1,9 @@
+This branch is for development of changes to the Windows project file
+generator so that the generated projects can use pre-built
+dependencies provided here:
+
+    http://github.com/brainy/subversion-windeps
+
+The intent is to eventually include those dependency builder scripts
+into the Subversion project, and making the project file generator
+flexible enough to support different dependency layouts.
\ No newline at end of file

Copied: subversion/trunk/build/generator/gen_vcnet_vcproj_packaged_deps.py 
(from r1435904, subversion/trunk/build/generator/gen_vcnet_vcproj.py)
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_vcnet_vcproj_packaged_deps.py?p2=subversion/trunk/build/generator/gen_vcnet_vcproj_packaged_deps.py&p1=subversion/trunk/build/generator/gen_vcnet_vcproj.py&r1=1435904&r2=1436512&rev=1436512&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_vcnet_vcproj.py (original)
+++ subversion/trunk/build/generator/gen_vcnet_vcproj_packaged_deps.py Mon Jan 
21 17:49:57 2013
@@ -24,27 +24,27 @@
 
 import os
 import gen_base
-import gen_win
+import gen_win_packaged_deps as gen_win
 import ezt
 
 
 class Generator(gen_win.WinGeneratorBase):
-  "Generate a Visual C++.NET project"
+  "Generate a Visual Studio 2010+ project"
 
-  def __init__(self, fname, verfname, options):
+  def __init__(self, fname, verfname, options, windepspackage=None):
     gen_win.WinGeneratorBase.__init__(self, fname, verfname, options,
-                                      'vcnet-vcproj')
+                                      'vcnet-vcproj', windepspackage)
 
   def quote(self, str):
     return '"%s"' % str
 
   def get_external_project(self, target, proj_ext):
     "Link project files: prefer vcproj's, but if don't exist, try dsp's."
-    vcproj = gen_win.WinGeneratorBase.get_external_project(self, target,
-                                                           proj_ext)
+    vcproj = gen_win.WinGeneratorBase.get_external_project(
+        self, target, proj_ext)
     if vcproj and not os.path.exists(vcproj):
-      dspproj = gen_win.WinGeneratorBase.get_external_project(self, target,
-                                                              'dsp')
+      dspproj = gen_win.WinGeneratorBase.get_external_project(
+          self, target, 'dsp')
       if os.path.exists(dspproj):
         return dspproj
 
@@ -155,8 +155,6 @@ class Generator(gen_win.WinGeneratorBase
                         (
                           ('project_guid', self.makeguid('svn_locale')),
                         ))
-    self.write_zlib_project_file('zlib' + self.vcproj_extension)
-    self.write_serf_project_file('serf' + self.vcproj_extension)
 
     install_targets = self.get_install_targets()
 
@@ -189,6 +187,10 @@ class Generator(gen_win.WinGeneratorBase
     for target in install_targets:
       name = target.name
 
+      #TODO: FIXME: Skip zlib and serf projects.
+      if name in ('serf', 'zlib'):
+        continue
+
       depends = [ ]
       if not isinstance(target, gen_base.TargetI18N):
         depends = self.adjust_win_depends(target, name)
@@ -271,7 +273,4 @@ class Generator(gen_win.WinGeneratorBase
       'guids' : guidvals,
       }
 
-    if self.vs_version == '2002' or self.vs_version == '2003':
-      self.write_with_template('subversion_vcnet.sln', 
'templates/vcnet_vc7_sln.ezt', data)
-    else:
-      self.write_with_template('subversion_vcnet.sln', 
'templates/vcnet_sln.ezt', data)
+    self.write_with_template('subversion_vcnet.sln', 
'templates/vcnet_sln.ezt', data)

Copied: subversion/trunk/build/generator/gen_win_packaged_deps.py (from 
r1435904, subversion/trunk/build/generator/gen_win.py)
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_packaged_deps.py?p2=subversion/trunk/build/generator/gen_win_packaged_deps.py&p1=subversion/trunk/build/generator/gen_win.py&r1=1435904&r2=1436512&rev=1436512&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win_packaged_deps.py Mon Jan 21 
17:49:57 2013
@@ -66,25 +66,22 @@ class GeneratorBase(gen_base.GeneratorBa
     ('pyd', 'object'): '.obj',
     }
 
-  def parse_options(self, options):
-    self.apr_path = 'apr'
-    self.apr_util_path = 'apr-util'
-    self.apr_iconv_path = 'apr-iconv'
-    self.serf_path = None
-    self.serf_lib = None
-    self.bdb_path = 'db4-win32'
-    self.httpd_path = None
-    self.libintl_path = None
-    self.zlib_path = 'zlib'
-    self.openssl_path = None
+  def parse_options(self, options, windepspackage):
+    # Defaults
+    self.vs_version = '2010'
+    self.sln_version = '11.00'
+    self.vcproj_version = '10.0'
+    self.vcproj_extension = '.vcxproj'
+    self.package_vsver = 'vs2010'
     self.jdk_path = None
     self.junit_path = None
+
+    #TODO: Packages for these bits
+    self.httpd_path = None
     self.swig_path = None
-    self.vs_version = '2002'
-    self.sln_version = '7.00'
-    self.vcproj_version = '7.00'
-    self.vcproj_extension = '.vcproj'
-    self.sqlite_path = 'sqlite-amalgamation'
+    self.sasl_path = None
+    self.libintl_path = None
+
     self.skip_sections = { 'mod_dav_svn': None,
                            'mod_authz_svn': None,
                            'mod_dontdothat' : None,
@@ -97,48 +94,20 @@ class GeneratorBase(gen_base.GeneratorBa
     self.static_openssl = None
     self.instrument_apr_pools = None
     self.instrument_purify_quantify = None
-    self.configure_apr_util = None
-    self.sasl_path = None
 
     # NLS options
     self.enable_nls = None
 
-    # ML (assembler) is disabled by default; use --enable-ml to detect
-    self.enable_ml = None
-
     for opt, val in options:
-      if opt == '--with-berkeley-db':
-        self.bdb_path = val
-      elif opt == '--with-apr':
-        self.apr_path = val
-      elif opt == '--with-apr-util':
-        self.apr_util_path = val
-      elif opt == '--with-apr-iconv':
-        self.apr_iconv_path = val
-      elif opt == '--with-serf':
-        self.serf_path = val
-      elif opt == '--with-httpd':
-        self.httpd_path = val
-        del self.skip_sections['mod_dav_svn']
-        del self.skip_sections['mod_authz_svn']
-        del self.skip_sections['mod_dontdothat']
-      elif opt == '--with-libintl':
-        self.libintl_path = val
-        self.enable_nls = 1
+      if opt == '--with-httpd':
+        #TODO:del self.skip_sections['mod_dav_svn']
+        #TODO:del self.skip_sections['mod_authz_svn']
+        #TODO:del self.skip_sections['mod_dontdothat']
+        pass
       elif opt == '--with-jdk':
         self.jdk_path = val
       elif opt == '--with-junit':
         self.junit_path = val
-      elif opt == '--with-zlib':
-        self.zlib_path = val
-      elif opt == '--with-swig':
-        self.swig_path = val
-      elif opt == '--with-sqlite':
-        self.sqlite_path = val
-      elif opt == '--with-sasl':
-        self.sasl_path = val
-      elif opt == '--with-openssl':
-        self.openssl_path = val
       elif opt == '--enable-purify':
         self.instrument_purify_quantify = 1
         self.instrument_apr_pools = 1
@@ -147,11 +116,8 @@ class GeneratorBase(gen_base.GeneratorBa
       elif opt == '--enable-pool-debug':
         self.instrument_apr_pools = 1
       elif opt == '--enable-nls':
-        self.enable_nls = 1
-      elif opt == '--enable-bdb-in-apr-util':
-        self.configure_apr_util = 1
-      elif opt == '--enable-ml':
-        self.enable_ml = 1
+        #TODO:self.enable_nls = 1
+        pass
       elif opt == '--disable-shared':
         self.disable_shared = 1
       elif opt == '--with-static-apr':
@@ -159,67 +125,94 @@ class GeneratorBase(gen_base.GeneratorBa
       elif opt == '--with-static-openssl':
         self.static_openssl = 1
       elif opt == '--vsnet-version':
-        if val == '2002' or re.match('7(\.\d+)?', val):
-          self.vs_version = '2002'
-          self.sln_version = '7.00'
-          self.vcproj_version = '7.00'
-          self.vcproj_extension = '.vcproj'
-        elif val == '2003' or re.match('8(\.\d+)?', val):
-          self.vs_version = '2003'
-          self.sln_version = '8.00'
-          self.vcproj_version = '7.10'
-          self.vcproj_extension = '.vcproj'
-        elif val == '2005' or re.match('9(\.\d+)?', val):
-          self.vs_version = '2005'
-          self.sln_version = '9.00'
-          self.vcproj_version = '8.00'
-          self.vcproj_extension = '.vcproj'
-        elif val == '2008' or re.match('10(\.\d+)?', val):
-          self.vs_version = '2008'
-          self.sln_version = '10.00'
-          self.vcproj_version = '9.00'
-          self.vcproj_extension = '.vcproj'
-        elif val == '2010':
+        if val == '2010':
           self.vs_version = '2010'
           self.sln_version = '11.00'
           self.vcproj_version = '10.0'
           self.vcproj_extension = '.vcxproj'
+          self.package_vsver = 'vs2010'
         elif val == '2012' or val == '11':
           self.vs_version = '2012'
           self.sln_version = '12.00'
           self.vcproj_version = '11.0'
           self.vcproj_extension = '.vcxproj'
+          self.package_vsver = 'vs2012'
         else:
-          print('WARNING: Unknown VS.NET version "%s",'
-                 ' assuming "%s"\n' % (val, '7.00'))
+          print('WARNING: Unknown Visual Studio version "%s",'
+                 ' assuming "%s"\n' % (val, '2010'))
 
+    self.depsbase = os.path.join(
+      os.path.abspath(windepspackage), self.package_vsver)
 
-  def __init__(self, fname, verfname, options):
-
-    # parse (and save) the options that were passed to us
-    self.parse_options(options)
-
-    # Initialize parent
-    gen_base.GeneratorBase.__init__(self, fname, verfname, options)
+    if self.static_apr or self.static_openssl:
+      self.static_apr = 1
+      self.static_openssl = 1
+      self.apr_lib = 'lib/apr-1.lib'
+      self.apr_util_lib = 'lib/aprutil-1.lib'
+      self.zlib_lib = 'lib/zlib.lib'
+      self.zlib_libd = 'lib/zlibd.lib'
+      self.serf_lib = 'lib/serf-1.lib'
+      self.openssl_libs = ('lib/ssleay32.lib', 'lib/libeay32.lib')
+    else:
+      self.apr_lib = 'implib/libapr-1.lib'
+      self.apr_util_lib = 'implib/libaprutil-1.lib'
+      self.zlib_lib = 'implib/zdll.lib'
+      self.zlib_libd = 'implib/zdlld.lib'
+      self.serf_lib = 'implib/serf-1.lib'
+      self.openssl_libs = ('implib/ssleay32.lib', 'implib/libeay32.lib')
+
+    self.expat_lib = 'lib/aprutilxml.lib'
+
+    self.apr_include = 'include/apr-1'
+    self.apr_util_include = 'include/apu-1'
+    self.expat_include = 'include/apu-1/xml'
+    self.zlib_include = 'include'
+    self.openssl_include = 'include/openssl'
+    self.serf_include = 'include/serf-1'
+    self.sqlite_include = 'include/sqlite-amalgamation'
+    self.sqlite_inline = 1
 
     # Find Berkeley DB
-    self._find_bdb()
-
-  def _find_bdb(self):
-    "Find the Berkeley DB library and version"
-    for ver in ("48", "47", "46", "45", "44", "43", "42", "41", "40"):
-      lib = "libdb" + ver
-      path = os.path.join(self.bdb_path, "lib")
-      if os.path.exists(os.path.join(path, lib + ".lib")):
+    basedir = self._depsdir()
+    for ver in ('54', '53'):
+      lib = 'implib/libdb' + ver + '.lib'
+      if os.path.exists(os.path.join(basedir, lib)):
         self.bdb_lib = lib
+        self.bdb_libd = lib.replace('.lib', 'd.lib')
         break
     else:
       self.bdb_lib = None
+      self.bdb_libd = None
+
+  def _depsdir(self, platform='x86', debug=False):
+    if platform in ('x86', 'Win32'):
+      platform = 'x86'
+    elif platform in ('amd64', 'x64'):
+      platform = 'amd64'
+    else:
+      raise ValueError('invalid platform %s' % platform)
+    if debug:
+      config = 'debug'
+    else:
+      config = 'release'
+    return '%s-%s-%s' % (self.depsbase, platform, config)
+
+  def _depsfile(self, relpath, platform='x86', debug=False, *args):
+    return os.path.join(self._depsdir(platform, debug), relpath, *args)
+
+  def __init__(self, fname, verfname, options, windepspackage):
+
+    # parse (and save) the options that were passed to us
+    self.parse_options(options, windepspackage)
+
+    # Initialize parent
+    gen_base.GeneratorBase.__init__(self, fname, verfname, options)
+
 
 class WinGeneratorBase(GeneratorBase):
   "Base class for all Windows project files generators"
 
-  def __init__(self, fname, verfname, options, subdir):
+  def __init__(self, fname, verfname, options, subdir, windepspackage):
     """
     Do some Windows specific setup
 
@@ -228,10 +221,10 @@ class WinGeneratorBase(GeneratorBase):
     """
 
     # Initialize parent
-    GeneratorBase.__init__(self, fname, verfname, options)
+    GeneratorBase.__init__(self, fname, verfname, options, windepspackage)
 
     if self.bdb_lib is not None:
-      print("Found %s.lib in %s\n" % (self.bdb_lib, self.bdb_path))
+      print("Found %s\n" % self.bdb_lib)
     else:
       print("BDB not found, BDB fs will not be built\n")
 
@@ -254,22 +247,6 @@ class WinGeneratorBase(GeneratorBase):
     # Find the installed Java Development Kit
     self._find_jdk()
 
-    # Find APR and APR-util version
-    self._find_apr()
-    self._find_apr_util()
-
-    # Find Sqlite
-    self._find_sqlite()
-
-    # Look for ZLib and ML
-    if self.zlib_path:
-      self._find_zlib()
-      self._find_ml()
-
-    # Find serf and its dependencies
-    if self.serf_path:
-      self._find_serf()
-
     #Make some files for the installer so that we don't need to
     #require sed or some other command to do it
     ### GJS: don't do this right now
@@ -291,14 +268,6 @@ class WinGeneratorBase(GeneratorBase):
     if not os.path.exists(self.projfilesdir):
       os.makedirs(self.projfilesdir)
 
-    # Generate the build_zlib.bat file
-    if self.zlib_path:
-      data = {'zlib_path': os.path.relpath(self.zlib_path, self.projfilesdir),
-              'zlib_version': self.zlib_version,
-              'use_ml': self.have_ml and 1 or None}
-      bat = os.path.join(self.projfilesdir, 'build_zlib.bat')
-      self.write_with_template(bat, 'templates/build_zlib.ezt', data)
-
     # Generate the build_locale.bat file
     pofiles = []
     if self.enable_nls:
@@ -312,12 +281,7 @@ class WinGeneratorBase(GeneratorBase):
                              'templates/build_locale.ezt', data)
 
     #Here we can add additional platforms to compile for
-    self.platforms = ['Win32']
-
-    # VC 2002 and VC 2003 only allow a single platform per project file
-    if subdir == 'vcnet-vcproj':
-      if self.vcproj_version != '7.00' and self.vcproj_version != '7.10':
-        self.platforms = ['Win32','x64']
+    self.platforms = ['Win32','x64']
 
     #Here we can add additional modes to compile for
     self.configs = ['Debug','Release']
@@ -689,9 +653,7 @@ class WinGeneratorBase(GeneratorBase):
             and target.external_project):
       return None
 
-    if target.external_project[:5] == 'serf/' and self.serf_lib:
-      path = self.serf_path + target.external_project[4:]
-    elif target.external_project.find('/') != -1:
+    if target.external_project.find('/') != -1:
       path = target.external_project
     else:
       path = os.path.join(self.projfilesdir, target.external_project)
@@ -712,10 +674,6 @@ class WinGeneratorBase(GeneratorBase):
     if self.enable_nls and name == '__ALL__':
       depends.extend(self.sections['locale'].get_targets())
 
-    # Build ZLib as a dependency of Serf if we have it
-    if self.zlib_path and name == 'serf':
-      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:
@@ -897,36 +855,43 @@ class WinGeneratorBase(GeneratorBase):
   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") ]
+    fakeincludes = [self.path("subversion/include"),
+                    self.path("subversion"),
+                    self.apath(self._depsdir(), self.sqlite_include),
+                    self.apath(self._depsdir(), self.apr_include),
+                    self.apath(self._depsdir(), self.apr_util_include),
+                    self.apath(self._depsdir(), self.openssl_include),
+                    self.apath(self._depsdir(), self.serf_include),
+                    self.apath(self._depsdir(), self.zlib_include),
+                    ]
 
     if target.name == 'mod_authz_svn':
-      fakeincludes.extend([ self.apath(self.httpd_path, "modules/aaa") ])
+      #TODO:fakeincludes.extend([self.apath(self.httpd_path, "modules/aaa")])
+      pass
 
     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") ])
+      fakeincludes.extend([self.apath(self._depsdir(), self.expat_include),
+                           #TODO:self.apath(self.httpd_path, "include"),
+                           #TODO:self.apath(self._depsdir(), self.bdb_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.path("subversion/bindings/swig/proxy"),
-                            self.apath(self.bdb_path, "include") ])
+      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._depsdir(), self.expat_include),
+                           self.path("subversion/bindings/swig/proxy"),
+                           #TODO:self.apath(self._depsdir(), self.bdb_include),
+                           ])
 
     if self.libintl_path:
-      fakeincludes.append(self.apath(self.libintl_path, 'inc'))
-
-    if self.serf_lib:
-      fakeincludes.append(self.apath(self.serf_path))
+      #TODO:fakeincludes.append(self.apath(self.libintl_path, 'inc'))
+      pass
 
     if self.swig_libdir \
        and (isinstance(target, gen_base.TargetSWIG)
@@ -946,15 +911,9 @@ class WinGeneratorBase(GeneratorBase):
       if target.lang == "ruby":
         fakeincludes.extend(self.ruby_includes)
 
-    fakeincludes.append(self.apath(self.zlib_path))
-
-    if self.sqlite_inline:
-      fakeincludes.append(self.apath(self.sqlite_path))
-    else:
-      fakeincludes.append(self.apath(self.sqlite_path, 'inc'))
-
     if self.sasl_path:
-      fakeincludes.append(self.apath(self.sasl_path, 'include'))
+      #TODO:fakeincludes.append(self.apath(self.sasl_path, 'include'))
+      pass
 
     if target.name == "libsvnjavahl" and self.jdk_path:
       fakeincludes.append(os.path.join(self.jdk_path, 'include'))
@@ -965,34 +924,15 @@ class WinGeneratorBase(GeneratorBase):
   def get_win_lib_dirs(self, target, cfg):
     "Return the list of library directories for target"
 
-    expatlibcfg = cfg.replace("Debug", "LibD").replace("Release", "LibR")
-    if self.static_apr:
-      libcfg = expatlibcfg
-    else:
-      libcfg = cfg
-
-    fakelibdirs = [ self.apath(self.bdb_path, "lib"),
-                    self.apath(self.zlib_path),
-                    ]
-
-    if not self.sqlite_inline:
-      fakelibdirs.append(self.apath(self.sqlite_path, "lib"))
-
-    if self.sasl_path:
-      fakelibdirs.append(self.apath(self.sasl_path, "lib"))
-    if self.serf_lib:
-      fakelibdirs.append(self.apath(msvc_path_join(self.serf_path, cfg)))
-
-    fakelibdirs.append(self.apath(self.apr_path, libcfg))
-    fakelibdirs.append(self.apath(self.apr_util_path, libcfg))
-    fakelibdirs.append(self.apath(self.apr_util_path, 'xml', 'expat',
-                                  'lib', expatlibcfg))
+    fakelibdirs = []
 
     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))
+      #TODO:
+      #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))
+      pass
     if self.swig_libdir \
        and (isinstance(target, gen_base.TargetSWIG)
             or isinstance(target, gen_base.TargetSWIGLib)):
@@ -1008,17 +948,20 @@ class WinGeneratorBase(GeneratorBase):
   def get_win_libs(self, target, cfg):
     "Return the list of external libraries needed for target"
 
-    dblib = None
-    if self.bdb_lib:
-      dblib = self.bdb_lib+(cfg == 'Debug' and 'd.lib' or '.lib')
+    # FIXME: get_win_libs should accept a platform name, too
+    platform = 'Win32'
+    debug = (cfg == 'Debug')
 
-    if self.serf_lib:
-      if self.serf_ver_maj != 0:
-        serflib = 'serf-%d.lib' % self.serf_ver_maj
-      else:
-        serflib = 'serf.lib'
+    dblib = None
+    if debug:
+      if self.bdb_libd:
+        dblib = self.bdb_libd
+      zlib = self.zlib_libd
+    else:
+      if self.bdb_lib:
+        dblib = self.bdb_lib
+      zlib = self.zlib_lib
 
-    zlib = (cfg == 'Debug' and 'zlibstatD.lib' or 'zlibstat.lib')
     sasllib = None
     if self.sasl_path:
       sasllib = 'libsasl.lib'
@@ -1030,13 +973,21 @@ class WinGeneratorBase(GeneratorBase):
       return []
 
     nondeplibs = target.msvc_libs[:]
-    nondeplibs.append(zlib)
+
+    def appendlib(name):
+      if name:
+        nondeplibs.append(msvc_path(self._depsfile(name, platform, debug)))
+
+    appendlib(zlib)
+
     if self.enable_nls:
-      if self.libintl_path:
-        nondeplibs.append(self.apath(self.libintl_path,
-                                     'lib', 'intl3_svn.lib'))
-      else:
-        nondeplibs.append('intl3_svn.lib')
+      #TODO:
+      #if self.libintl_path:
+      #  nondeplibs.append(self.apath(self.libintl_path,
+      #                               'lib', 'intl3_svn.lib'))
+      #else:
+      #  nondeplibs.append('intl3_svn.lib')
+      pass
 
     if isinstance(target, gen_base.TargetExe):
       nondeplibs.append('setargv.obj')
@@ -1055,25 +1006,27 @@ class WinGeneratorBase(GeneratorBase):
       nondeplibs.extend(dep.msvc_libs)
 
       if dep.external_lib == '$(SVN_DB_LIBS)':
-        nondeplibs.append(dblib)
+        appendlib(dblib)
 
       if dep.external_lib == '$(SVN_SQLITE_LIBS)' and not self.sqlite_inline:
         nondeplibs.append('sqlite3.lib')
 
       if self.serf_lib and dep.external_lib == '$(SVN_SERF_LIBS)':
-        nondeplibs.append(serflib)
+        appendlib(self.serf_lib)
+        for lib in self.openssl_libs:
+          appendlib(lib)
 
       if dep.external_lib == '$(SVN_SASL_LIBS)':
-        nondeplibs.append(sasllib)
+        appendlib(sasllib)
 
       if dep.external_lib == '$(SVN_APR_LIBS)':
-        nondeplibs.append(self.apr_lib)
+        appendlib(self.apr_lib)
 
       if dep.external_lib == '$(SVN_APRUTIL_LIBS)':
-        nondeplibs.append(self.aprutil_lib)
+        appendlib(self.apr_util_lib)
 
       if dep.external_lib == '$(SVN_XML_LIBS)':
-        nondeplibs.append('xml.lib')
+        appendlib(self.expat_lib)
 
     return gen_base.unique(nondeplibs)
 
@@ -1381,203 +1334,6 @@ class WinGeneratorBase(GeneratorBase):
       fp.close()
     return ''
 
-  def _find_ml(self):
-    "Check if the ML assembler is in the path"
-    if not self.enable_ml:
-      self.have_ml = 0
-      return
-    fp = os.popen('ml /help', 'r')
-    try:
-      line = fp.readline()
-      if line:
-        msg = 'Found ML, ZLib build will use ASM sources'
-        self.have_ml = 1
-      else:
-        msg = 'Could not find ML, ZLib build will not use ASM sources'
-        self.have_ml = 0
-      print('%s\n' % (msg,))
-    finally:
-      fp.close()
-
-  def _get_serf_version(self):
-    "Retrieves the serf version from serf.h"
-
-    # shouldn't be called unless serf is there
-    assert self.serf_path and os.path.exists(self.serf_path)
-
-    self.serf_ver_maj = None
-    self.serf_ver_min = None
-    self.serf_ver_patch = None
-
-    # serf.h should be present
-    if not os.path.exists(os.path.join(self.serf_path, 'serf.h')):
-      return None, None, None
-
-    txt = open(os.path.join(self.serf_path, 'serf.h')).read()
-
-    maj_match = re.search(r'SERF_MAJOR_VERSION\s+(\d+)', txt)
-    min_match = re.search(r'SERF_MINOR_VERSION\s+(\d+)', txt)
-    patch_match = re.search(r'SERF_PATCH_VERSION\s+(\d+)', txt)
-    if maj_match:
-      self.serf_ver_maj = int(maj_match.group(1))
-    if min_match:
-      self.serf_ver_min = int(min_match.group(1))
-    if patch_match:
-      self.serf_ver_patch = int(patch_match.group(1))
-
-    return self.serf_ver_maj, self.serf_ver_min, self.serf_ver_patch
-
-  def _find_serf(self):
-    "Check if serf and its dependencies are available"
-
-    minimal_serf_version = (0, 3, 0)
-    self.serf_lib = None
-    if self.serf_path and os.path.exists(self.serf_path):
-      if self.openssl_path and os.path.exists(self.openssl_path):
-        self.serf_lib = 'serf'
-        version = self._get_serf_version()
-        if None in version:
-          msg = 'Unknown serf version found; but, will try to build ' \
-                'ra_serf.\n'
-        else:
-          self.serf_ver = '.'.join(str(v) for v in version)
-          if version < minimal_serf_version:
-            self.serf_lib = None
-            msg = 'Found serf %s, but >= %s is required. ra_serf will not be 
built.\n' % \
-                  (self.serf_ver, '.'.join(str(v) for v in 
minimal_serf_version))
-          else:
-            msg = 'Found serf version %s\n' % self.serf_ver
-        print(msg)
-      else:
-        print('openssl not found, ra_serf will not be built\n')
-    else:
-      print('serf not found, ra_serf will not be built\n')
-
-  def _find_apr(self):
-    "Find the APR library and version"
-
-    version_file_path = os.path.join(self.apr_path, 'include',
-                                     'apr_version.h')
-
-    if not os.path.exists(version_file_path):
-      sys.stderr.write("ERROR: '%s' not found.\n" % version_file_path);
-      sys.stderr.write("Use '--with-apr' option to configure APR location.\n");
-      sys.exit(1)
-
-    fp = open(version_file_path)
-    txt = fp.read()
-    fp.close()
-    vermatch = re.search(r'^\s*#define\s+APR_MAJOR_VERSION\s+(\d+)', txt, re.M)
-
-    major_ver = int(vermatch.group(1))
-
-    suffix = ''
-    if major_ver > 0:
-        suffix = '-%d' % major_ver
-
-    if self.static_apr:
-      self.apr_lib = 'apr%s.lib' % suffix
-    else:
-      self.apr_lib = 'libapr%s.lib' % suffix
-
-  def _find_apr_util(self):
-    "Find the APR-util library and version"
-
-    version_file_path = os.path.join(self.apr_util_path, 'include',
-                                     'apu_version.h')
-
-    if not os.path.exists(version_file_path):
-      sys.stderr.write("ERROR: '%s' not found.\n" % version_file_path);
-      sys.stderr.write("Use '--with-apr-util' option to configure APR-Util 
location.\n");
-      sys.exit(1)
-
-    fp = open(version_file_path)
-    txt = fp.read()
-    fp.close()
-    vermatch = re.search(r'^\s*#define\s+APU_MAJOR_VERSION\s+(\d+)', txt, re.M)
-
-    major_ver = int(vermatch.group(1))
-
-    suffix = ''
-    if major_ver > 0:
-        suffix = '-%d' % major_ver
-
-    if self.static_apr:
-      self.aprutil_lib = 'aprutil%s.lib' % suffix
-    else:
-      self.aprutil_lib = 'libaprutil%s.lib' % suffix
-
-  def _find_sqlite(self):
-    "Find the Sqlite library and version"
-
-    header_file = os.path.join(self.sqlite_path, 'inc', 'sqlite3.h')
-
-    # First check for compiled version of SQLite.
-    if os.path.exists(header_file):
-      # Compiled SQLite seems found, check for sqlite3.lib file.
-      lib_file = os.path.join(self.sqlite_path, 'lib', 'sqlite3.lib')
-      if not os.path.exists(lib_file):
-        sys.stderr.write("ERROR: '%s' not found.\n" % lib_file)
-        sys.stderr.write("Use '--with-sqlite' option to configure sqlite 
location.\n");
-        sys.exit(1)
-      self.sqlite_inline = False
-    else:
-      # Compiled SQLite not found. Try amalgamation version.
-      amalg_file = os.path.join(self.sqlite_path, 'sqlite3.c')
-      if not os.path.exists(amalg_file):
-        sys.stderr.write("ERROR: SQLite not found in '%s' directory.\n" % 
self.sqlite_path)
-        sys.stderr.write("Use '--with-sqlite' option to configure sqlite 
location.\n");
-        sys.exit(1)
-      header_file = os.path.join(self.sqlite_path, 'sqlite3.h')
-      self.sqlite_inline = True
-
-    fp = open(header_file)
-    txt = fp.read()
-    fp.close()
-    vermatch = 
re.search(r'^\s*#define\s+SQLITE_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.\d)?"', 
txt, re.M)
-
-    version = tuple(map(int, vermatch.groups()))
-
-
-    self.sqlite_version = '%d.%d.%d' % version
-
-    msg = 'Found SQLite version %s\n'
-
-    major, minor, patch = version
-    if major < 3 or (major == 3 and minor < 6) \
-                 or (major == 3 and minor == 6 and patch < 18):
-      sys.stderr.write("ERROR: SQLite 3.6.18 or higher is required "
-                       "(%s found)\n" % self.sqlite_version);
-      sys.exit(1)
-    else:
-      print(msg % self.sqlite_version)
-
-  def _find_zlib(self):
-    "Find the ZLib library and version"
-
-    if not self.zlib_path:
-      self.zlib_version = '1'
-      return
-
-    header_file = os.path.join(self.zlib_path, 'zlib.h')
-
-    if not os.path.exists(header_file):
-      self.zlib_version = '1'
-      return
-
-    fp = open(header_file)
-    txt = fp.read()
-    fp.close()
-    vermatch = 
re.search(r'^\s*#define\s+ZLIB_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.\d)?"', txt, 
re.M)
-
-    version = tuple(map(int, vermatch.groups()))
-
-    self.zlib_version = '%d.%d.%d' % version
-
-    msg = 'Found ZLib version %s\n'
-
-    print(msg % self.zlib_version)
-
 class ProjectItem:
   "A generic item class for holding sources info, config info, etc for a 
project"
   def __init__(self, **kw):

Modified: subversion/trunk/gen-make.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/gen-make.py?rev=1436512&r1=1436511&r2=1436512&view=diff
==============================================================================
--- subversion/trunk/gen-make.py (original)
+++ subversion/trunk/gen-make.py Mon Jan 21 17:49:57 2013
@@ -51,13 +51,18 @@ gen_modules = {
   }
 
 def main(fname, gentype, verfname=None,
-         skip_depends=0, other_options=None):
+         skip_depends=0, other_options=None,
+         windepspackage=None):
   if verfname is None:
     verfname = os.path.join('subversion', 'include', 'svn_version.h')
 
-  gen_module = __import__(gen_modules[gentype][0])
+  gen_module_name = gen_modules[gentype][0]
+  if windepspackage is not None:
+    gen_module_name += '_packaged_deps'
+  gen_module = __import__(gen_module_name)
 
-  generator = gen_module.Generator(fname, verfname, other_options)
+  generator = gen_module.Generator(fname, verfname, other_options,
+                                   windepspackage=windepspackage)
 
   if not skip_depends:
     generator.compute_hdr_deps()
@@ -129,6 +134,9 @@ def _usage_exit(err=None):
   print("")
   print("  Windows-specific options:")
   print("")
+  print("  --with-deps-package=DIR")
+  print("           use binary dependences packaged in DIR")
+  print("")
   print("  --with-apr=DIR")
   print("           the APR sources are in DIR")
   print("")
@@ -228,6 +236,14 @@ class Options:
       self.dict[opt] = len(self.list)
       self.list.append((opt, val))
 
+  def has(self, opt):
+    return (opt in self.dict)
+
+  def get(self, opt, default=None):
+    if not self.has(opt):
+      return default
+    return self.list[self.dict[opt]][1]
+
 if __name__ == '__main__':
   try:
     opts, args = my_getopt(sys.argv[1:], 'st:',
@@ -235,6 +251,7 @@ if __name__ == '__main__':
                             'release',
                             'reload',
                             'assume-shared-libs',
+                            'with-deps-package=',
                             'with-apr=',
                             'with-apr-util=',
                             'with-apr-iconv=',
@@ -282,6 +299,25 @@ if __name__ == '__main__':
   if args:
     conf = args[0]
 
+  # --with-deps-package overrides/conflicts with the following options:
+  deps_package_overrides = frozenset([
+    '--with-apr',
+    '--with-apr-util',
+    '--with-berkeley-db',
+    '--with-serf',
+    '--with-httpd',
+    '--with-libintl',
+    '--with-openssl',
+    '--with-zlib',
+    '--with-sqlite',
+    ])
+
+  deps_package_ignores = frozenset([
+    '--with-apr-iconv',
+    '--enable-bdb-in-apr-util',
+    '--enable-ml',
+    ])
+
   # First merge options with previously saved to gen-make.opts if --reload
   # options used
   for opt, val in opts:
@@ -296,19 +332,45 @@ if __name__ == '__main__':
       # Provide a warning that we ignored these arguments
       print("Ignoring no longer supported argument '%s'" % opt)
     else:
+      if opt in deps_package_overrides and rest.has('--with-deps-package'):
+        print("Warning: '--with-deps-package' overrides %s=%s" % (opt, val))
+      elif opt in deps_package_ignores and rest.has('--with-deps-package'):
+        print("Warning: '--with-deps-package' ignores %s=%s" % (opt, val))
+      elif opt == '--with-deps-package':
+        for otheropt in deps_package_overrides:
+          if rest.has(otheropt):
+            print("Warning: Overriding '%s' with %s=%s" % (otheropt, opt, val))
+        for otheropt in deps_package_ignores:
+          if rest.has(otheropt):
+            print("Warning: Ignoring '%s' with %s=%s" % (otheropt, opt, val))
       rest.add(opt, val)
 
   # Parse options list
+  windepspackage = None
   for opt, val in rest.list:
     if opt == '-s':
       skip = 1
     elif opt == '-t':
       gentype = val
+    elif opt == '--with-deps-package':
+      windepspackage = val
     else:
       if opt == '--with-httpd':
+        if not windepspackage:
+          for otheropt in ('apr', 'apr-util', 'apr-iconv'):
+            if rest.has('--with-'+otheropt):
+              print("Warning: Overriding '--with-%s' with %s=%s"
+                    % (otheropt, opt, val))
         rest.add('--with-apr', os.path.join(val, 'srclib', 'apr'))
         rest.add('--with-apr-util', os.path.join(val, 'srclib', 'apr-util'))
         rest.add('--with-apr-iconv', os.path.join(val, 'srclib', 'apr-iconv'))
+      elif opt == '--with-static-apr':
+        if windepspackage and not rest.has('--with-static-openssl'):
+          print("Warning: '--with-static-apr' implies '--with-static-openssl'")
+      elif opt == '--with-static-openssl':
+        if windepspackage and not rest.has('--with-static-apr'):
+          print("Warning: '--with-static-openssl' implies '--with-static-apr'")
+
 
   # Remember all options so that --reload and other scripts can use them
   opt_conf = open('gen-make.opts', 'w')
@@ -320,7 +382,16 @@ if __name__ == '__main__':
   if gentype not in gen_modules.keys():
     _usage_exit("Unknown module type '%s'" % (gentype))
 
-  main(conf, gentype, skip_depends=skip, other_options=rest.list)
+  if windepspackage:
+    if gentype != 'vcproj':
+      print("ERROR: --with-deps-package requires '-t vcproj'")
+      sys.exit(1)
+    if rest.get('--vsnet-version') not in ('2010', '2012', '11'):
+      print("ERROR: --with-deps-package requires --vsnet-version=2010 or 2012")
+      sys.exit(1)
+
+  main(conf, gentype, skip_depends=skip, other_options=rest.list,
+       windepspackage=windepspackage)
 
 
 ### End of file.


Reply via email to