You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2017/07/28 10:30:35 UTC

svn commit: r1803261 - in /subversion/trunk/build/generator: gen_win.py gen_win_dependencies.py

Author: kotkov
Date: Fri Jul 28 10:30:34 2017
New Revision: 1803261

URL: http://svn.apache.org/viewvc?rev=1803261&view=rev
Log:
Add some plumbing for the Utf8proc and LZ4 dependencies on Windows.

This avoids receiving the following warnings when running gen-make.py:

  Warning: Using undeclared dependency '$(SVN_UTF8PROC_LIBS)'.
  Warning: Using undeclared dependency '$(SVN_LZ4_LIBS)'.

For now, we only support using the bundled versions of these libraries on
Windows, but this patch (minimally) integrates them into the build env.

* build/generator/gen_win_dependencies.py
  (SVNCommonLibrary.__init__): Add new 'internal' field.
  (GenDependenciesBase._find_lz4, GenDependenciesBase._find_utf8proc):
   New functions that parse versions of bundled libraries and add them
   as internal SVNCommonLibrary objects.
  (GenDependenciesBase.find_libraries): Call new functions.

* build/generator/gen_win.py
  (WinGeneratorBase.__init__): Separately print all internal libraries.

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=1803261&r1=1803260&r2=1803261&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Fri Jul 28 10:30:34 2017
@@ -79,11 +79,15 @@ class WinGeneratorBase(gen_win_dependenc
 
     # Print list of identified libraries
     printed = []
-    for lib in sorted(self._libraries.values(), key = lambda s: s.name):
+    for lib in sorted(self._libraries.values(),
+                      key = lambda s: (s.internal, s.name)):
       if lib.name in printed:
         continue
       printed.append(lib.name)
-      print('Found %s %s' % (lib.name, lib.version))
+      if lib.internal:
+        print('Using bundled %s %s' % (lib.name, lib.version))
+      else:
+        print('Found %s %s' % (lib.name, lib.version))
 
     #Make some files for the installer so that we don't need to
     #require sed or some other command to do it

Modified: subversion/trunk/build/generator/gen_win_dependencies.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_dependencies.py?rev=1803261&r1=1803260&r2=1803261&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win_dependencies.py (original)
+++ subversion/trunk/build/generator/gen_win_dependencies.py Fri Jul 28 10:30:34 2017
@@ -51,7 +51,7 @@ class SVNCommonLibrary:
   def __init__(self, name, include_dirs, lib_dir, lib_name, version=None,
                debug_lib_dir=None, debug_lib_name=None, dll_dir=None,
                dll_name=None, debug_dll_dir=None, debug_dll_name=None,
-               defines=[], forced_includes=[], extra_bin=[]):
+               defines=[], forced_includes=[], extra_bin=[], internal=False):
     self.name = name
     if include_dirs:
       self.include_dirs = include_dirs if isinstance(include_dirs, list) \
@@ -90,6 +90,7 @@ class SVNCommonLibrary:
       self.debug_dll_name = dll_name
 
     self.extra_bin = extra_bin
+    self.internal = internal
 
 class GenDependenciesBase(gen_base.GeneratorBase):
   """This intermediate base class exists to be instantiated by win-tests.py,
@@ -305,6 +306,8 @@ class GenDependenciesBase(gen_base.Gener
     self._find_apr_util_etc()
     self._find_zlib()
     self._find_sqlite(show_warnings)
+    self._find_lz4()
+    self._find_utf8proc()
 
     # Optional dependencies
     self._find_httpd(show_warnings)
@@ -1446,6 +1449,55 @@ class GenDependenciesBase(gen_base.Gener
                                                  dll_name=dll_name,
                                                  defines=defines)
 
+  def _find_lz4(self):
+    "Find the LZ4 library"
+
+    # For now, we always use the internal (bundled) library.
+    version_file_path = os.path.join('subversion', 'libsvn_subr',
+                                     'lz4', 'lz4internal.h')
+    txt = open(version_file_path).read()
+
+    vermatch = re.search(r'^\s*#define\s+LZ4_VERSION_MAJOR\s+(\d+)',
+                         txt, re.M)
+    major = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+LZ4_VERSION_MINOR\s+(\d+)',
+                         txt, re.M)
+    minor = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+LZ4_VERSION_RELEASE\s+(\d+)',
+                         txt, re.M)
+    rel = vermatch.group(1)
+
+    lz4_version = '%d.%d.%s' % (major, minor, rel)
+    self._libraries['lz4'] = SVNCommonLibrary('lz4', None, None, None,
+                                              lz4_version, internal=True)
+
+  def _find_utf8proc(self):
+    "Find the Utf8proc library"
+
+    # For now, we always use the internal (bundled) library.
+    version_file_path = os.path.join('subversion', 'libsvn_subr',
+                                     'utf8proc', 'utf8proc_internal.h')
+    txt = open(version_file_path).read()
+
+    vermatch = re.search(r'^\s*#define\s+UTF8PROC_VERSION_MAJOR\s+(\d+)',
+                         txt, re.M)
+    major = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+UTF8PROC_VERSION_MINOR\s+(\d+)',
+                         txt, re.M)
+    minor = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+UTF8PROC_VERSION_PATCH\s+(\d+)',
+                         txt, re.M)
+    patch = int(vermatch.group(1))
+
+    utf8proc_version = '%d.%d.%d' % (major, minor, patch)
+    self._libraries['utf8proc'] = SVNCommonLibrary('utf8proc', None, None,
+                                                   None, utf8proc_version,
+                                                   internal=True)
+
 # ============================================================================
 # This is a cut-down and modified version of code from:
 #   subversion/subversion/bindings/swig/python/svn/core.py