~svn/ubuntu/oneiric/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/bindings/swig/ruby/test/windows_util.rb

  • Committer: Michael Diers
  • Date: 2010-05-12 13:55:27 UTC
  • mfrom: (0.4.1 squeeze)
  • Revision ID: mdiers@elego.de-20100512135527-r9n2rmn7zlxio5iy
subversion (1.6.9dfsg-1ubuntu0svn1) lucid
  
Merge with 1.6.9dfsg-1 from lp:debian/squeeze/subversion, revno:6.
  
The package name suffix "1ubuntu0svn1" is carefully chosen.
See https://lists.launchpad.net/svn/msg00002.html and
https://answers.launchpad.net/soyuz/+question/105396 for an
explanation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
            service_control('delete') if service_exists?
68
68
            FileUtils.rm_rf(svnserve_dir)
69
69
          end
70
 
          targets = %w(svnserve.exe libsvn_subr-1.dll libsvn_repos-1.dll
 
70
          
 
71
          config = SetupEnvironment.gen_make_opts
 
72
          apr_version_include = Pathname.new(config["--with-apr"])  +
 
73
              'include' + 'apr_version.h'
 
74
          %r'^\s*#define\s+APR_MAJOR_VERSION\s+(\d+)' =~ apr_version_include.read
 
75
          apr_major_version = $1 == '0' ? '' : "-#{$1}"
 
76
          
 
77
          targets = %W(svnserve.exe libsvn_subr-1.dll libsvn_repos-1.dll
71
78
                       libsvn_fs-1.dll libsvn_delta-1.dll
72
 
                       libaprutil.dll libapr.dll libapriconv.dll sqlite3.dll libdb44.dll libdb44d.dll)
 
79
                       libaprutil#{apr_major_version}.dll 
 
80
                       libapr#{apr_major_version}.dll 
 
81
                       libapriconv#{apr_major_version}.dll
 
82
                       libdb44.dll libdb44d.dll)
73
83
          ENV["PATH"].split(";").each do |path|
74
84
            found_targets = []
75
85
            targets.each do |target|
82
92
            targets -= found_targets
83
93
            break if targets.empty?
84
94
          end
 
95
          # Remove optional targets instead of raising below.  If they are really
 
96
          # needed, svnserve won't start anyway.
 
97
          targets -= %W[libapriconv#{apr_major_version}.dll]
85
98
          unless targets.empty?
86
99
            raise "can't find libraries to work svnserve: #{targets.join(' ')}"
87
100
          end
128
141
 
129
142
    module SetupEnvironment
130
143
      def setup_test_environment(top_dir, base_dir, ext_dir)
 
144
        @@top_dir = top_dir
131
145
 
132
146
        build_type = ENV["BUILD_TYPE"] || "Release"
133
147
 
157
171
        end
158
172
      end
159
173
 
 
174
      def gen_make_opts
 
175
        @gen_make_opts ||= begin
 
176
          lines = []
 
177
          gen_make_opts = File.join(@@top_dir, "gen-make.opts")
 
178
          lines = File.read(gen_make_opts).to_a if File.exists?(gen_make_opts)
 
179
          config = Hash.new do |hash, key|
 
180
            if /^--with-(.*)$/ =~ key
 
181
              hash[key] = File.join(@@top_dir, $1)
 
182
            end
 
183
          end
 
184
       
 
185
          lines.each do |line|
 
186
            name, value = line.chomp.split(/\s*=\s*/, 2)
 
187
            if value
 
188
              config[name] = Pathname.new(value).absolute? ?
 
189
                value :
 
190
                File.join(@@top_dir, value)
 
191
            end
 
192
          end
 
193
          config
 
194
        end
 
195
      end
 
196
      module_function :gen_make_opts
 
197
 
160
198
      private
161
199
      def setup_dll_wrapper_util(dll_dir, util)
162
200
        libsvn_swig_ruby_dll_dir = File.join(dll_dir, "libsvn_swig_ruby")
174
212
add_path.call(#{libsvn_swig_ruby_dll_dir.dump})
175
213
EOC
176
214
      end
177
 
 
 
215
      
178
216
      def add_depended_dll_path_to_dll_wrapper_util(top_dir, build_type, util)
179
 
        lines = []
180
 
        gen_make_opts = File.join(top_dir, "gen-make.opts")
181
 
        lines = File.read(gen_make_opts).to_a if File.exists?(gen_make_opts)
182
 
        config = {}
183
 
        lines.each do |line|
184
 
          name, value = line.chomp.split(/\s*=\s*/, 2)
185
 
          config[name] = value if value
186
 
        end
187
 
 
188
217
        [
189
218
         ["apr", build_type],
190
219
         ["apr-util", build_type],
191
220
         ["apr-iconv", build_type],
192
221
         ["berkeley-db", "bin"],
193
 
         ["sqlite", "bin"],
 
222
         ["libintl", "bin"],
 
223
         ["sasl", "lib"],
194
224
        ].each do |lib, sub_dir|
195
 
          lib_dir = Pathname.new(config["--with-#{lib}"] || lib)
196
 
          dll_dir = lib_dir.absolute? ?
197
 
                        lib_dir :
198
 
                        Pathname.new(top_dir) + lib_dir
199
 
          dll_dir += sub_dir
 
225
          lib_dir = Pathname.new(gen_make_opts["--with-#{lib}"])
 
226
          dll_dir = lib_dir + sub_dir
200
227
          dll_dir = dll_dir.expand_path
201
228
          util.puts("add_path.call(#{dll_dir.to_s.dump})")
202
229
        end