You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/11/30 12:27:05 UTC

svn commit: r1717230 - in /subversion/branches/ra-git: build/generator/gen_win.py build/generator/gen_win_dependencies.py gen-make.py

Author: rhuijben
Date: Mon Nov 30 11:27:05 2015
New Revision: 1717230

URL: http://svn.apache.org/viewvc?rev=1717230&view=rev
Log:
On the ra-git branch: implement support for building with libgit2 on Windows.

* build/generator/gen_win.py
  Filter git2 items if libgit2 is not available.

* build/generator/gen_win_dependencies.py
  Add support for finding libgit2 and its version.

* gen-make.py
  Document --with-libgit2 option.

Modified:
    subversion/branches/ra-git/build/generator/gen_win.py
    subversion/branches/ra-git/build/generator/gen_win_dependencies.py
    subversion/branches/ra-git/gen-make.py

Modified: subversion/branches/ra-git/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/build/generator/gen_win.py?rev=1717230&r1=1717229&r2=1717230&view=diff
==============================================================================
--- subversion/branches/ra-git/build/generator/gen_win.py (original)
+++ subversion/branches/ra-git/build/generator/gen_win.py Mon Nov 30 11:27:05 2015
@@ -201,6 +201,13 @@ class WinGeneratorBase(gen_win_dependenc
     if 'serf' not in self._libraries:
       install_targets = [x for x in install_targets if x.name != 'libsvn_ra_serf']
 
+    # Drop git support if we don't have libgit2
+    if 'libgit2' not in self._libraries:
+      install_targets = [x for x in install_targets if x.name != 'libsvn_fs_git']
+      install_targets = [x for x in install_targets if x.name != 'libsvn_ra_git']
+      install_targets = [x for x in install_targets if not (isinstance(x, gen_base.TargetExe)
+                                                            and x.install == 'git-test')]
+
     # Drop the swig targets if we don't have swig or language support
     install_targets = [x for x in install_targets
                        if (not (isinstance(x, gen_base.TargetSWIG)

Modified: subversion/branches/ra-git/build/generator/gen_win_dependencies.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/build/generator/gen_win_dependencies.py?rev=1717230&r1=1717229&r2=1717230&view=diff
==============================================================================
--- subversion/branches/ra-git/build/generator/gen_win_dependencies.py (original)
+++ subversion/branches/ra-git/build/generator/gen_win_dependencies.py Mon Nov 30 11:27:05 2015
@@ -112,6 +112,7 @@ class GenDependenciesBase(gen_base.Gener
         'db',
         'intl',
         'serf',
+        'libgit2',
         'sasl',
         'swig',
         'perl',
@@ -139,6 +140,7 @@ class GenDependenciesBase(gen_base.Gener
     self.serf_path = None
     self.bdb_path = None
     self.httpd_path = None
+    self.libgit2_path = None
     self.libintl_path = None
     self.zlib_path = 'zlib'
     self.openssl_path = None
@@ -201,6 +203,8 @@ class GenDependenciesBase(gen_base.Gener
         self.sasl_path = val
       elif opt == '--with-openssl':
         self.openssl_path = val
+      elif opt == '--with-libgit2':
+        self.libgit2_path = val
       elif opt == '--enable-purify':
         self.instrument_purify_quantify = 1
         self.instrument_apr_pools = 1
@@ -308,6 +312,7 @@ class GenDependenciesBase(gen_base.Gener
     self._find_serf(show_warnings)
     self._find_sasl(show_warnings)
     self._find_libintl(show_warnings)
+    self._find_libgit2(show_warnings)
 
     self._find_jdk(show_warnings)
 
@@ -1359,6 +1364,51 @@ class GenDependenciesBase(gen_base.Gener
                                                dll_dir=dll_dir,
                                                dll_name=dll_name)
 
+  def _find_libgit2(self, show_warnings):
+    "Find gettext support"
+    minimal_libgit2_version = (0, 22, 0)
+
+    if not self.libgit2_path:
+      return;
+
+    if os.path.isfile(os.path.join(self.libgit2_path, \
+                                     'include', 'git2', 'version.h')):
+      inc_dir = os.path.join(self.libgit2_path, 'include')
+      lib_dir = os.path.join(self.libgit2_path, 'lib')
+
+      lib_name = 'libgit2.lib'
+    else:
+      if (show_warnings):
+        print('WARNING: \'git2/version.h\' not found')
+        print("Use '--with-libgit2' to configure libgit2 location.")
+      return
+
+    version_file_path = os.path.join(inc_dir, 'git2/version.h')
+    txt = open(version_file_path).read()
+
+    vermatch = re.search(r'^\s*#define\s+LIBGIT2_VER_MAJOR\s+(\d+)', txt, re.M)
+    major = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+LIBGIT2_VER_MINOR\s+(\d+)', txt, re.M)
+    minor = int(vermatch.group(1))
+
+    vermatch = re.search(r'^\s*#define\s+LIBGIT2_VER_PATCH\s+(\d+)', txt, re.M)
+    patch = int(vermatch.group(1))
+
+    version = (major, minor, patch)
+
+    libgit2_version = '.'.join(str(v) for v in version)
+
+    if version < minimal_libgit2_version:
+      if show_warnings:
+        print('Found libgit2 %s, but >= %s is required.\n' % \
+              (libgit2_version,
+               '.'.join(str(v) for v in minimal_libgit2_version)))
+      return
+
+    self._libraries['libgit2'] = SVNCommonLibrary('libgit2', inc_dir, lib_dir,
+                                                   'libgit2.lib', libgit2_version)
+
   def _find_sqlite(self, show_warnings):
     "Find the Sqlite library and version"
 

Modified: subversion/branches/ra-git/gen-make.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/gen-make.py?rev=1717230&r1=1717229&r2=1717230&view=diff
==============================================================================
--- subversion/branches/ra-git/gen-make.py (original)
+++ subversion/branches/ra-git/gen-make.py Mon Nov 30 11:27:05 2015
@@ -180,6 +180,9 @@ def _usage_exit(err=None):
   print("  --with-sqlite=DIR")
   print("           look for sqlite in DIR")
   print("")
+  print("  --with-libgit2=DIR")
+  print("           look for sqlite in DIR")
+  print("")
   print("  --with-sasl=DIR")
   print("           look for the sasl headers and libs in DIR")
   print("")
@@ -246,6 +249,7 @@ if __name__ == '__main__':
                             'with-berkeley-db=',
                             'with-serf=',
                             'with-httpd=',
+                            'with-libgit2=',
                             'with-libintl=',
                             'with-openssl=',
                             'with-zlib=',