wxruby3 0.9.5 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,125 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # wxruby setup command handler
6
+ #--------------------------------------------------------------------
7
+
8
+ require 'fileutils'
9
+
10
+ module WxRuby
11
+ module Commands
12
+ class Setup
13
+
14
+ DESC = 'Run wxRuby3 post-install setup.'
15
+
16
+ def self.description
17
+ " setup -h|[options]\t\t\t#{DESC}"
18
+ end
19
+
20
+ def self.options
21
+ Commands.options['setup'] ||= { verbose: Commands.options[:verbose] }
22
+ end
23
+
24
+ def self.parse_args(args)
25
+ opts = OptionParser.new
26
+ opts.banner = "#{DESC}\n\nUsage: wxruby setup -h|--help OR wxruby setup [options]\n\n"
27
+ opts.separator ''
28
+ opts.on('--wxwin=path',
29
+ "the installation root for the wxWidgets libraries and headers if not using the system default",
30
+ "(use '@system' to force using system default only)") do |v|
31
+ Setup.options['wxwin'] = (v.downcase == '@system') ? v : File.expand_path(v)
32
+ end
33
+ opts.on('--wxxml=path',
34
+ "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| Setup.options['wxxml'] = File.expand_path(v)}
35
+ opts.on('--with-wxwin',
36
+ "build a local copy of wxWidgets for use with wxRuby [false]") {|v| Setup.options['with-wxwin'] = true}
37
+ opts.on('--swig=path',
38
+ "the path to swig executable [swig]") {|v| Setup.options['swig'] = v}
39
+ opts.on('--doxygen=path',
40
+ "the path to doxygen executable [doxygen]") {|v| Setup.options['doxygen'] = v}
41
+ opts.on('--git=path',
42
+ "the path to git executable [git]") {|v| Setup.options['git'] = v}
43
+ opts.on('--[no-]autoinstall',
44
+ "do (not) attempt to automatically install any required packages") {|v| Setup.options['autoinstall'] = !!v }
45
+ opts.on('--log=PATH',
46
+ "write log to PATH/setup.log (PATH must exist) and do not remove when finished") {|v| Setup.options['log'] = v }
47
+ opts.on('-h', '--help',
48
+ 'Show this message.') do |v|
49
+ puts opts
50
+ puts
51
+ exit(0)
52
+ end
53
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
54
+ end
55
+
56
+ def self.run(argv)
57
+ return description if argv == :describe
58
+
59
+ parse_args(argv)
60
+
61
+ cfg_args = []
62
+ cfg_args << "--wxwin=#{Setup.options['wxwin']}" if Setup.options['wxwin']
63
+ cfg_args << "--wxxml=#{Setup.options['wxxml']}" if Setup.options['wxxml']
64
+ cfg_args << '--with-wxwin' if Setup.options['with-wxwin']
65
+ cfg_args << "--swig=#{Setup.options['swig']}" if Setup.options['swig']
66
+ cfg_args << "--doxygen=#{Setup.options['doxygen']}" if Setup.options['doxygen']
67
+ cfg_args << "--git=#{Setup.options['git']}" if Setup.options['git']
68
+ unless Setup.options['autoinstall'].nil?
69
+ cfg_args << (Setup.options['autoinstall'] ? '--autoinstall' : '--no-autoinstall')
70
+ end
71
+ cfg_cmd = 'rake configure'
72
+ cfg_cmd << "[#{cfg_args.join(',')}]" unless cfg_args.empty?
73
+
74
+ result = false
75
+ FileUtils.chdir(WxRuby::ROOT) do
76
+ steps = 0
77
+ actions_txt = if Setup.options['autoinstall'] != false
78
+ steps = 1
79
+ '(possibly) install required software'
80
+ else
81
+ ''
82
+ end
83
+ if Setup.options['with-wxwin'] || Setup.options['wxwin'].nil?
84
+ actions_txt << ', ' if steps>0
85
+ actions_txt << 'build the wxWidgets libraries (if needed), '
86
+ actions_txt << "\n" if steps>0
87
+ steps += 1
88
+ else
89
+ actions_txt << ',' if steps>0
90
+ end
91
+ actions_txt << 'build the native wxRuby3 extensions '
92
+ actions_txt << "\n" if steps==1
93
+ actions_txt << 'and generate the wxRuby3 reference documentation.'
94
+ $stdout.puts <<~__INFO_TXT
95
+
96
+ ---
97
+ Now running wxRuby3 post-install setup.
98
+ This will #{actions_txt}
99
+ Please be patient as this may take quite a while depending on your system.
100
+ ---
101
+
102
+ __INFO_TXT
103
+ log_file = File.join(WxRuby::ROOT, 'setup.log')
104
+ if Setup.options['log']
105
+ if File.directory?(Setup.options['log']) && File.writable?(Setup.options['log'])
106
+ log_file = File.join(Setup.options['log'], 'setup.log')
107
+ else
108
+ $stderr.puts "ERROR: cannot write log to #{Setup.options['log']}. Log path must exist and be writable."
109
+ exit(1)
110
+ end
111
+ end
112
+ run_env = {'WXRUBY_RUN_SILENT' => "#{log_file}"}
113
+ run_env['WXRUBY_VERBOSE'] = '1' if Setup.options[:verbose]
114
+ # can't rely on FileUtils#chdir returning the block result (bug in older Rubies) so assign result here
115
+ result = system(run_env, "#{cfg_cmd} && rake -m wxruby:gem:setup#{Setup.options['log'] ? '[:keep_log]' : ''} && gem rdoc wxruby3 --overwrite")
116
+ end
117
+ exit(result ? 0 : 1)
118
+ end
119
+ end
120
+
121
+ unless self.setup_done?
122
+ self.register('setup', Setup)
123
+ end
124
+ end
125
+ end
@@ -10,21 +10,71 @@ require 'fileutils'
10
10
  module WxRuby
11
11
  module Commands
12
12
  class Test
13
+
14
+ DESC = 'Run wxRuby3 regression tests.'
15
+
13
16
  def self.description
14
- " test\t\t\tRun wxRuby3 regression tests."
17
+ " test -h|[options] [TEST [...]]\t#{DESC}"
18
+ end
19
+
20
+ def self.options
21
+ Commands.options['test'] ||= { verbose: Commands.options[:verbose], excludes: [] }
22
+ end
23
+
24
+ def self.parse_args(args)
25
+ opts = OptionParser.new
26
+ opts.banner = "#{DESC}\n\nUsage: wxruby test -h|--help OR wxruby test [options] [TEST [...]]\n\n" +
27
+ "TEST == test name\n" +
28
+ "Runs all tests (except any specified to exclude) if no test specified.\n\n"
29
+ opts.separator ''
30
+ opts.on('--list',
31
+ "display the list of names of the installed tests") do |v|
32
+ tests = Dir[File.join(WxRuby::ROOT, 'tests', '*.rb')].collect { |t| File.basename(t, '.*') }
33
+ $stdout.puts <<~__INFO
34
+ Installed wxRuby tests:
35
+ #{tests.join(', ')}
36
+
37
+ __INFO
38
+ exit(0)
39
+ end
40
+ opts.on('--exclude=TEST',
41
+ "exclude the specified test from running") {|v| Test.options[:excludes] << v }
42
+ opts.on('-h', '--help',
43
+ 'Show this message.') do |v|
44
+ puts opts
45
+ puts
46
+ exit(0)
47
+ end
48
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
15
49
  end
16
50
 
17
51
  def self.run(argv)
18
- if argv == :describe
19
- description
20
- else
21
- Dir[File.join(WxRuby::ROOT, 'tests', '*.rb')].each do |test|
52
+ return description if argv == :describe
53
+
54
+ parse_args(argv)
55
+
56
+ tests = if argv.empty?
57
+ Dir[File.join(WxRuby::ROOT, 'tests', '*.rb')]
58
+ else
59
+ argv.collect do |a|
60
+ fn = File.join(WxRuby::ROOT, 'tests', a+'.rb')
61
+ unless File.file?(fn)
62
+ $stderr.puts "ERROR: Invalid test [#{a}] specified."
63
+ exit(1)
64
+ end
65
+ fn
66
+ end
67
+ end
68
+ tests.each do |test|
69
+ unless Test.options[:excludes].include?(File.basename(test, '.*'))
22
70
  exit(1) unless system(RUBY, test)
23
71
  end
24
72
  end
25
73
  end
26
74
  end
27
75
 
28
- self.register('test', Test)
76
+ if self.setup_done?
77
+ self.register('test', Test)
78
+ end
29
79
  end
30
80
  end
data/rakelib/bin.rake ADDED
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 rake file
7
+ ###
8
+
9
+ require 'rake/clean'
10
+
11
+ require_relative './bin'
12
+
13
+ directory 'bin'
14
+
15
+ file File.join('bin', 'wxruby') => 'bin' do |t|
16
+ File.open(t.name, 'w') { |f| f.puts WXRuby3::Bin.wxruby }
17
+ File.chmod(0755, t.name)
18
+ end
19
+
20
+ namespace :wxruby do
21
+
22
+ namespace :bin do
23
+
24
+ task :build => ['wxruby:bin:check', File.join('bin', 'wxruby')]
25
+
26
+ task :check do
27
+ WXRuby3::Bin.binaries.each do |bin|
28
+ if File.exist?(File.join('bin', bin))
29
+ content = IO.read(File.join('bin', bin))
30
+ rm_f(File.join('bin', bin)) unless content == WXRuby3::Bin.__send__(bin.gsub('.','_').to_sym)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ CLOBBER.include File.join('bin', 'wxruby')
38
+
39
+ if WXRuby3.config.windows?
40
+
41
+ file File.join('bin', 'wxruby.bat') => ['bin'] do |t|
42
+ File.open(t.name, 'w') { |f| f.puts WXRuby3::Bin.wxruby_bat }
43
+ end
44
+ Rake::Task['wxruby:bin:build'].enhance [File.join('bin', 'wxruby.bat')]
45
+
46
+ CLOBBER.include File.join('bin', 'wxruby.bat')
47
+
48
+ end
data/rakelib/bin.rb ADDED
@@ -0,0 +1,62 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 rake bin support
7
+ ###
8
+
9
+ require_relative './lib/config'
10
+
11
+ module WXRuby3
12
+
13
+ module Bin
14
+
15
+ class << self
16
+ def wxruby
17
+ <<~_SH_TXT
18
+ #!#{WXRuby3.config.windows? ? '/bin/' : (`which env`).strip+' '}#{RB_CONFIG['ruby_install_name']}
19
+ #---------------------------------
20
+ # This file is generated
21
+ #---------------------------------
22
+ module WxRuby
23
+ ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
24
+ end
25
+ require 'wx/wxruby/base'
26
+ WxRuby.run
27
+ _SH_TXT
28
+ end
29
+
30
+ def wxruby_bat
31
+ <<~_BAT_TXT
32
+ @echo off
33
+ if not "%~f0" == "~f0" goto WinNT
34
+ #{RB_CONFIG['ruby_install_name']} -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
35
+ goto endofruby
36
+ :WinNT
37
+ if not exist "%~d0%~p0#{RB_CONFIG['ruby_install_name']}" goto rubyfrompath
38
+ if exist "%~d0%~p0#{RB_CONFIG['ruby_install_name']}" "%~d0%~p0#{RB_CONFIG['ruby_install_name']}" -x "%~f0" %*
39
+ goto endofruby
40
+ :rubyfrompath
41
+ #{RB_CONFIG['ruby_install_name']} -x "%~f0" %*
42
+ goto endofruby
43
+ #!/bin/#{RB_CONFIG['ruby_install_name']}
44
+ #
45
+ module WxRuby
46
+ ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
47
+ end
48
+ require 'wx/wxruby/base'
49
+ WxRuby.run
50
+ __END__
51
+ :endofruby
52
+ _BAT_TXT
53
+ end
54
+
55
+ def binaries
56
+ %w{wxruby}
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+ end
data/rakelib/build.rb CHANGED
@@ -11,8 +11,11 @@ require_relative './lib/config'
11
11
 
12
12
  if WXRuby3.is_bootstrapped?
13
13
 
14
- Rake.application.options.always_multitask =
15
- Rake.application.top_level_tasks.size == 1 && Rake.application.top_level_tasks.first == 'build'
14
+ # only if not part of installed Gem
15
+ if File.file?(File.join(__dir__, 'package.rake'))
16
+ Rake.application.options.always_multitask =
17
+ Rake.application.top_level_tasks.size == 1 && Rake.application.top_level_tasks.first == 'build'
18
+ end
16
19
 
17
20
  require_relative './lib/director'
18
21
 
@@ -102,22 +105,23 @@ if WXRuby3.is_bootstrapped?
102
105
 
103
106
  file WXRuby3::Director.enum_cache_control_path do |t_|
104
107
  WXRuby3::Director.all_packages.each { |p| p.extract(genint: false) }
105
- touch(WXRuby3::Director.enum_cache_control_path)
108
+ touch(WXRuby3::Director.enum_cache_control_path, verbose: !WXRuby3.config.run_silent?)
106
109
  end
107
110
 
108
111
  # Compile an object file from a generated c++ source
109
112
  rule ".#{WXRuby3.config.obj_ext}" => [
110
113
  proc { |tn| "#{WXRuby3.config.src_dir}/#{File.basename(tn, ".*")}.cpp" }
111
114
  ] do | t |
112
- sh "#{WXRuby3.config.cpp} -c #{WXRuby3.config.verbose_flag} " +
113
- "#{WXRuby3.config.cxxflags} #{WXRuby3::Director.cpp_flags(t.source)} " +
114
- "#{WXRuby3.config.cpp_out_flag}#{t.name} #{t.source}"
115
+ WXRuby3.config.sh "#{WXRuby3.config.cpp} -c #{WXRuby3.config.verbose_flag} " +
116
+ "#{WXRuby3.config.cxxflags} #{WXRuby3::Director.cpp_flags(t.source)} " +
117
+ "#{WXRuby3.config.cpp_out_flag}#{t.name} #{t.source}",
118
+ fail_on_error: true
115
119
  end
116
120
 
117
121
  if WXRuby3.config.windows?
118
122
  # compile an object file from the standard wxRuby resource file
119
123
  file File.join(WXRuby3.config.obj_dir, 'wx_rc.o') => File.join(WXRuby3.config.swig_dir, 'wx.rc') do |t|
120
- sh "#{WXRuby3.config.rescomp} -i#{t.source} -o#{t.name}"
124
+ WXRuby3.config.sh "#{WXRuby3.config.rescomp} -i#{t.source} -o#{t.name}", fail_on_error: true
121
125
  end
122
126
  end
123
127
 
data/rakelib/config.rake CHANGED
@@ -33,7 +33,9 @@ namespace :wxruby do
33
33
  end
34
34
 
35
35
  WXRuby3.config.build_paths.each do |p|
36
- directory p
36
+ directory p do
37
+ mkdir_p(p, verbose: !WXRuby3.config.run_silent?)
38
+ end
37
39
  end
38
40
  end
39
41
 
data/rakelib/configure.rb CHANGED
@@ -57,19 +57,36 @@ module WXRuby3
57
57
  opts.on('--sodir=path',
58
58
  "the directory for ruby extensions [#{get_config('sodir')}]") {|v| CONFIG['sodir'] = v}
59
59
  opts.on('--wxwin=path',
60
- "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| CONFIG['wxwin'] = File.expand_path(v)}
60
+ "the installation root for the wxWidgets libraries and headers if not using the system default",
61
+ "(use '@system' to force using system default only)") { |v|
62
+ if v.downcase == '@system'
63
+ CONFIG[WXW_SYS_KEY] = true
64
+ CONFIG['wxwin'] = nil
65
+ CONFIG['with-wxwin'] = false
66
+ else
67
+ CONFIG['wxwin'] = File.expand_path(v)
68
+ CONFIG[WXW_SYS_KEY] = false
69
+ end
70
+ }
61
71
  opts.on('--wxxml=path',
62
72
  "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| CONFIG['wxxml'] = File.expand_path(v)}
63
73
  opts.on('--wxwininstdir=path',
64
- "the directory where the wxWidgets dlls are to be installed for wxRuby [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v}
74
+ "the directory where the wxWidgets dlls are installed (do not change if not absolutely needed) [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v}
65
75
  opts.on('--with-wxwin',
66
- "build a local copy of wxWidgets for use with wxRuby [false]") {|v| CONFIG['with-wxwin'] = true}
76
+ "build a local copy of wxWidgets for use with wxRuby [false]") { |v|
77
+ CONFIG['with-wxwin'] = true
78
+ CONFIG[WXW_SYS_KEY] = false
79
+ }
67
80
  opts.on('--with-debug',
68
81
  "build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true}
69
82
  opts.on('--swig=path',
70
83
  "the path to swig executable [#{get_config('swig')}]") {|v| CONFIG['swig'] = v}
71
84
  opts.on('--doxygen=path',
72
85
  "the path to doxygen executable [#{get_config('doxygen')}]") {|v| CONFIG['doxygen'] = v}
86
+ opts.on('--git=path',
87
+ "the path to git executable [#{get_config('git')}]") {|v| CONFIG['git'] = v}
88
+ opts.on('--[no-]autoinstall',
89
+ "do (not) attempt to automatically install any required packages") {|v| CONFIG['autoinstall'] = !!v }
73
90
 
74
91
  opts.separator ""
75
92
 
@@ -80,53 +97,64 @@ module WXRuby3
80
97
  def self.check
81
98
  instance.init # re-initialize
82
99
 
83
- if Dir[File.join('ext', 'wxruby_*.so')].empty? # Don't check for wxWidgets installation when executed for binary gem install
100
+ # should we try to use a system or user defined wxWidgets installation?
101
+ if !get_config('with-wxwin')
84
102
 
85
- if !get_config('with-wxwin')
86
- # check if a user defined wxWidgets location is specified or we're using a system standard install
87
- if get_cfg_string('wxwin').empty?
88
- # assume system standard install; will be checked below
89
- set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
90
- elsif get_cfg_string('wxwininstdir').empty?
91
- if instance.windows?
92
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
93
- else
94
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
95
- end
96
- end
97
- elsif !get_cfg_string('wxwin').empty?
98
- if get_cfg_string('wxwininstdir').empty?
99
- if instance.windows?
100
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
101
- else
102
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
103
- end
103
+ # check if a user defined wxWidgets location is specified or should be using a system standard install
104
+ if get_cfg_string('wxwin').empty?
105
+ # assume/force system standard install; will be checked below
106
+ set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
107
+ elsif get_cfg_string('wxwininstdir').empty? # if not explicitly specified derive from 'wxwin'
108
+ if instance.windows?
109
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
110
+ else
111
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
104
112
  end
105
- else
106
- set_config('wxwininstdir', get_cfg_string('sodir')) if get_cfg_string('wxwininstdir').empty?
107
113
  end
108
114
 
109
- if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
110
- # check wxWidgets availability through 'wx-config' command
111
- if instance.check_wx_config
112
- if instance.wx_config("--version") < '3.2.0'
115
+ # or should we use an embedded (automatically built) wxWidgets installation
116
+ else
117
+
118
+ set_config('wxwininstdir', instance.ext_dir)
119
+
120
+ end
121
+
122
+ if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
123
+ # check wxWidgets availability through 'wx-config' command
124
+ if instance.check_wx_config
125
+ if instance.wx_config("--version") < '3.2.0'
126
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
127
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
128
+ set_config('with-wxwin', true)
129
+ else
130
+ # if someone wants to customize they HAVE to do it right
113
131
  STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release."
114
132
  exit(1)
115
133
  end
134
+ end
135
+ else
136
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
137
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
138
+ set_config('with-wxwin', true)
116
139
  else
140
+ # if someone wants to customize they HAVE to do it right
117
141
  STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release."
118
142
  exit(1)
119
143
  end
120
- # else we're are assumed to build wxWidgets ourselves so cannot test anything yet
121
144
  end
145
+ # else we're assumed to build wxWidgets ourselves so cannot test anything yet
146
+ end
122
147
 
123
- if get_cfg_string('wxxml').empty?
124
- # no pre-generated XML specified so we are going to need Git and Doxygen
125
- instance.check_git
126
- instance.check_doxygen
148
+ if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
149
+ # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
150
+ xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
151
+ # if not there see if the standard setup 'wxw_root/<install dir>' was used
152
+ xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path)
153
+ if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty?
154
+ set_config('wxxml', xml_path)
127
155
  end
128
-
129
156
  end
157
+
130
158
  end
131
159
 
132
160
  end
data/rakelib/doc.rake CHANGED
@@ -16,7 +16,9 @@ namespace :wxruby do
16
16
 
17
17
  end
18
18
 
19
- directory WXRuby3.config.rb_docgen_path
19
+ directory WXRuby3.config.rb_docgen_path do
20
+ mkdir_p(WXRuby3.config.rb_docgen_path, verbose: !WXRuby3.config.run_silent?)
21
+ end
20
22
 
21
23
  file File.join(WXRuby3.config.rb_docgen_path, 'window.rb') => [WXRuby3.config.rb_docgen_path, *all_doc_targets]
22
24