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 2013/07/20 12:49:59 UTC
svn commit: r1505122 - in /subversion/trunk/build/generator: gen_win.py
gen_win_dependencies.py
Author: rhuijben
Date: Sat Jul 20 10:49:58 2013
New Revision: 1505122
URL: http://svn.apache.org/r1505122
Log:
In the Windows project handling: Convert our Sqlite detection to the depency
framework. Improve handling of the reference macros.
* build/generator/gen_win.py
(get_win_includes,
get_win_lib_dirs,
get_win_libs): Properly parse reference from string.
* build/generator/gen_win_dependencies.py
(_optional_libraries): New variable.
(__init__): Always find sqlite.
(_find_sqlite): Update implementation to store result in library table.
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=1505122&r1=1505121&r2=1505122&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Sat Jul 20 10:49:58 2013
@@ -767,11 +767,9 @@ class WinGeneratorBase(gen_win_dependenc
self.apath("subversion") ]
for dep in self.get_win_depends(target, FILTER_EXTERNALLIBS):
- if dep.external_lib and \
- dep.external_lib.startswith('$(SVN_') and \
- dep.external_lib.endswith('_LIBS)'):
-
- external_lib = dep.external_lib[6:-6].lower()
+ if dep.external_lib:
+ for elib in re.findall('\$\(SVN_([^\)]*)_LIBS\)', dep.external_lib):
+ external_lib = elib.lower()
if external_lib in self._libraries:
lib = self._libraries[external_lib]
@@ -811,11 +809,6 @@ class WinGeneratorBase(gen_win_dependenc
fakeincludes.append(self.apath(self.swig_libdir, lang_subdir))
fakeincludes.append(self.swig_libdir)
- if self.sqlite_inline:
- fakeincludes.append(self.apath(self.sqlite_path))
- else:
- fakeincludes.append(self.apath(self.sqlite_path, 'inc'))
-
if target.name == "libsvnjavahl" and self.jdk_path:
fakeincludes.append(os.path.join(self.jdk_path, 'include'))
fakeincludes.append(os.path.join(self.jdk_path, 'include', 'win32'))
@@ -833,13 +826,13 @@ class WinGeneratorBase(gen_win_dependenc
fakelibdirs = []
for dep in self.get_win_depends(target, FILTER_LIBS):
- if dep.external_lib and \
- dep.external_lib.startswith('$(SVN_') and \
- dep.external_lib.endswith('_LIBS)'):
+ if dep.external_lib:
+ for elib in re.findall('\$\(SVN_([^\)]*)_LIBS\)', dep.external_lib):
+ external_lib = elib.lower()
- external_lib = dep.external_lib[6:-6].lower()
+ if external_lib not in self._libraries:
+ continue
- if external_lib in self._libraries:
lib = self._libraries[external_lib]
if debug:
@@ -883,13 +876,17 @@ class WinGeneratorBase(gen_win_dependenc
for dep in self.get_win_depends(target, FILTER_LIBS):
nondeplibs.extend(dep.msvc_libs)
- if dep.external_lib and \
- dep.external_lib.startswith('$(SVN_') and \
- dep.external_lib.endswith('_LIBS)'):
+ if dep.external_lib:
+ for elib in re.findall('\$\(SVN_([^\)]*)_LIBS\)', dep.external_lib):
- external_lib = dep.external_lib[6:-6].lower()
+ external_lib = elib.lower()
+
+ if external_lib not in self._libraries:
+ if external_lib not in self._optional_libraries:
+ print('Warning: Using undeclared dependency \'$(SVN_%s_LIBS)\'.'
+ % (elib,))
+ continue
- if external_lib in self._libraries:
lib = self._libraries[external_lib]
if debug:
@@ -897,30 +894,6 @@ class WinGeneratorBase(gen_win_dependenc
else:
nondeplibs.append(lib.lib_name)
- elif external_lib == 'sqlite':
-
- if not self.sqlite_inline:
- nondeplibs.append('sqlite3.lib')
- # else: # Is not a linkable library
-
- elif external_lib == 'apr_memcache' or \
- external_lib == 'magic':
- # Currently unhandled
- lib = None
-
- elif external_lib in ['db',
- 'intl',
- 'serf',
- 'sasl',
- 'perl',
- 'python',
- 'ruby']:
- lib = None # Suppress warnings for optional library
-
- else:
- print('Warning: Using undeclared dependency \'%s\'' % \
- (dep.external_lib,))
-
return gen_base.unique(nondeplibs)
def get_win_sources(self, target, reldir_prefix=''):
Modified: subversion/trunk/build/generator/gen_win_dependencies.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_dependencies.py?rev=1505122&r1=1505121&r2=1505122&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win_dependencies.py (original)
+++ subversion/trunk/build/generator/gen_win_dependencies.py Sat Jul 20 10:49:58 2013
@@ -100,6 +100,20 @@ class GenDependenciesBase(gen_base.Gener
_libraries = {} # Dict of SVNCommonLibrary instances of found libraries
+ _optional_libraries = [ # List of optional libraries to suppress warnings
+ 'db',
+ 'intl',
+ 'serf',
+ 'sasl',
+ 'perl',
+ 'python',
+ 'ruby',
+
+ # So optional, we don't even have any code to detect them on Windows
+ 'apr_memcache',
+ 'magic',
+ ]
+
def parse_options(self, options):
self.apr_path = 'apr'
self.apr_util_path = 'apr-util'
@@ -254,6 +268,7 @@ class GenDependenciesBase(gen_base.Gener
self._find_apr()
self._find_apr_util_and_expat()
self._find_zlib()
+ self._find_sqlite(show_warnings)
# Optional dependencies
self._find_bdb(show_warnings)
@@ -275,7 +290,6 @@ class GenDependenciesBase(gen_base.Gener
self._find_jdk()
# Find Sqlite
- self._find_sqlite()
if show_warnings:
@@ -1079,35 +1093,58 @@ class GenDependenciesBase(gen_base.Gener
dll_dir=dll_dir,
dll_name=dll_name)
- def _find_sqlite(self):
+ def _find_sqlite(self, show_warnings):
"Find the Sqlite library and version"
minimal_sqlite_version = (3, 7, 12)
- header_file = os.path.join(self.sqlite_path, 'inc', 'sqlite3.h')
+ # For SQLite we support 3 scenarios:
+ # - Installed in standard directory layout
+ # - Installed in legacy directory layout
+ # - Amalgamation compiled directly into our libraries
+
+ sqlite_base = self.sqlite_path
- # 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
+ lib_dir = None
+ dll_dir = None
+ dll_name = None
+ amalgamation = False
+ lib_name = 'sqlite3.lib'
+
+ if os.path.isfile(os.path.join(sqlite_base, 'include/sqlite3.h')):
+ # Standard layout
+ inc_dir = os.path.join(sqlite_base, 'include')
+ lib_dir = os.path.join(sqlite_base, 'lib')
+
+ # We assume a static library, but let's support shared in this case
+ if os.path.isfile(os.path.join(sqlite_base, 'bin/sqlite3.dll')):
+ dll_dir = os.path.join(sqlite_base, 'bin')
+ dll_name = 'sqlite3.dll'
+ elif os.path.isfile(os.path.join(sqlite_base, 'inc/sqlite3.h')):
+ # Standard layout
+ inc_dir = os.path.join(sqlite_base, 'inc')
+ lib_dir = os.path.join(sqlite_base, 'lib')
+
+ # We assume a static library, but let's support shared in this case
+ if os.path.isfile(os.path.join(sqlite_base, 'bin/sqlite3.dll')):
+ dll_dir = os.path.join(sqlite_base, 'bin')
+ dll_name = 'sqlite3.dll'
+ elif (os.path.isfile(os.path.join(sqlite_base, 'sqlite3.h'))
+ and os.path.isfile(os.path.join(sqlite_base, 'sqlite3.c'))):
+ # Amalgamation
+ inc_dir = sqlite_base
+ lib_dir = None
+ lib_name = None
+ amalgamation = True
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()
+ sys.stderr.write("ERROR: SQLite not found\n" % self.sqlite_path)
+ sys.stderr.write("Use '--with-sqlite' option to configure sqlite location.\n");
+ sys.exit(1)
+
+ version_file_path = os.path.join(inc_dir, 'sqlite3.h')
+
+ txt = open(version_file_path).read()
+
vermatch = re.search(r'^\s*#define\s+SQLITE_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.(\d))?"', txt, re.M)
version = vermatch.groups()
@@ -1118,16 +1155,20 @@ class GenDependenciesBase(gen_base.Gener
version = tuple(map(int, version))
- self.sqlite_version = '.'.join(str(v) for v in version)
+ sqlite_version = '.'.join(str(v) for v in version)
if version < minimal_sqlite_version:
sys.stderr.write("ERROR: sqlite %s or higher is required "
"(%s found)\n" % (
'.'.join(str(v) for v in minimal_sqlite_version),
- self.sqlite_version))
+ sqlite_version))
sys.exit(1)
- else:
- print('Found SQLite %s' % self.sqlite_version)
+
+ self.sqlite_inline = amalgamation
+ self._libraries['sqlite'] = SVNCommonLibrary('sqlite', inc_dir, lib_dir,
+ lib_name, sqlite_version,
+ dll_dir=dll_dir,
+ dll_name=dll_name)
# ============================================================================
# This is a cut-down and modified version of code from: