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 2010/11/12 11:42:08 UTC
svn commit: r1034340 - /subversion/trunk/build/generator/gen_win.py
Author: rhuijben
Date: Fri Nov 12 10:42:07 2010
New Revision: 1034340
URL: http://svn.apache.org/viewvc?rev=1034340&view=rev
Log:
Detect the version of ZLib we build as part of the Windows build. This in
preparation of handling newer ZLibs different then older versions.
* build/generator/gen_win.py
(WinGeneratorBase::__init__): Call _find_zlib() to detect the zlib version
and pass zlib version to build_zlib.ezt
(WinGeneratorBase::write_zlib_project_file): Pass zlib version to project
template.
(WinGeneratorBase::_find_zlib): New function.
Modified:
subversion/trunk/build/generator/gen_win.py
Modified: subversion/trunk/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=1034340&r1=1034339&r2=1034340&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Fri Nov 12 10:42:07 2010
@@ -255,8 +255,9 @@ class WinGeneratorBase(GeneratorBase):
# Find Sqlite
self._find_sqlite()
- # Look for ML
+ # Look for ZLib and ML
if self.zlib_path:
+ self._find_zlib()
self._find_ml()
# Find neon version
@@ -284,6 +285,7 @@ class WinGeneratorBase(GeneratorBase):
# Generate the build_zlib.bat file
if self.zlib_path:
data = {'zlib_path': os.path.abspath(self.zlib_path),
+ 'zlib_version': self.zlib_version,
'use_ml': self.have_ml and 1 or None}
bat = os.path.join('build', 'win32', 'build_zlib.bat')
self.write_with_template(bat, 'build_zlib.ezt', data)
@@ -1125,6 +1127,7 @@ class WinGeneratorBase(GeneratorBase):
'contrib/masmx86/*.asm'))),
('zlib_headers',
glob.glob(os.path.join(zlib_path, '*.h'))),
+ ('zlib_version', self.zlib_version),
('project_guid', self.makeguid('zlib')),
))
@@ -1544,6 +1547,32 @@ class WinGeneratorBase(GeneratorBase):
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):