~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to build/generator/gen_win.py

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
    self.serf_path = None
74
74
    self.serf_lib = None
75
75
    self.bdb_path = 'db4-win32'
76
 
    self.without_neon = False
77
 
    self.neon_path = 'neon'
78
 
    self.neon_ver = 25005
79
76
    self.httpd_path = None
80
77
    self.libintl_path = None
81
78
    self.zlib_path = 'zlib'
97
94
    # Instrumentation options
98
95
    self.disable_shared = None
99
96
    self.static_apr = None
 
97
    self.static_openssl = None
100
98
    self.instrument_apr_pools = None
101
99
    self.instrument_purify_quantify = None
102
100
    self.configure_apr_util = None
119
117
        self.apr_iconv_path = val
120
118
      elif opt == '--with-serf':
121
119
        self.serf_path = val
122
 
      elif opt == '--with-neon':
123
 
        self.neon_path = val
124
 
      elif opt == '--without-neon':
125
 
        self.without_neon = True
126
120
      elif opt == '--with-httpd':
127
121
        self.httpd_path = val
128
122
        del self.skip_sections['mod_dav_svn']
162
156
        self.disable_shared = 1
163
157
      elif opt == '--with-static-apr':
164
158
        self.static_apr = 1
 
159
      elif opt == '--with-static-openssl':
 
160
        self.static_openssl = 1
165
161
      elif opt == '--vsnet-version':
166
 
        if val == '2002' or re.match('7(\.\d+)?', val):
 
162
        if val == '2002' or re.match('7(\.\d+)?$', val):
167
163
          self.vs_version = '2002'
168
164
          self.sln_version = '7.00'
169
165
          self.vcproj_version = '7.00'
170
166
          self.vcproj_extension = '.vcproj'
171
 
        elif val == '2003' or re.match('8(\.\d+)?', val):
 
167
        elif val == '2003' or re.match('8(\.\d+)?$', val):
172
168
          self.vs_version = '2003'
173
169
          self.sln_version = '8.00'
174
170
          self.vcproj_version = '7.10'
175
171
          self.vcproj_extension = '.vcproj'
176
 
        elif val == '2005' or re.match('9(\.\d+)?', val):
 
172
        elif val == '2005' or re.match('9(\.\d+)?$', val):
177
173
          self.vs_version = '2005'
178
174
          self.sln_version = '9.00'
179
175
          self.vcproj_version = '8.00'
180
176
          self.vcproj_extension = '.vcproj'
181
 
        elif val == '2008' or re.match('10(\.\d+)?', val):
 
177
        elif val == '2008' or re.match('10(\.\d+)?$', val):
182
178
          self.vs_version = '2008'
183
179
          self.sln_version = '10.00'
184
180
          self.vcproj_version = '9.00'
188
184
          self.sln_version = '11.00'
189
185
          self.vcproj_version = '10.0'
190
186
          self.vcproj_extension = '.vcxproj'
 
187
        elif val == '2012' or val == '11':
 
188
          self.vs_version = '2012'
 
189
          self.sln_version = '12.00'
 
190
          self.vcproj_version = '11.0'
 
191
          self.vcproj_extension = '.vcxproj'
 
192
        elif re.match('^1\d+$', val):
 
193
          self.vsversion = val
 
194
          self.sln_version = '12.00'
 
195
          self.vcproj_version = val + '.0'
 
196
          self.vcproj_extension = '.vcxproj'
191
197
        else:
192
198
          print('WARNING: Unknown VS.NET version "%s",'
193
199
                 ' assuming "%s"\n' % (val, '7.00'))
206
212
 
207
213
  def _find_bdb(self):
208
214
    "Find the Berkeley DB library and version"
209
 
    for ver in ("48", "47", "46", "45", "44", "43", "42", "41", "40"):
 
215
    # Before adding "60" to this list, see build/ac-macros/berkeley-db.m4.
 
216
    for ver in ("53", "52", "51", "50", "48", "47", "46",
 
217
                "45", "44", "43", "42", "41", "40"):
210
218
      lib = "libdb" + ver
211
219
      path = os.path.join(self.bdb_path, "lib")
212
220
      if os.path.exists(os.path.join(path, lib + ".lib")):
213
221
        self.bdb_lib = lib
214
222
        break
 
223
      elif os.path.exists(os.path.join(path, lib + "d.lib")):
 
224
        self.bdb_lib = lib
 
225
        break
215
226
    else:
216
227
      self.bdb_lib = None
217
228
 
230
241
    GeneratorBase.__init__(self, fname, verfname, options)
231
242
 
232
243
    if self.bdb_lib is not None:
233
 
      print("Found %s.lib in %s\n" % (self.bdb_lib, self.bdb_path))
 
244
      print("Found %s.lib or %sd.lib in %s\n" % (self.bdb_lib, self.bdb_lib,
 
245
                                                 self.bdb_path))
234
246
    else:
235
247
      print("BDB not found, BDB fs will not be built\n")
236
248
 
265
277
      self._find_zlib()
266
278
      self._find_ml()
267
279
 
268
 
    # Find neon version
269
 
    if self.neon_path:
270
 
      self._find_neon()
271
 
 
272
280
    # Find serf and its dependencies
273
281
    if self.serf_path:
274
282
      self._find_serf()
296
304
 
297
305
    # Generate the build_zlib.bat file
298
306
    if self.zlib_path:
299
 
      data = {'zlib_path': os.path.abspath(self.zlib_path),
 
307
      data = {'zlib_path': os.path.relpath(self.zlib_path, self.projfilesdir),
300
308
              'zlib_version': self.zlib_version,
301
309
              'use_ml': self.have_ml and 1 or None}
302
310
      bat = os.path.join(self.projfilesdir, 'build_zlib.bat')
336
344
 
337
345
  def find_rootpath(self):
338
346
    "Gets the root path as understand by the project system"
339
 
    return ".." + "\\.." * self.projfilesdir.count(os.sep) + "\\"
 
347
    return os.path.relpath('.', self.projfilesdir) + "\\"
340
348
 
341
349
  def makeguid(self, data):
342
350
    "Generate a windows style GUID"
382
390
      install_targets = [x for x in install_targets if not (isinstance(x, gen_base.TargetExe)
383
391
                                                            and x.install == 'bdb-test')]
384
392
 
 
393
    # Don't build serf when we don't have it or for 1.3+
 
394
    if not self.serf_lib or (self.serf_ver_maj, self.serf_ver_min) >= (1, 3):
 
395
      install_targets = [x for x in install_targets if x.name != 'serf']      
 
396
      
385
397
    # Drop the serf target if we don't have both serf and openssl
386
398
    if not self.serf_lib:
387
 
      install_targets = [x for x in install_targets if x.name != 'serf']
388
399
      install_targets = [x for x in install_targets if x.name != 'libsvn_ra_serf']
389
 
    if self.without_neon:
390
 
      install_targets = [x for x in install_targets if x.name != 'neon']
391
 
      install_targets = [x for x in install_targets if x.name != 'libsvn_ra_neon']
 
400
 
 
401
    # Don't build zlib if we have an already compiled serf
 
402
    if self.serf_lib and (self.serf_ver_maj, self.serf_ver_min) >= (1, 3):
 
403
      install_targets = [x for x in install_targets if x.name != 'zlib']
392
404
 
393
405
    # Drop the swig targets if we don't have swig
394
406
    if not self.swig_path and not self.swig_libdir:
397
409
                                             or isinstance(x, gen_base.TargetSWIGLib)
398
410
                                             or isinstance(x, gen_base.TargetSWIGProject))]
399
411
 
 
412
    # Drop the Java targets if we don't have a JDK
 
413
    if not self.jdk_path:
 
414
      install_targets = [x for x in install_targets
 
415
                                     if not (isinstance(x, gen_base.TargetJava)
 
416
                                             or isinstance(x, gen_base.TargetJavaHeaders)
 
417
                                             or x.name == '__JAVAHL__'
 
418
                                             or x.name == '__JAVAHL_TESTS__'
 
419
                                             or x.name == 'libsvnjavahl')]
 
420
 
400
421
    dll_targets = []
401
422
    for target in install_targets:
402
423
      if isinstance(target, gen_base.TargetLib):
458
479
      # Link everything except tests against the dll. Tests need to be linked
459
480
      # against the static libraries because they sometimes access internal
460
481
      # library functions.
461
 
      if dep in deps[key] and key.find("test") == -1:
 
482
 
 
483
      # ### The magic behavior for 'test' in a name and 'entries-dump' should
 
484
      # ### move to another option in build.conf
 
485
      if dep in deps[key] and key.find("test") == -1 and key != 'entries-dump':
462
486
        deps[key].remove(dep)
463
487
        deps[key].append(target)
464
488
 
685
709
            and target.external_project):
686
710
      return None
687
711
 
688
 
    if target.external_project[:5] == 'neon/':
689
 
      path = self.neon_path + target.external_project[4:]
690
 
    elif target.external_project[:5] == 'serf/' and self.serf_lib:
 
712
    if target.external_project[:5] == 'serf/' and self.serf_lib:
691
713
      path = self.serf_path + target.external_project[4:]
692
714
    elif target.external_project.find('/') != -1:
693
715
      path = target.external_project
710
732
    if self.enable_nls and name == '__ALL__':
711
733
      depends.extend(self.sections['locale'].get_targets())
712
734
 
713
 
    # Build ZLib as a dependency of Neon or Serf if we have it
714
 
    if self.zlib_path and (name == 'neon' or name == 'serf'):
 
735
    # Build ZLib as a dependency of Serf if we have it
 
736
    if self.zlib_path and name == 'serf':
715
737
      depends.extend(self.sections['zlib'].get_targets())
716
738
 
717
739
    # To set the correct build order of the JavaHL targets, the javahl-javah
876
898
    if self.enable_nls:
877
899
      fakedefines.append("ENABLE_NLS")
878
900
 
879
 
    # check for neon 0.26.x or newer
880
 
    if self.neon_ver >= 26000:
881
 
      fakedefines.append("SVN_NEON_0_26=1")
882
 
 
883
 
    # check for neon 0.27.x or newer
884
 
    if self.neon_ver >= 27000:
885
 
      fakedefines.append("SVN_NEON_0_27=1")
886
 
 
887
 
    # check for neon 0.28.x or newer
888
 
    if self.neon_ver >= 28000:
889
 
      fakedefines.append("SVN_NEON_0_28=1")
890
 
 
891
901
    if self.serf_lib:
892
902
      fakedefines.append("SVN_HAVE_SERF")
893
903
      fakedefines.append("SVN_LIBSVN_CLIENT_LINKS_RA_SERF")
894
904
 
895
 
    if self.neon_lib:
896
 
      fakedefines.append("SVN_HAVE_NEON")
897
 
      fakedefines.append("SVN_LIBSVN_CLIENT_LINKS_RA_NEON")
898
 
 
899
905
    # check we have sasl
900
906
    if self.sasl_path:
901
907
      fakedefines.append("SVN_HAVE_SASL")
933
939
                            self.path(util_includes) ])
934
940
    else:
935
941
      fakeincludes.extend([ self.apath(self.apr_util_path, "xml/expat/lib"),
936
 
                            self.apath(self.neon_path, "src"),
937
942
                            self.path("subversion/bindings/swig/proxy"),
938
943
                            self.apath(self.bdb_path, "include") ])
939
944
 
942
947
 
943
948
    if self.serf_lib:
944
949
      fakeincludes.append(self.apath(self.serf_path))
 
950
      
 
951
      if self.openssl_path and self.openssl_inc_dir:
 
952
        fakeincludes.append(self.apath(self.openssl_inc_dir))
945
953
 
946
954
    if self.swig_libdir \
947
955
       and (isinstance(target, gen_base.TargetSWIG)
975
983
      fakeincludes.append(os.path.join(self.jdk_path, 'include'))
976
984
      fakeincludes.append(os.path.join(self.jdk_path, 'include', 'win32'))
977
985
 
 
986
    if target.name.find('cxxhl') != -1:
 
987
      fakeincludes.append(self.path("subversion/bindings/cxxhl/include"))
 
988
 
978
989
    return fakeincludes
979
990
 
980
991
  def get_win_lib_dirs(self, target, cfg):
981
992
    "Return the list of library directories for target"
982
993
 
983
 
    libcfg = cfg.replace("Debug", "LibD").replace("Release", "LibR")
 
994
    expatlibcfg = cfg.replace("Debug", "LibD").replace("Release", "LibR")
 
995
    if self.static_apr:
 
996
      libcfg = expatlibcfg
 
997
    else:
 
998
      libcfg = cfg
984
999
 
985
1000
    fakelibdirs = [ self.apath(self.bdb_path, "lib"),
986
 
                    self.apath(self.neon_path),
987
1001
                    self.apath(self.zlib_path),
988
1002
                    ]
989
1003
 
993
1007
    if self.sasl_path:
994
1008
      fakelibdirs.append(self.apath(self.sasl_path, "lib"))
995
1009
    if self.serf_lib:
996
 
      fakelibdirs.append(self.apath(msvc_path_join(self.serf_path, cfg)))
 
1010
      if (self.serf_ver_maj, self.serf_ver_min) >= (1, 3):
 
1011
        fakelibdirs.append(self.apath(self.serf_path))
 
1012
        
 
1013
        if self.openssl_path and self.openssl_lib_dir:
 
1014
          fakelibdirs.append(self.apath(self.openssl_lib_dir))
 
1015
      else:
 
1016
        fakelibdirs.append(self.apath(msvc_path_join(self.serf_path, cfg)))
997
1017
 
998
 
    fakelibdirs.append(self.apath(self.apr_path, cfg))
999
 
    fakelibdirs.append(self.apath(self.apr_util_path, cfg))
 
1018
    fakelibdirs.append(self.apath(self.apr_path, libcfg))
 
1019
    fakelibdirs.append(self.apath(self.apr_util_path, libcfg))
1000
1020
    fakelibdirs.append(self.apath(self.apr_util_path, 'xml', 'expat',
1001
 
                                  'lib', libcfg))
 
1021
                                  'lib', expatlibcfg))
1002
1022
 
1003
1023
    if isinstance(target, gen_base.TargetApacheMod):
1004
1024
      fakelibdirs.append(self.apath(self.httpd_path, cfg))
1024
1044
    if self.bdb_lib:
1025
1045
      dblib = self.bdb_lib+(cfg == 'Debug' and 'd.lib' or '.lib')
1026
1046
 
1027
 
    if self.neon_lib:
1028
 
      neonlib = self.neon_lib+(cfg == 'Debug' and 'd.lib' or '.lib')
1029
 
 
1030
1047
    if self.serf_lib:
1031
 
      if self.serf_ver_maj == 1:
1032
 
        serflib = 'serf-1.lib'
 
1048
      if self.serf_ver_maj != 0:
 
1049
        serflib = 'serf-%d.lib' % self.serf_ver_maj
1033
1050
      else:
1034
1051
        serflib = 'serf.lib'
1035
1052
 
1036
 
    zlib = (cfg == 'Debug' and 'zlibstatD.lib' or 'zlibstat.lib')
 
1053
    if self.serf_lib and (self.serf_ver_maj, self.serf_ver_min) >= (1, 3):
 
1054
      # We don't build zlib ourselves, so use the standard name
 
1055
      # (zdll.lib would link to zlib.dll)
 
1056
      zlib = 'zlib.lib'
 
1057
    else:
 
1058
      # We compile zlib ourselves to these explicit (non-standard) names
 
1059
      zlib = (cfg == 'Debug' and 'zlibstatD.lib' or 'zlibstat.lib')
 
1060
      
1037
1061
    sasllib = None
1038
1062
    if self.sasl_path:
1039
1063
      sasllib = 'libsasl.lib'
1075
1099
      if dep.external_lib == '$(SVN_SQLITE_LIBS)' and not self.sqlite_inline:
1076
1100
        nondeplibs.append('sqlite3.lib')
1077
1101
 
1078
 
      if self.neon_lib and dep.external_lib == '$(NEON_LIBS)':
1079
 
        nondeplibs.append(neonlib)
1080
 
 
1081
1102
      if self.serf_lib and dep.external_lib == '$(SVN_SERF_LIBS)':
1082
1103
        nondeplibs.append(serflib)
 
1104
        if (self.serf_ver_maj, self.serf_ver_min) >= (1, 3):
 
1105
          nondeplibs.append('ssleay32.lib')
 
1106
          nondeplibs.append('libeay32.lib')
1083
1107
 
1084
1108
      if dep.external_lib == '$(SVN_SASL_LIBS)':
1085
1109
        nondeplibs.append(sasllib)
1147
1171
    if not self.zlib_path:
1148
1172
      return
1149
1173
    zlib_path = os.path.abspath(self.zlib_path)
 
1174
    zlib_sources = map(lambda x : os.path.relpath(x, self.projfilesdir),
 
1175
                       glob.glob(os.path.join(zlib_path, '*.c')) +
 
1176
                       glob.glob(os.path.join(zlib_path,
 
1177
                                              'contrib/masmx86/*.c')) +
 
1178
                       glob.glob(os.path.join(zlib_path,
 
1179
                                              'contrib/masmx86/*.asm')))
 
1180
    zlib_headers = map(lambda x : os.path.relpath(x, self.projfilesdir),
 
1181
                       glob.glob(os.path.join(zlib_path, '*.h')))
 
1182
 
1150
1183
    self.move_proj_file(self.projfilesdir, name,
1151
 
                        (('zlib_path', zlib_path),
1152
 
                         ('zlib_sources',
1153
 
                          glob.glob(os.path.join(zlib_path, '*.c'))
1154
 
                          + glob.glob(os.path.join(zlib_path,
1155
 
                                                   'contrib/masmx86/*.c'))
1156
 
                          + glob.glob(os.path.join(zlib_path,
1157
 
                                                   'contrib/masmx86/*.asm'))),
1158
 
                         ('zlib_headers',
1159
 
                          glob.glob(os.path.join(zlib_path, '*.h'))),
 
1184
                        (('zlib_path', os.path.relpath(zlib_path,
 
1185
                                                       self.projfilesdir)),
 
1186
                         ('zlib_sources', zlib_sources),
 
1187
                         ('zlib_headers', zlib_headers),
1160
1188
                         ('zlib_version', self.zlib_version),
1161
1189
                         ('project_guid', self.makeguid('zlib')),
1162
1190
                         ('use_ml', self.have_ml and 1 or None),
1163
1191
                        ))
1164
1192
 
1165
 
  def write_neon_project_file(self, name):
1166
 
    if self.without_neon:
1167
 
      return
1168
 
 
1169
 
    neon_path = os.path.abspath(self.neon_path)
1170
 
    self.move_proj_file(self.neon_path, name,
1171
 
                        (('neon_sources',
1172
 
                          glob.glob(os.path.join(neon_path, 'src', '*.c'))),
1173
 
                         ('neon_headers',
1174
 
                          glob.glob(os.path.join(neon_path, 'src', '*.h'))),
1175
 
                         ('expat_path',
1176
 
                          os.path.join(os.path.abspath(self.apr_util_path),
1177
 
                                       'xml', 'expat', 'lib')),
1178
 
                         ('zlib_path', self.zlib_path
1179
 
                                       and os.path.abspath(self.zlib_path)),
1180
 
                         ('openssl_path',
1181
 
                          self.openssl_path
1182
 
                            and os.path.abspath(self.openssl_path)),
1183
 
                         ('project_guid', self.makeguid('neon')),
1184
 
                        ))
1185
 
 
1186
1193
  def write_serf_project_file(self, name):
1187
1194
    if not self.serf_lib:
1188
1195
      return
1189
1196
 
1190
1197
    serf_path = os.path.abspath(self.serf_path)
1191
 
    if self.serf_ver_maj == 1:
1192
 
      serflib = 'serf-1.lib'
 
1198
    serf_sources = map(lambda x : os.path.relpath(x, self.serf_path),
 
1199
                       glob.glob(os.path.join(serf_path, '*.c'))
 
1200
                       + glob.glob(os.path.join(serf_path, 'auth', '*.c'))
 
1201
                       + glob.glob(os.path.join(serf_path, 'buckets',
 
1202
                                                   '*.c')))
 
1203
    serf_headers = map(lambda x : os.path.relpath(x, self.serf_path),
 
1204
                       glob.glob(os.path.join(serf_path, '*.h'))
 
1205
                       + glob.glob(os.path.join(serf_path, 'auth', '*.h'))
 
1206
                       + glob.glob(os.path.join(serf_path, 'buckets', '*.h')))
 
1207
    if self.serf_ver_maj != 0:
 
1208
      serflib = 'serf-%d.lib' % self.serf_ver_maj
1193
1209
    else:
1194
1210
      serflib = 'serf.lib'
1195
1211
 
 
1212
    apr_static = self.static_apr and 'APR_STATIC=1' or ''
 
1213
    openssl_static = self.static_openssl and 'OPENSSL_STATIC=1' or ''
1196
1214
    self.move_proj_file(self.serf_path, name,
1197
 
                        (('serf_sources',
1198
 
                          glob.glob(os.path.join(serf_path, '*.c'))
1199
 
                          + glob.glob(os.path.join(serf_path, 'auth', '*.c'))
1200
 
                          + glob.glob(os.path.join(serf_path, 'buckets',
1201
 
                                                   '*.c'))),
1202
 
                         ('serf_headers',
1203
 
                          glob.glob(os.path.join(serf_path, '*.h'))
1204
 
                          + glob.glob(os.path.join(serf_path, 'auth', '*.h'))
1205
 
                          + glob.glob(os.path.join(serf_path, 'buckets',
1206
 
                                                   '*.h'))),
1207
 
                         ('zlib_path', self.zlib_path
1208
 
                                       and os.path.abspath(self.zlib_path)),
1209
 
                         ('openssl_path',
1210
 
                          self.openssl_path
1211
 
                            and os.path.abspath(self.openssl_path)),
1212
 
                         ('apr_path', os.path.abspath(self.apr_path)),
1213
 
                         ('apr_util_path', os.path.abspath(self.apr_util_path)),
 
1215
                        (('serf_sources', serf_sources),
 
1216
                         ('serf_headers', serf_headers),
 
1217
                         ('zlib_path', os.path.relpath(self.zlib_path,
 
1218
                                                       self.serf_path)),
 
1219
                         ('openssl_path', os.path.relpath(self.openssl_path,
 
1220
                                                          self.serf_path)),
 
1221
                         ('apr_path', os.path.relpath(self.apr_path,
 
1222
                                                      self.serf_path)),
 
1223
                         ('apr_util_path', os.path.relpath(self.apr_util_path,
 
1224
                                                           self.serf_path)),
1214
1225
                         ('project_guid', self.makeguid('serf')),
1215
 
                         ('apr_static', self.static_apr),
 
1226
                         ('apr_static', apr_static),
 
1227
                         ('openssl_static', openssl_static),
1216
1228
                         ('serf_lib', serflib),
1217
1229
                        ))
1218
1230
 
1219
1231
  def move_proj_file(self, path, name, params=()):
1220
1232
    ### Move our slightly templatized pre-built project files into place --
1221
 
    ### these projects include zlib, neon, serf, locale, config, etc.
 
1233
    ### these projects include zlib, serf, locale, config, etc.
1222
1234
 
1223
1235
    dest_file = os.path.join(path, name)
1224
1236
    source_template = os.path.join('templates', name + '.ezt')
1225
1237
    data = {
1226
1238
      'version' : self.vcproj_version,
1227
1239
      'configs' : self.configs,
1228
 
      'platforms' : self.platforms
 
1240
      'platforms' : self.platforms,
 
1241
      'toolset_version' : 'v' + self.vcproj_version.replace('.',''),
1229
1242
      }
1230
1243
    for key, val in params:
1231
1244
      data[key] = val
1254
1267
             % (msg, self.perl_lib))
1255
1268
    finally:
1256
1269
      fp.close()
1257
 
      
 
1270
 
1258
1271
    fp = os.popen('perl -MConfig -e ' + escape_shell_arg(
1259
1272
                  'print $Config{archlib}'), 'r')
1260
1273
    try:
1272
1285
    self.ruby_version = None
1273
1286
    self.ruby_major_version = None
1274
1287
    self.ruby_minor_version = None
1275
 
    proc = os.popen('ruby -rrbconfig -e ' + escape_shell_arg(
 
1288
    # Pass -W0 to stifle the "-e:1: Use RbConfig instead of obsolete
 
1289
    # and deprecated Config." warning if we are using Ruby 1.9.
 
1290
    proc = os.popen('ruby -rrbconfig -W0 -e ' + escape_shell_arg(
1276
1291
                    "puts Config::CONFIG['ruby_version'];"
1277
1292
                    "puts Config::CONFIG['LIBRUBY'];"
1278
1293
                    "puts Config::CONFIG['archdir'];"
1428
1443
    finally:
1429
1444
      fp.close()
1430
1445
 
1431
 
  def _find_neon(self):
1432
 
    "Find the neon version"
1433
 
    msg = 'WARNING: Unable to determine neon version\n'
1434
 
    if self.without_neon:
1435
 
      self.neon_lib = None
1436
 
      msg = 'Not attempting to find neon\n'
1437
 
    else:
1438
 
      try:
1439
 
        self.neon_lib = "libneon"
1440
 
        fp = open(os.path.join(self.neon_path, '.version'))
1441
 
        txt = fp.read()
1442
 
        vermatch = re.compile(r'(\d+)\.(\d+)\.(\d+)$', re.M) \
1443
 
                     .search(txt)
1444
 
 
1445
 
        if vermatch:
1446
 
          version = tuple(map(int, vermatch.groups()))
1447
 
          # build/ac-macros/swig.m4 explains the next incantation
1448
 
          self.neon_ver = int('%d%02d%03d' % version)
1449
 
          msg = 'Found neon version %d.%d.%d\n' % version
1450
 
          if self.neon_ver < 25005:
1451
 
            msg = 'WARNING: Neon version 0.25.5 or higher is required'
1452
 
      except:
1453
 
        msg = 'WARNING: Error while determining neon version\n'
1454
 
        self.neon_lib = None
1455
 
 
1456
 
    print(msg)
1457
 
 
1458
1446
  def _get_serf_version(self):
1459
1447
    "Retrieves the serf version from serf.h"
1460
1448
 
1486
1474
  def _find_serf(self):
1487
1475
    "Check if serf and its dependencies are available"
1488
1476
 
1489
 
    minimal_serf_version = (0, 3, 0)
 
1477
    minimal_serf_version = (1, 2, 1)
 
1478
    
 
1479
    if self.openssl_path and os.path.exists(self.openssl_path):
 
1480
      version_path = os.path.join(self.openssl_path, 'inc32/openssl/opensslv.h')
 
1481
      if os.path.isfile(version_path):
 
1482
        # We have an OpenSSL Source location (legacy handling)
 
1483
        self.openssl_inc_dir = os.path.join(self.openssl_path, 'inc32')
 
1484
        if self.static_openssl:
 
1485
          self.openssl_lib_dir = os.path.join(self.openssl_path, 'out32')
 
1486
        else:
 
1487
          self.openssl_lib_dir = os.path.join(self.openssl_path, 'out32dll')
 
1488
      elif os.path.isfile(os.path.join(self.openssl_path,
 
1489
                          'include/openssl/opensslv.h')):
 
1490
        self.openssl_inc_dir = os.path.join(self.openssl_path, 'include')
 
1491
        self.openssl_lib_dir = os.path.join(self.openssl_path, 'lib')
 
1492
      else:
 
1493
        print('WARNING: \'opensslv.h\' not found')
 
1494
        self.openssl_path = None
 
1495
    
1490
1496
    self.serf_lib = None
1491
1497
    if self.serf_path and os.path.exists(self.serf_path):
1492
1498
      if self.openssl_path and os.path.exists(self.openssl_path):
1494
1500
        version = self._get_serf_version()
1495
1501
        if None in version:
1496
1502
          msg = 'Unknown serf version found; but, will try to build ' \
1497
 
                'ra_serf.\n'
 
1503
                'ra_serf.'
1498
1504
        else:
1499
1505
          self.serf_ver = '.'.join(str(v) for v in version)
1500
1506
          if version < minimal_serf_version:
1502
1508
            msg = 'Found serf %s, but >= %s is required. ra_serf will not be built.\n' % \
1503
1509
                  (self.serf_ver, '.'.join(str(v) for v in minimal_serf_version))
1504
1510
          else:
1505
 
            msg = 'Found serf version %s\n' % self.serf_ver
 
1511
            msg = 'Found serf %s' % self.serf_ver
1506
1512
        print(msg)
1507
1513
      else:
1508
1514
        print('openssl not found, ra_serf will not be built\n')
1512
1518
  def _find_apr(self):
1513
1519
    "Find the APR library and version"
1514
1520
 
 
1521
    minimal_apr_version = (0, 9, 0)
 
1522
 
1515
1523
    version_file_path = os.path.join(self.apr_path, 'include',
1516
1524
                                     'apr_version.h')
1517
1525
 
1523
1531
    fp = open(version_file_path)
1524
1532
    txt = fp.read()
1525
1533
    fp.close()
 
1534
 
1526
1535
    vermatch = re.search(r'^\s*#define\s+APR_MAJOR_VERSION\s+(\d+)', txt, re.M)
1527
 
 
1528
 
    major_ver = int(vermatch.group(1))
 
1536
    major = int(vermatch.group(1))
 
1537
 
 
1538
    vermatch = re.search(r'^\s*#define\s+APR_MINOR_VERSION\s+(\d+)', txt, re.M)
 
1539
    minor = int(vermatch.group(1))
 
1540
 
 
1541
    vermatch = re.search(r'^\s*#define\s+APR_PATCH_VERSION\s+(\d+)', txt, re.M)
 
1542
    patch = int(vermatch.group(1))
 
1543
 
 
1544
    version = (major, minor, patch)
 
1545
    self.apr_version = '%d.%d.%d' % version
1529
1546
 
1530
1547
    suffix = ''
1531
 
    if major_ver > 0:
1532
 
        suffix = '-%d' % major_ver
 
1548
    if major > 0:
 
1549
        suffix = '-%d' % major
1533
1550
 
1534
1551
    if self.static_apr:
1535
1552
      self.apr_lib = 'apr%s.lib' % suffix
1536
1553
    else:
1537
1554
      self.apr_lib = 'libapr%s.lib' % suffix
1538
1555
 
 
1556
    if version < minimal_apr_version:
 
1557
      sys.stderr.write("ERROR: apr %s or higher is required "
 
1558
                       "(%s found)\n" % (
 
1559
                          '.'.join(str(v) for v in minimal_apr_version),
 
1560
                          self.apr_version))
 
1561
      sys.exit(1)
 
1562
    else:
 
1563
      print('Found apr %s' % self.apr_version)
 
1564
 
1539
1565
  def _find_apr_util(self):
1540
1566
    "Find the APR-util library and version"
1541
1567
 
 
1568
    minimal_aprutil_version = (0, 9, 0)
1542
1569
    version_file_path = os.path.join(self.apr_util_path, 'include',
1543
1570
                                     'apu_version.h')
1544
1571
 
1550
1577
    fp = open(version_file_path)
1551
1578
    txt = fp.read()
1552
1579
    fp.close()
 
1580
 
1553
1581
    vermatch = re.search(r'^\s*#define\s+APU_MAJOR_VERSION\s+(\d+)', txt, re.M)
1554
 
 
1555
 
    major_ver = int(vermatch.group(1))
 
1582
    major = int(vermatch.group(1))
 
1583
 
 
1584
    vermatch = re.search(r'^\s*#define\s+APU_MINOR_VERSION\s+(\d+)', txt, re.M)
 
1585
    minor = int(vermatch.group(1))
 
1586
 
 
1587
    vermatch = re.search(r'^\s*#define\s+APU_PATCH_VERSION\s+(\d+)', txt, re.M)
 
1588
    patch = int(vermatch.group(1))
 
1589
 
 
1590
    version = (major, minor, patch)
 
1591
    self.aprutil_version = '%d.%d.%d' % version
1556
1592
 
1557
1593
    suffix = ''
1558
 
    if major_ver > 0:
1559
 
        suffix = '-%d' % major_ver
 
1594
    if major > 0:
 
1595
        suffix = '-%d' % major
1560
1596
 
1561
1597
    if self.static_apr:
1562
1598
      self.aprutil_lib = 'aprutil%s.lib' % suffix
1563
1599
    else:
1564
1600
      self.aprutil_lib = 'libaprutil%s.lib' % suffix
1565
1601
 
 
1602
    if version < minimal_aprutil_version:
 
1603
      sys.stderr.write("ERROR: aprutil %s or higher is required "
 
1604
                       "(%s found)\n" % (
 
1605
                          '.'.join(str(v) for v in minimal_aprutil_version),
 
1606
                          self.aprutil_version))
 
1607
      sys.exit(1)
 
1608
    else:
 
1609
      print('Found aprutil %s' % self.aprutil_version)
 
1610
 
1566
1611
  def _find_sqlite(self):
1567
1612
    "Find the Sqlite library and version"
1568
1613
 
 
1614
    minimal_sqlite_version = (3, 7, 12)
 
1615
 
1569
1616
    header_file = os.path.join(self.sqlite_path, 'inc', 'sqlite3.h')
1570
1617
 
1571
1618
    # First check for compiled version of SQLite.
1590
1637
    fp = open(header_file)
1591
1638
    txt = fp.read()
1592
1639
    fp.close()
1593
 
    vermatch = re.search(r'^\s*#define\s+SQLITE_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.\d)?"', txt, re.M)
1594
 
 
1595
 
    version = tuple(map(int, vermatch.groups()))
1596
 
 
1597
 
 
1598
 
    self.sqlite_version = '%d.%d.%d' % version
1599
 
 
1600
 
    msg = 'Found SQLite version %s\n'
1601
 
 
1602
 
    major, minor, patch = version
1603
 
    if major < 3 or (major == 3 and minor < 6) \
1604
 
                 or (major == 3 and minor == 6 and patch < 18):
1605
 
      sys.stderr.write("ERROR: SQLite 3.6.18 or higher is required "
1606
 
                       "(%s found)\n" % self.sqlite_version);
 
1640
    vermatch = re.search(r'^\s*#define\s+SQLITE_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.(\d))?"', txt, re.M)
 
1641
 
 
1642
    version = vermatch.groups()
 
1643
 
 
1644
    # Sqlite doesn't add patch numbers for their ordinary releases
 
1645
    if not version[3]:
 
1646
      version = version[0:3]
 
1647
 
 
1648
    version = tuple(map(int, version))
 
1649
 
 
1650
    self.sqlite_version = '.'.join(str(v) for v in version)
 
1651
 
 
1652
    if version < minimal_sqlite_version:
 
1653
      sys.stderr.write("ERROR: sqlite %s or higher is required "
 
1654
                       "(%s found)\n" % (
 
1655
                          '.'.join(str(v) for v in minimal_sqlite_version),
 
1656
                          self.sqlite_version))
1607
1657
      sys.exit(1)
1608
1658
    else:
1609
 
      print(msg % self.sqlite_version)
 
1659
      print('Found SQLite %s' % self.sqlite_version)
1610
1660
 
1611
1661
  def _find_zlib(self):
1612
1662
    "Find the ZLib library and version"
1630
1680
 
1631
1681
    self.zlib_version = '%d.%d.%d' % version
1632
1682
 
1633
 
    msg = 'Found ZLib version %s\n'
1634
 
 
1635
 
    print(msg % self.zlib_version)
 
1683
    print('Found ZLib %s' % self.zlib_version)
1636
1684
 
1637
1685
class ProjectItem:
1638
1686
  "A generic item class for holding sources info, config info, etc for a project"
1671
1719
  "Item class for holding po file info"
1672
1720
  def __init__(self, base):
1673
1721
    self.po = base + '.po'
1674
 
    self.spo = base + '.spo'
1675
1722
    self.mo = base + '.mo'
1676
1723
 
1677
1724
# MSVC paths always use backslashes regardless of current platform