subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1502662 - in /subversion/trunk/build/generator: gen_win.py gen_win_dependencies.py
Date Fri, 12 Jul 2013 19:23:25 GMT
Author: rhuijben
Date: Fri Jul 12 19:23:25 2013
New Revision: 1502662

URL: http://svn.apache.org/r1502662
Log:
In the Windows project file generator: update openssl and serf to the new
dependency framework. The serf in-tree build needs openssl and we need
openssl for running the tests.

* build/generator/gen_win.py
  (get_install_targets): Don't build a serf project if we use an installed
    serf.
  (get_external_project): Update check to avoid .serf_lib
  (get_win_defines): Use modern checks for library availability.
  
  (get_win_includes,
   get_win_lib_dirs,
   get_win_libs): Remove hardcoded serf handling.
   
  (write_serf_project_file): Use modern check.
  
* build/generator/gen_win_dependencies.py
  (GenDependenciesBase): Remove now unused variable.
  (find_libraries): Organize library find calls. Avoid 2 lines for openssl.
  (_find_zlib): Find ml from here.
  (_find_db): Remove unneeded '\n'
  (_find_openssl): New function.
  (_get_serf_version): Add include dir argument to allow probing in more
    locations.
  (_find_serf): Fill library object.

Modified:
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/build/generator/gen_win_dependencies.py

Modified: subversion/trunk/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=1502662&r1=1502661&r2=1502662&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Fri Jul 12 19:23:25 2013
@@ -193,10 +193,12 @@ class WinGeneratorBase(gen_win_dependenc
       install_targets = [x for x in install_targets if not (isinstance(x, gen_base.TargetExe)
                                                             and x.install == 'bdb-test')]
 
-    # Drop the serf target if we don't have both serf and openssl
-    if not self.serf_lib:
-      install_targets = [x for x in install_targets if x.name != 'serf']
+    # Drop the ra_serf target if we don't have serf
+    if 'serf' not in self._libraries:
       install_targets = [x for x in install_targets if x.name != 'libsvn_ra_serf']
+    # Drop the serf target if we don't build serf ourselves
+    if 'serf' not in self._libraries or not self._libraries['serf'].is_src:
+      install_targets = [x for x in install_targets if x.name != 'serf']
 
     # Drop the swig targets if we don't have swig
     if not self.swig_path and not self.swig_libdir:
@@ -521,7 +523,7 @@ class WinGeneratorBase(gen_win_dependenc
             and target.external_project):
       return None
 
-    if target.external_project[:5] == 'serf/' and self.serf_lib:
+    if target.external_project[:5] == 'serf/' and 'serf' in self._libraries:
       path = self.serf_path + target.external_project[4:]
     elif target.external_project.find('/') != -1:
       path = target.external_project
@@ -718,7 +720,7 @@ class WinGeneratorBase(gen_win_dependenc
     # 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:
+    if 'db' in self._libraries:
       fakedefines.append("APU_HAVE_DB=1")
       fakedefines.append("SVN_LIBSVN_FS_LINKS_FS_BASE=1")
 
@@ -726,7 +728,7 @@ class WinGeneratorBase(gen_win_dependenc
     if self.enable_nls:
       fakedefines.append("ENABLE_NLS")
 
-    if self.serf_lib:
+    if 'serf' in self._libraries:
       fakedefines.append("SVN_HAVE_SERF")
       fakedefines.append("SVN_LIBSVN_CLIENT_LINKS_RA_SERF")
 
@@ -782,9 +784,6 @@ class WinGeneratorBase(gen_win_dependenc
     if self.libintl_path:
       fakeincludes.append(self.apath(self.libintl_path, 'inc'))
 
-    if self.serf_lib:
-      fakeincludes.append(self.apath(self.serf_path))
-
     if self.swig_libdir \
        and (isinstance(target, gen_base.TargetSWIG)
             or isinstance(target, gen_base.TargetSWIGLib)):
@@ -851,8 +850,6 @@ class WinGeneratorBase(gen_win_dependenc
 
     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)))
 
     if isinstance(target, gen_base.TargetApacheMod):
       fakelibdirs.append(self.apath(self.httpd_path, cfg))
@@ -880,12 +877,6 @@ class WinGeneratorBase(gen_win_dependenc
     if self.bdb_lib:
       dblib = self.bdb_lib+(debug and 'd.lib' or '.lib')
 
-    if self.serf_lib:
-      if self.serf_ver_maj != 0:
-        serflib = 'serf-%d.lib' % self.serf_ver_maj
-      else:
-        serflib = 'serf.lib'
-
     sasllib = None
     if self.sasl_path:
       sasllib = 'libsasl.lib'
@@ -940,11 +931,6 @@ class WinGeneratorBase(gen_win_dependenc
             nondeplibs.append('sqlite3.lib')
           # else: # Is not a linkable library
 
-        elif external_lib == 'serf':
-
-          if self.serf_lib:
-            nondeplibs.append(serflib)
-
         elif external_lib == 'sasl':
 
           if sasllib:
@@ -1033,8 +1019,13 @@ class WinGeneratorBase(gen_win_dependenc
                         ))
 
   def write_serf_project_file(self, name):
-    if not self.serf_lib:
+    if 'serf' not in self._libraries:
       return
+      
+    serf = self._libraries['serf']
+    
+    if not serf.is_src:
+      return # Using an installed library
 
     serf_path = os.path.abspath(self.serf_path)
     serf_sources = map(lambda x : os.path.relpath(x, self.serf_path),
@@ -1046,10 +1037,6 @@ class WinGeneratorBase(gen_win_dependenc
                        glob.glob(os.path.join(serf_path, '*.h'))
                        + glob.glob(os.path.join(serf_path, 'auth', '*.h'))
                        + glob.glob(os.path.join(serf_path, 'buckets', '*.h')))
-    if self.serf_ver_maj != 0:
-      serflib = 'serf-%d.lib' % self.serf_ver_maj
-    else:
-      serflib = 'serf.lib'
 
     apr_static = self.static_apr and 'APR_STATIC=1' or ''
     openssl_static = self.static_openssl and 'OPENSSL_STATIC=1' or ''
@@ -1067,7 +1054,7 @@ class WinGeneratorBase(gen_win_dependenc
                          ('project_guid', self.makeguid('serf')),
                          ('apr_static', apr_static),
                          ('openssl_static', openssl_static),
-                         ('serf_lib', serflib),
+                         ('serf_lib', serf.lib_name),
                         ))
 
   def move_proj_file(self, path, name, params=()):

Modified: subversion/trunk/build/generator/gen_win_dependencies.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_dependencies.py?rev=1502662&r1=1502661&r2=1502662&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win_dependencies.py (original)
+++ subversion/trunk/build/generator/gen_win_dependencies.py Fri Jul 12 19:23:25 2013
@@ -111,7 +111,6 @@ class GenDependenciesBase(gen_base.Gener
     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
@@ -256,11 +255,17 @@ class GenDependenciesBase(gen_base.Gener
       self.find_libraries(False)
       
   def find_libraries(self, show_warnings):
-  
+
+    # Required dependencies
     self._find_apr()
     self._find_apr_util_and_expat()
-    # Find Berkeley DB
+    self._find_zlib()
+
+    # Optional dependencies
     self._find_bdb(show_warnings)
+    self._find_openssl(show_warnings)
+    self._find_serf(show_warnings)
+    
     
     if show_warnings:
       # Find the right Ruby include and libraries dirs and
@@ -282,17 +287,13 @@ class GenDependenciesBase(gen_base.Gener
       # 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()
     
     if show_warnings:
+      printed = []
       for lib in self._libraries.values():
+        if lib.name in printed:
+          continue 
+        printed.append(lib.name)
         print('Found %s %s' % (lib.name, lib.version))
     
   def _find_apr(self):
@@ -551,6 +552,8 @@ class GenDependenciesBase(gen_base.Gener
                                                 self.zlib_version,
                                                 debug_lib_name=debug_lib_name,
                                                 is_src=is_src)
+    if is_src:
+      self._find_ml()
 
   def _find_bdb(self, show_warnings):
     "Find the Berkeley DB library and version"
@@ -564,7 +567,7 @@ class GenDependenciesBase(gen_base.Gener
     if not self.bdb_path or not os.path.isfile(db_h_path):
       if show_warnings and self.bdb_path:
         print('WARNING: \'%s\' not found' % (db_h_path,))
-        print("Use '--with-berkeley-db' to configure BDB location.\n");
+        print("Use '--with-berkeley-db' to configure BDB location.");
       return
 
     # Obtain bdb version from db.h
@@ -626,6 +629,61 @@ class GenDependenciesBase(gen_base.Gener
     # For compatibility with old code
     self.bdb_lib = self._libraries['db'].lib_name
 
+  def _find_openssl(self, show_warnings):
+    "Find openssl"
+    
+    if not self.openssl_path:
+      return
+      
+    version_path = os.path.join(self.openssl_path, 'inc32/openssl/opensslv.h')
+    if os.path.isfile(version_path):
+      # We have an OpenSSL Source location
+      # For legacy reason
+      inc_dir = os.path.join(self.openssl_path, 'inc32')
+      if self.static_openssl:
+        lib_dir = os.path.join(self.openssl_path, 'out32')
+      else:
+        lib_dir = os.path.join(self.openssl_path, 'out32dll')
+        bin_dir = os.path.join(self.openssl_path, 'out32dll')
+    elif os.path.isfile(os.path.join(self.openssl_path,
+                        'include/openssl/opensslv.h')):
+      version_path = os.path.join(self.openssl_path,
+                                  'include/openssl/opensslv.h')
+      inc_dir = os.path.join(self.openssl_path, 'include')
+      lib_dir = os.path.join(self.openssl_path, 'lib')
+      if self.static_openss:
+        self.bin_dir = None
+      else:
+        self.bin_dir = os.path.join(self.openssl_path, 'bin')
+    else:
+      if show_warning:
+        print('WARNING: \'opensslv.h\' not found')
+        print("Use '--with-openssl' to configure openssl location.");
+      return
+
+    txt = open(version_path).read()
+
+    vermatch = re.search(
+      r'#define OPENSSL_VERSION_TEXT	"OpenSSL\s+((\d+)\.(\d+).(\d+)([^ -]*))',
+      txt)
+  
+    version = (int(vermatch.group(2)), 
+               int(vermatch.group(3)),
+               int(vermatch.group(4)))
+    openssl_version = vermatch.group(1)
+  
+    self._libraries['ssleay32'] = SVNCommonLibrary('openssl', inc_dir, lib_dir,
+                                                    'ssleay32.lib',
+                                                    openssl_version,
+                                                    dll_name='ssleay32.dll',
+                                                    dll_dir=bin_dir)
+
+    self._libraries['libeay32'] = SVNCommonLibrary('openssl', inc_dir, lib_dir,
+                                                    'libeay32.lib',
+                                                    openssl_version,
+                                                    dll_name='libeay32.dll',
+                                                    dll_dir=bin_dir)                    
                               
+
   def _find_perl(self):
     "Find the right perl library name to link swig bindings with"
     self.perl_includes = []
@@ -820,21 +878,21 @@ class GenDependenciesBase(gen_base.Gener
     finally:
       fp.close()
 
-  def _get_serf_version(self):
+  def _get_serf_version(self, inc_dir):
     "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)
+    assert inc_dir and os.path.exists(inc_dir)
 
     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')):
+    if not os.path.exists(os.path.join(inc_dir, 'serf.h')):
       return None, None, None
 
-    txt = open(os.path.join(self.serf_path, 'serf.h')).read()
+    txt = open(os.path.join(inc_dir, '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)
@@ -848,31 +906,60 @@ class GenDependenciesBase(gen_base.Gener
 
     return self.serf_ver_maj, self.serf_ver_min, self.serf_ver_patch
 
-  def _find_serf(self):
+  def _find_serf(self, show_warning):
     "Check if serf and its dependencies are available"
 
     minimal_serf_version = (1, 2, 1)
-    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.'
-        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 %s' % self.serf_ver
-        print(msg)
+    
+    if not self.serf_path:
+      return
+    
+    inc_dir = self.serf_path
+    
+    if os.path.isfile(os.path.join(inc_dir, 'serf.h')):
+      # Source layout
+      version = self._get_serf_version(inc_dir)
+      
+      if version < (1, 3, 0):
+        lib_dir = os.path.join(self.serf_path, 'Release')
+        debug_lib_dir = os.path.join(self.serf_path, 'Debug')
       else:
-        print('openssl not found, ra_serf will not be built\n')
+        lib_dir = self.serf_path
+        debug_lib_dir = None
+      is_src = True
+    elif os.path.isfile(os.path.join(self.serf_path, 'include/serf-1/serf.h')):
+      # Install layout
+      inc_dir = os.path.join(self.serf_path, 'include/serf-1')
+      version = self._get_serf_version(inc_dir)
+      lib_dir = os.path.join(inc_dir, 'lib')
+      debug_lib_dir = None
+      is_src = False
+    else:
+      if show_warning:
+        print('WARNING: \'serf.h\' not found')
+        print("Use '--with-serf' to configure serf location.");
+      return
+    
+    if is_src and 'ssleay32' not in self._libraries:
+      if show_warning:
+        print('openssl not found, serf and ra_serf will not be built')
+      return
+    
+    if version < minimal_serf_version:
+      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))
+      return
+      
+    if self.serf_ver_maj > 0:
+      lib_name = 'serf-%d.lib' % (self.serf_ver_maj,)
     else:
-      print('serf not found, ra_serf will not be built\n')
+      lib_name = 'serf.lib'
+      
+    serf_version = '.'.join(str(v) for v in version)
+    self._libraries['serf'] = SVNCommonLibrary('serf', inc_dir, lib_dir,
+                                                lib_name, serf_version,
+                                                debug_lib_dir=debug_lib_dir,
+                                                is_src=is_src)
 
   def _find_sqlite(self):
     "Find the Sqlite library and version"



Mime
View raw message