wxruby3 0.9.5 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +440 -84
  3. data/README.md +40 -23
  4. data/ext/mkrf_conf_ext.rb +68 -0
  5. data/lib/wx/core/ext.rb +22 -3
  6. data/lib/wx/core/secret_store.rb +38 -0
  7. data/lib/wx/doc/extra/02_lifecycles.md +4 -4
  8. data/lib/wx/doc/extra/14_config.md +1 -1
  9. data/lib/wx/doc/secret_store.rb +55 -0
  10. data/lib/wx/version.rb +1 -1
  11. data/lib/wx/wxruby/base.rb +8 -8
  12. data/lib/wx/wxruby/cmd/check.rb +182 -0
  13. data/lib/wx/wxruby/cmd/sampler.rb +39 -29
  14. data/lib/wx/wxruby/cmd/setup.rb +125 -0
  15. data/lib/wx/wxruby/cmd/test.rb +56 -6
  16. data/rakelib/bin.rake +48 -0
  17. data/rakelib/bin.rb +62 -0
  18. data/rakelib/build.rb +11 -7
  19. data/rakelib/config.rake +3 -1
  20. data/rakelib/configure.rb +63 -35
  21. data/rakelib/doc.rake +3 -1
  22. data/rakelib/gem.rake +199 -0
  23. data/rakelib/gem.rb +334 -0
  24. data/rakelib/install.rb +5 -3
  25. data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
  26. data/rakelib/lib/config/linux.rb +26 -2
  27. data/rakelib/lib/config/macosx.rb +58 -11
  28. data/rakelib/lib/config/mingw.rb +134 -10
  29. data/rakelib/lib/config/pkgman/linux.rb +144 -0
  30. data/rakelib/lib/config/pkgman/macosx.rb +122 -0
  31. data/rakelib/lib/config/unixish.rb +47 -20
  32. data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
  33. data/rakelib/lib/config.rb +301 -88
  34. data/rakelib/lib/core/package.rb +47 -49
  35. data/rakelib/lib/director/aui_manager.rb +1 -1
  36. data/rakelib/lib/director/dialog.rb +8 -0
  37. data/rakelib/lib/director/gdicommon.rb +1 -2
  38. data/rakelib/lib/director/grid_ctrl.rb +2 -2
  39. data/rakelib/lib/director/richtext_composite_object.rb +2 -4
  40. data/rakelib/lib/director/secret_store.rb +117 -0
  41. data/rakelib/lib/director/tree_event.rb +2 -2
  42. data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
  43. data/rakelib/lib/generate/doc.rb +29 -14
  44. data/rakelib/lib/generate/interface.rb +4 -2
  45. data/rakelib/lib/specs/interfaces.rb +1 -0
  46. data/rakelib/lib/swig_runner.rb +11 -11
  47. data/rakelib/lib/typemap/common.rb +10 -0
  48. data/rakelib/prepost.rake +17 -5
  49. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +18 -0
  50. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +5 -5
  51. data/rakelib/yard/yard/relative_markdown_links.rb +7 -1
  52. data/samples/sampler/sample.rb +2 -0
  53. data/tests/lib/wxapp_runner.rb +1 -1
  54. data/tests/test_config.rb +7 -4
  55. data/tests/test_secret_store.rb +83 -0
  56. metadata +46 -23
  57. data/ext/mkrf_conf_srcgem.rb +0 -67
  58. data/rakelib/run.rake +0 -52
@@ -9,6 +9,9 @@
9
9
  require 'rbconfig'
10
10
  require 'fileutils'
11
11
  require 'json'
12
+ require 'open3'
13
+ require 'monitor'
14
+ require 'plat4m'
12
15
 
13
16
  module FileUtils
14
17
  # add convenience methods
@@ -65,7 +68,8 @@ module WXRuby3
65
68
  'sodir' => '$siterubyverarch',
66
69
  }
67
70
 
68
- CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen})
71
+ CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen git})
72
+ WXW_SYS_KEY = 'with-system-wxwin'
69
73
  CONFIG.merge!({
70
74
  'wxwin' => ENV['WXWIN'] || '',
71
75
  'wxxml' => ENV['WXXML'] || '',
@@ -73,14 +77,16 @@ module WXRuby3
73
77
  'with-wxwin' => !!ENV['WITH_WXWIN'],
74
78
  'with-debug' => ((ENV['WXRUBY_DEBUG'] || '') == '1'),
75
79
  'swig' => ENV['WXRUBY_SWIG'] || 'swig',
76
- 'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen'
80
+ 'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen',
81
+ 'git' => ENV['WXRUBY_GIT'] || 'git'
77
82
  })
83
+ CONFIG['autoinstall'] = (ENV['WXRUBY_AUTOINSTALL'] != '0') if ENV['WXRUBY_AUTOINSTALL']
78
84
  BUILD_CFG = '.wxconfig'
79
85
 
80
86
  # Ruby 2.5 is the minimum version for wxRuby3
81
87
  __rb_ver = RUBY_VERSION.split('.').collect {|v| v.to_i}
82
88
  if (__rb_major = __rb_ver.shift) < 2 || (__rb_major == 2 && __rb_ver.shift < 5)
83
- STDERR.puts 'ERROR: wxRuby3 requires Ruby >= 2.5.0!'
89
+ $stderr.puts 'ERROR: wxRuby3 requires Ruby >= 2.5.0!'
84
90
  exit(1)
85
91
  end
86
92
 
@@ -111,38 +117,186 @@ module WXRuby3
111
117
 
112
118
  module Config
113
119
 
114
- def do_run(*cmd, capture: nil)
115
- output = nil
116
- if capture
117
- env_bup = exec_env.keys.inject({}) do |h, ev|
118
- h[ev] = ENV[ev] ? ENV[ev].dup : nil
119
- h
120
+ def self.command_to_s(*cmd)
121
+ txt = if ::Hash === cmd.first
122
+ cmd = cmd.dup
123
+ env = cmd.shift
124
+ env.collect { |k, v| "#{k}=#{v}" }.join(' ') << ' '
125
+ else
126
+ ''
127
+ end
128
+ txt << cmd.join(' ')
129
+ end
130
+
131
+ def run_silent?
132
+ !!ENV['WXRUBY_RUN_SILENT']
133
+ end
134
+
135
+ def silent_log_name
136
+ ENV['WXRUBY_RUN_SILENT'] || 'silent_run.log'
137
+ end
138
+
139
+ def log_progress(msg)
140
+ run_silent? ? silent_runner.log(msg) : $stdout.puts(msg)
141
+ end
142
+
143
+ class SilentRunner < Monitor
144
+
145
+ PROGRESS_CH = '.|/-\\|/-\\|'
146
+
147
+ def initialize
148
+ super
149
+ @cout = 0
150
+ @incremental = false
151
+ end
152
+
153
+ def incremental(f=true)
154
+ synchronize do
155
+ @cout = 0
156
+ @incremental = !!f
120
157
  end
121
- case capture
122
- when :out
123
- # default
124
- when :no_err
125
- # redirect stderr to null sink
126
- cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
127
- when :err, :all
128
- cmd << '2>&1'
158
+ end
159
+
160
+ def run(*cmd, **kwargs)
161
+ synchronize do
162
+ @cout = 0 unless @incremental
129
163
  end
130
- begin
131
- # setup ENV for child execution
132
- ENV.merge!(Config.instance.exec_env)
133
- output = `#{cmd.join(' ')}`
134
- ensure
135
- # restore ENV
136
- env_bup.each_pair do |k,v|
137
- if v
138
- ENV[k] = v
139
- else
140
- ENV.delete(k)
164
+ output = nil
165
+ verbose = kwargs.delete(:verbose)
166
+ capture = kwargs.delete(:capture)
167
+ if (Config.instance.verbose? && verbose != false) || !capture
168
+ txt = Config.command_to_s(*cmd)
169
+ if Config.instance.verbose? && verbose != false
170
+ $stdout.puts txt
171
+ end
172
+ if !capture
173
+ silent_log { |f| f.puts txt }
174
+ end
175
+ end
176
+ if capture
177
+ if capture == :out || capture == :no_err
178
+ kwargs[:err] = (Config.instance.windows? ? 'NULL' : '/dev/null') if capture == :no_err
179
+ Open3.popen2(*cmd, **kwargs) do |_ins, os, tw|
180
+ output = silent_runner(os)
181
+ tw.value
182
+ end
183
+ else
184
+ Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
185
+ output = silent_runner(eos)
186
+ tw.value
187
+ end
188
+ end
189
+ output.join
190
+ else
191
+ rc = silent_log do |fout|
192
+ Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
193
+ silent_runner(eos, fout)
194
+ v = tw.value.exitstatus
195
+ fout.puts "-> Exit code: #{v}"
196
+ v
141
197
  end
142
198
  end
199
+ rc
200
+ end
201
+ end
202
+
203
+ def log(msg)
204
+ silent_log { |f| f.puts(msg) }
205
+ end
206
+
207
+ private
208
+
209
+ def silent_runner(os, output=[])
210
+ synchronize do
211
+ if @incremental
212
+ @cout += 1
213
+ $stdout.print "#{PROGRESS_CH[@cout%10]}\b"
214
+ $stdout.flush
215
+ end
216
+ end
217
+ os.each do |ln|
218
+ synchronize do
219
+ unless @incremental
220
+ @cout += 1
221
+ $stdout.print "#{PROGRESS_CH[@cout%10]}\b"
222
+ $stdout.flush
223
+ end
224
+ output << ln
225
+ end
226
+ end
227
+ output
228
+ end
229
+
230
+ def silent_log(&block)
231
+ File.open(Config.instance.silent_log_name, 'a') do |fout|
232
+ block.call(fout)
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ def silent_runner
239
+ @silent_runner ||= SilentRunner.new
240
+ end
241
+ private :silent_runner
242
+
243
+ def do_silent_run(*cmd, **kwargs)
244
+ silent_runner.run(*cmd, **kwargs)
245
+ end
246
+ private :do_silent_run
247
+
248
+ def do_silent_run_step(*cmd, **kwargs)
249
+ silent_runner.run_one(*cmd, **kwargs)
250
+ end
251
+ private :do_silent_run_step
252
+
253
+ def set_silent_run_incremental
254
+ silent_runner.incremental
255
+ end
256
+
257
+ def set_silent_run_batched
258
+ silent_runner.incremental(false)
259
+ end
260
+
261
+ def do_run(*cmd, capture: nil)
262
+ output = nil
263
+ if run_silent?
264
+ output = do_silent_run(exec_env, *cmd, capture: capture)
265
+ unless capture
266
+ fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" unless output == 0
143
267
  end
144
268
  else
145
- Rake.sh(exec_env, *cmd, verbose: verbose?)
269
+ if capture
270
+ env_bup = exec_env.keys.inject({}) do |h, ev|
271
+ h[ev] = ENV[ev] ? ENV[ev].dup : nil
272
+ h
273
+ end
274
+ case capture
275
+ when :out
276
+ # default
277
+ when :no_err
278
+ # redirect stderr to null sink
279
+ cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
280
+ when :err, :all
281
+ cmd << '2>&1'
282
+ end
283
+ begin
284
+ # setup ENV for child execution
285
+ ENV.update(Config.instance.exec_env)
286
+ output = `#{cmd.join(' ')}`
287
+ ensure
288
+ # restore ENV
289
+ env_bup.each_pair do |k,v|
290
+ if v
291
+ ENV[k] = v
292
+ else
293
+ ENV.delete(k)
294
+ end
295
+ end
296
+ end
297
+ else
298
+ Rake.sh(exec_env, *cmd, verbose: verbose?)
299
+ end
146
300
  end
147
301
  output
148
302
  end
@@ -182,24 +336,32 @@ module WXRuby3
182
336
  def expand(cmd)
183
337
  `#{cmd}`
184
338
  end
185
- private :expand
186
339
 
187
- def sh(*cmd, **kwargs)
188
- Rake.sh(*cmd, **kwargs) { |ok,_| !!ok }
340
+ def sh(*cmd, fail_on_error: false, **kwargs)
341
+ if run_silent?
342
+ rc = do_silent_run(*cmd, **kwargs)
343
+ fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" if fail_on_error && rc != 0
344
+ rc == 0
345
+ elsif fail_on_error
346
+ Rake.sh(*cmd, **kwargs)
347
+ else
348
+ Rake.sh(*cmd, **kwargs) { |ok,_| !!ok }
349
+ end
189
350
  end
190
- private :sh
191
351
  alias :bash :sh
192
- private :bash
193
352
 
194
353
  def test(*tests, **options)
195
354
  errors = 0
355
+ excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(':')
196
356
  tests = Dir.glob(File.join(Config.instance.test_dir, '*.rb')) if tests.empty?
197
357
  tests.each do |test|
198
- unless File.exist?(test)
199
- test = File.join(Config.instance.test_dir, test)
200
- test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
358
+ unless excludes.include?(File.basename(test, '.*'))
359
+ unless File.exist?(test)
360
+ test = File.join(Config.instance.test_dir, test)
361
+ test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
362
+ end
363
+ Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
201
364
  end
202
- Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
203
365
  end
204
366
  fail "ERRORS: ##{errors} test scripts failed." if errors>0
205
367
  end
@@ -209,26 +371,60 @@ module WXRuby3
209
371
  Rake.sh(Config.instance.exec_env, *make_ruby_cmd('-x', irb_cmd), **options)
210
372
  end
211
373
 
212
- def check_git
213
- if expand("which git 2>/dev/null").chomp.empty?
214
- STDERR.puts 'ERROR: Need GIT installed to run wxRuby3 bootstrap!'
215
- exit(1)
216
- end
374
+ def check_wx_config
375
+ false
376
+ end
377
+
378
+ def wx_config(_option)
379
+ nil
217
380
  end
218
381
 
219
- def check_doxygen
220
- if expand("which #{get_config('doxygen')} 2>/dev/null").chomp.empty?
221
- STDERR.puts "ERROR: Cannot find #{get_config('doxygen')}. Need Doxygen installed to run wxRuby3 bootstrap!"
382
+ def check_tool_pkgs
383
+ []
384
+ end
385
+
386
+ def download_file(_url, _dest)
387
+ raise NoMethodError
388
+ end
389
+
390
+ def install_prerequisites
391
+ pkg_deps = check_tool_pkgs
392
+ if get_config('autoinstall') == false
393
+ $stderr.puts <<~__ERROR_TXT
394
+ ERROR: This system lacks installed versions of the following required software packages:
395
+ #{pkg_deps.join(', ')}
396
+
397
+ Install these packages and try again.
398
+ __ERROR_TXT
222
399
  exit(1)
223
400
  end
401
+ pkg_deps
224
402
  end
225
403
 
226
- def check_wx_config
227
- false
404
+ # only called after src gem build
405
+ def cleanup_prerequisites
406
+ # noop
228
407
  end
229
408
 
230
- def wx_config(_option)
231
- nil
409
+ def wants_autoinstall?
410
+ flag = get_config('autoinstall')
411
+ if flag.nil?
412
+ $stdout.puts <<~__Q_TEXT
413
+
414
+ [ --- ATTENTION! --- ]
415
+ wxRuby3 requires some software packages to be installed before being able to continue building.
416
+ If you like these can be automatically installed next (if you are building the source gem the
417
+ software will be removed again after building finishes).
418
+ Do you want to have the required software installed now? [yN] :
419
+ __Q_TEXT
420
+ answer = $stdin.gets(chomp: true).strip
421
+ while !answer.empty? && !%w[Y y N n].include?(answer)
422
+ $stdout.puts 'Please answer Y/y or N/n [Yn] : '
423
+ answer = $stdin.gets(chomp: true).strip
424
+ end
425
+ flag = %w[Y y].include?(answer)
426
+ end
427
+ flag
232
428
  end
233
429
 
234
430
  def get_config(key)
@@ -253,16 +449,22 @@ module WXRuby3
253
449
  def get_rpath_origin
254
450
  ''
255
451
  end
452
+ protected :get_rpath_origin
256
453
 
257
- def check_rpath_patch
454
+ def patch_rpath(_shlib, *)
258
455
  true
259
456
  end
457
+ protected :patch_rpath
260
458
 
261
- def patch_rpath(_shlib, *)
459
+ def update_shlib_loadpaths(_shlib)
262
460
  true
263
461
  end
264
462
 
265
- def update_shlib_loadpaths(_shlib, _deplibs)
463
+ def update_shlib_ruby_libpath(_shlib)
464
+ true
465
+ end
466
+
467
+ def update_shlib_wxwin_libpaths(_shlib, _deplibs)
266
468
  true
267
469
  end
268
470
 
@@ -304,15 +506,23 @@ module WXRuby3
304
506
  end
305
507
 
306
508
  def save
509
+ cfg = WXRuby3::CONFIG.dup
510
+ wxw_system = !!cfg.delete(WXW_SYS_KEY)
511
+ cfg['wxwin'] = '@system' if wxw_system
307
512
  File.open(build_cfg, 'w') do |f|
308
- f << JSON.pretty_generate(WXRuby3::CONFIG)
513
+ f << JSON.pretty_generate(cfg)
309
514
  end
310
515
  end
311
516
 
312
517
  def load
313
518
  if File.file?(build_cfg)
314
519
  File.open(build_cfg, 'r') do |f|
315
- WXRuby3::CONFIG.merge!(JSON.load(f.read))
520
+ cfg = JSON.load(f.read)
521
+ if cfg['wxwin'] == '@system'
522
+ cfg[WXW_SYS_KEY] = true
523
+ cfg.delete('wxwin')
524
+ end
525
+ WXRuby3::CONFIG.merge!(cfg)
316
526
  end
317
527
  end
318
528
  end
@@ -325,10 +535,8 @@ module WXRuby3
325
535
  case RUBY_PLATFORM
326
536
  when /mingw/
327
537
  :mingw
328
- when /cygwin/
329
- :cygwin
330
- when /netbsd/
331
- :netbsd
538
+ when /freebsd/
539
+ :freebsd
332
540
  when /darwin/
333
541
  :macosx
334
542
  when /linux/
@@ -341,22 +549,33 @@ module WXRuby3
341
549
  def create
342
550
  load # load the build config (if any)
343
551
  klass = Class.new do
344
- include Config
345
-
346
552
  include FileUtils
347
553
 
554
+ include Config
555
+
348
556
  def initialize
349
557
  @ruby_exe = RB_CONFIG["ruby_install_name"]
350
558
 
351
- @extmk = /extmk\.rb/ =~ $0
352
- @platform = Config.platform
353
- require File.join(File.dirname(__FILE__), 'config', @platform.to_s)
559
+ @sysinfo = Plat4m.current rescue nil
560
+ @platform = if @sysinfo
561
+ case @sysinfo.os.id
562
+ when :darwin
563
+ :macosx
564
+ when :windows
565
+ RUBY_PLATFORM =~ /mingw/ ? :mingw : :unknown
566
+ else
567
+ @sysinfo.os.id
568
+ end
569
+ else
570
+ :unknown
571
+ end
572
+ require_relative File.join('config', @platform.to_s)
354
573
  self.class.include(WXRuby3::Config::Platform)
355
574
 
356
575
  init # initialize settings
357
576
  end
358
577
 
359
- attr_reader :ruby_exe, :extmk, :platform, :helper_modules, :helper_inits, :include_modules, :verbosity
578
+ attr_reader :ruby_exe, :sysinfo, :platform, :helper_modules, :helper_inits, :include_modules, :verbosity
360
579
  attr_reader :release_build, :debug_build, :verbose_debug, :no_deprecate
361
580
  attr_reader :ruby_cppflags, :ruby_ldflags, :ruby_libs, :extra_cflags, :extra_cppflags, :extra_ldflags,
362
581
  :extra_libs, :cpp_out_flag, :link_output_flag, :obj_ext, :dll_ext,
@@ -403,11 +622,6 @@ module WXRuby3
403
622
 
404
623
  # Extra swig helper files to be built
405
624
  @helper_modules = %w|RubyStockObjects|
406
- # if macosx?
407
- # %w|RubyStockObjects Mac|
408
- # else
409
- # %w|RubyStockObjects|
410
- # end
411
625
  # helper to initialize on startup (stock objects can only be initialized after App creation)
412
626
  @helper_inits = @helper_modules - %w|RubyStockObjects|
413
627
 
@@ -431,8 +645,10 @@ module WXRuby3
431
645
  @ruby_includes = [ RB_CONFIG["rubyhdrdir"],
432
646
  RB_CONFIG["sitehdrdir"],
433
647
  RB_CONFIG["vendorhdrdir"],
434
- File.join(RB_CONFIG["rubyhdrdir"],
435
- RB_CONFIG['arch']) ].compact
648
+ RB_CONFIG['rubyarchhdrdir'] ?
649
+ RB_CONFIG['rubyarchhdrdir'] :
650
+ File.join(RB_CONFIG["rubyhdrdir"], RB_CONFIG['arch'])
651
+ ].compact
436
652
  @ruby_includes << File.join(@wxruby_path, 'include')
437
653
 
438
654
  @ruby_cppflags = [RB_CONFIG["CFLAGS"]].compact
@@ -448,7 +664,7 @@ module WXRuby3
448
664
  @obj_ext = RB_CONFIG["OBJEXT"]
449
665
  @dll_ext = RB_CONFIG['DLEXT']
450
666
 
451
- # Exclude certian classes from being built, even if they are present
667
+ # Exclude certain classes from being built, even if they are present
452
668
  # in the configuration of wxWidgets.
453
669
  if ENV['WXRUBY_EXCLUDED']
454
670
  ENV['WXRUBY_EXCLUDED'].split(",").each { |classname| exclude_module(classname) }
@@ -482,10 +698,9 @@ module WXRuby3
482
698
 
483
699
  def report
484
700
  if @debug_build
485
- puts "Enabled DEBUG build"
486
- puts "Enabled debugging output"
701
+ log_progress("Enabled DEBUG build")
487
702
  else
488
- puts "Enabled RELEASE build"
703
+ log_progress("Enabled RELEASE build")
489
704
  end
490
705
  end
491
706
 
@@ -513,16 +728,12 @@ module WXRuby3
513
728
  @wx_abi_version || ''
514
729
  end
515
730
 
516
- def cygwin?
517
- @platform == :cygwin
518
- end
519
-
520
731
  def mingw?
521
732
  @platform == :mingw
522
733
  end
523
734
 
524
- def netbsd?
525
- @platform == :netbsd
735
+ def freebsd?
736
+ @platform == :freebsd
526
737
  end
527
738
 
528
739
  def macosx?
@@ -534,7 +745,7 @@ module WXRuby3
534
745
  end
535
746
 
536
747
  def windows?
537
- mingw? || cygwin?
748
+ mingw?
538
749
  end
539
750
 
540
751
  def ldflags(_target)
@@ -550,7 +761,7 @@ module WXRuby3
550
761
  end
551
762
 
552
763
  def do_bootstrap
553
- check_doxygen
764
+ install_prerequisites
554
765
  # do we have a local wxWidgets tree already?
555
766
  unless File.directory?(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen'))
556
767
  wx_checkout
@@ -567,6 +778,11 @@ module WXRuby3
567
778
  respawn_rake
568
779
  end
569
780
 
781
+ def cleanup_bootstrap
782
+ rm_rf(File.join(ext_path, 'wxWidgets'), verbose: !WXRuby3.config.run_silent?) if File.directory?(File.join(ext_path, 'wxWidgets'))
783
+ cleanup_prerequisites
784
+ end
785
+
570
786
  # Testing the relevant wxWidgets setup.h file to see what
571
787
  # features are supported.
572
788
 
@@ -638,10 +854,7 @@ module WXRuby3
638
854
  private :create
639
855
 
640
856
  def instance
641
- unless @instance
642
- @instance = create
643
- end
644
- @instance
857
+ @instance ||= create
645
858
  end
646
859
 
647
860
  def get_config(key)
@@ -604,55 +604,53 @@ module WXRuby3
604
604
  def generate_core_doc
605
605
  script = <<~__SCRIPT
606
606
  require 'wx'
607
- Wx::App.run do
608
- STDOUT.puts \<<~__HEREDOC
609
- # ----------------------------------------------------------------------------
610
- # This file is automatically generated by the WXRuby3 documentation
611
- # generator. Do not alter this file.
612
- # ----------------------------------------------------------------------------
613
-
614
-
615
- module Wx
616
-
617
- # wxRuby version string
618
- Wx::WXRUBY_VERSION = '\#{Wx::WXRUBY_VERSION}'
619
-
620
- # wxRuby version release type (alpha, beta, rc)
621
- Wx::WXRUBY_RELEASE_TYPE = '\#{Wx::WXRUBY_RELEASE_TYPE}'
622
- # wxRuby major version number
623
- Wx::WXRUBY_MAJOR = \#{Wx::WXRUBY_MAJOR}
624
- # wxRuby minor version number
625
- Wx::WXRUBY_MINOR = \#{Wx::WXRUBY_MINOR}
626
- # wxRuby release number
627
- Wx::WXRUBY_RELEASE = \#{Wx::WXRUBY_RELEASE}
628
-
629
- # Convenience string for WxWidgets version info
630
- WXWIDGETS_VERSION = '\#{Wx::WXWIDGETS_VERSION}'
631
-
632
- # Integer constant reflecting the major version of the wxWidgets release used to build wxRuby
633
- WXWIDGETS_MAJOR_VERSION = \#{Wx::WXWIDGETS_MAJOR_VERSION}
634
-
635
- # Integer constant reflecting the minor version of the wxWidgets release used to build wxRuby
636
- WXWIDGETS_MINOR_VERSION = \#{Wx::WXWIDGETS_MINOR_VERSION}
637
-
638
- # Integer constant reflecting the release number of the wxWidgets release used to build wxRuby
639
- WXWIDGETS_RELEASE_NUMBER = \#{Wx::WXWIDGETS_RELEASE_NUMBER}
640
-
641
- # Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
642
- WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
643
-
644
- # Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
645
- WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
646
-
647
- # Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
648
- DEBUG = \#{Wx::DEBUG}
649
-
650
- # Platform id of the wxWidgets port used to build wxRuby
651
- PLATFORM = '\#{Wx::PLATFORM}'
652
-
653
- end
654
- __HEREDOC
655
- end
607
+ STDOUT.puts \<<~__HEREDOC
608
+ # ----------------------------------------------------------------------------
609
+ # This file is automatically generated by the WXRuby3 documentation
610
+ # generator. Do not alter this file.
611
+ # ----------------------------------------------------------------------------
612
+
613
+
614
+ module Wx
615
+
616
+ # wxRuby version string
617
+ WXRUBY_VERSION = '\#{Wx::WXRUBY_VERSION}'
618
+
619
+ # wxRuby version release type (alpha, beta, rc)
620
+ WXRUBY_RELEASE_TYPE = '\#{Wx::WXRUBY_RELEASE_TYPE}'
621
+ # wxRuby major version number
622
+ WXRUBY_MAJOR = \#{Wx::WXRUBY_MAJOR}
623
+ # wxRuby minor version number
624
+ WXRUBY_MINOR = \#{Wx::WXRUBY_MINOR}
625
+ # wxRuby release number
626
+ WXRUBY_RELEASE = \#{Wx::WXRUBY_RELEASE}
627
+
628
+ # Convenience string for WxWidgets version info
629
+ WXWIDGETS_VERSION = '\#{Wx::WXWIDGETS_VERSION}'
630
+
631
+ # Integer constant reflecting the major version of the wxWidgets release used to build wxRuby
632
+ WXWIDGETS_MAJOR_VERSION = \#{Wx::WXWIDGETS_MAJOR_VERSION}
633
+
634
+ # Integer constant reflecting the minor version of the wxWidgets release used to build wxRuby
635
+ WXWIDGETS_MINOR_VERSION = \#{Wx::WXWIDGETS_MINOR_VERSION}
636
+
637
+ # Integer constant reflecting the release number of the wxWidgets release used to build wxRuby
638
+ WXWIDGETS_RELEASE_NUMBER = \#{Wx::WXWIDGETS_RELEASE_NUMBER}
639
+
640
+ # Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
641
+ WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
642
+
643
+ # Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
644
+ WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
645
+
646
+ # Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
647
+ DEBUG = \#{Wx::DEBUG}
648
+
649
+ # Platform id of the wxWidgets port used to build wxRuby
650
+ PLATFORM = '\#{Wx::PLATFORM}'
651
+
652
+ end
653
+ __HEREDOC
656
654
  __SCRIPT
657
655
  begin
658
656
  tmpfile = Tempfile.new('script')
@@ -53,7 +53,7 @@ module WXRuby3
53
53
  m_actionWindow = NULL;
54
54
  m_hoverButton = NULL;
55
55
  m_art = new wxAuiDefaultDockArt;
56
- m_hintWnd = NULL;
56
+ #{Config.instance.wx_version < '3.3.0' ? 'm_hintWnd = NULL;' : ''}
57
57
  m_flags = wxAUI_MGR_DEFAULT;
58
58
  m_hasMaximized = false;
59
59
  m_dockConstraintX = 0.3;