wxruby3 0.9.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +183 -42
  3. data/README.md +40 -48
  4. data/ext/mkrf_conf_ext.rb +72 -0
  5. data/lib/wx/core/app.rb +16 -0
  6. data/lib/wx/core/colour.rb +36 -28
  7. data/lib/wx/core/const.rb +19 -0
  8. data/lib/wx/core/enum.rb +17 -1
  9. data/lib/wx/core/geometry.rb +121 -0
  10. data/lib/wx/core/graphics_pen_info.rb +18 -0
  11. data/lib/wx/core/image.rb +49 -0
  12. data/lib/wx/core/menu_bar.rb +11 -0
  13. data/lib/wx/core/paintdc.rb +9 -3
  14. data/lib/wx/core/secret_store.rb +38 -0
  15. data/lib/wx/doc/app.rb +97 -41
  16. data/lib/wx/doc/bitmap.rb +4 -0
  17. data/lib/wx/doc/client_dc.rb +2 -2
  18. data/lib/wx/doc/clipboard.rb +1 -1
  19. data/lib/wx/doc/colour.rb +12 -0
  20. data/lib/wx/doc/const.rb +16 -0
  21. data/lib/wx/doc/cursor.rb +4 -0
  22. data/lib/wx/doc/dc_overlay.rb +34 -0
  23. data/lib/wx/doc/enum.rb +7 -1
  24. data/lib/wx/doc/event_blocker.rb +1 -1
  25. data/lib/wx/doc/evthandler.rb +25 -3
  26. data/lib/wx/doc/functions.rb +3 -6
  27. data/lib/wx/doc/gc_dc.rb +13 -4
  28. data/lib/wx/doc/geometry.rb +136 -0
  29. data/lib/wx/doc/graphics_context.rb +25 -7
  30. data/lib/wx/doc/icon.rb +4 -0
  31. data/lib/wx/doc/image.rb +56 -0
  32. data/lib/wx/doc/list_ctrl.rb +6 -6
  33. data/lib/wx/doc/memory_dc.rb +2 -11
  34. data/lib/wx/doc/mirror_dc.rb +1 -1
  35. data/lib/wx/doc/pen.rb +26 -0
  36. data/lib/wx/doc/persistence_manager.rb +1 -1
  37. data/lib/wx/doc/persistent_object.rb +1 -1
  38. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  39. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  40. data/lib/wx/doc/region_iterator.rb +1 -1
  41. data/lib/wx/doc/scaled_dc.rb +1 -1
  42. data/lib/wx/doc/screen_dc.rb +1 -1
  43. data/lib/wx/doc/secret_store.rb +55 -0
  44. data/lib/wx/doc/svg_file_dc.rb +1 -1
  45. data/lib/wx/doc/textctrl.rb +1 -1
  46. data/lib/wx/doc/tree_ctrl.rb +2 -2
  47. data/lib/wx/doc/validator.rb +6 -6
  48. data/lib/wx/doc/variant.rb +2 -2
  49. data/lib/wx/doc/window.rb +5 -4
  50. data/lib/wx/grid/keyword_defs.rb +1 -1
  51. data/lib/wx/html/keyword_defs.rb +3 -3
  52. data/lib/wx/keyword_defs.rb +76 -71
  53. data/lib/wx/pg/keyword_defs.rb +2 -2
  54. data/lib/wx/pg/pg_property.rb +12 -0
  55. data/lib/wx/rbn/keyword_defs.rb +1 -1
  56. data/lib/wx/rtc/keyword_defs.rb +1 -1
  57. data/lib/wx/stc/keyword_defs.rb +1 -1
  58. data/lib/wx/version.rb +1 -1
  59. data/lib/wx/wxruby/base.rb +3 -5
  60. data/lib/wx/wxruby/cmd/check.rb +182 -0
  61. data/lib/wx/wxruby/cmd/sampler.rb +1 -1
  62. data/lib/wx/wxruby/cmd/setup.rb +9 -3
  63. data/lib/wx/wxruby/cmd/test.rb +1 -1
  64. data/rakelib/configure.rb +67 -52
  65. data/rakelib/gem.rake +97 -66
  66. data/rakelib/gem.rb +294 -41
  67. data/rakelib/install.rb +3 -3
  68. data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
  69. data/rakelib/lib/config/linux.rb +4 -2
  70. data/rakelib/lib/config/macosx.rb +42 -11
  71. data/rakelib/lib/config/mingw.rb +2 -2
  72. data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
  73. data/rakelib/lib/config/pkgman/macosx.rb +17 -78
  74. data/rakelib/lib/config/unixish.rb +17 -8
  75. data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
  76. data/rakelib/lib/config.rb +74 -33
  77. data/rakelib/lib/core/include/enum.inc +31 -1
  78. data/rakelib/lib/director/affine_matrix.rb +51 -0
  79. data/rakelib/lib/director/app.rb +29 -13
  80. data/rakelib/lib/director/art_provider.rb +4 -0
  81. data/rakelib/lib/director/aui_manager.rb +1 -1
  82. data/rakelib/lib/director/cursor.rb +6 -2
  83. data/rakelib/lib/director/dc.rb +1 -6
  84. data/rakelib/lib/director/derived_dc.rb +88 -31
  85. data/rakelib/lib/director/geometry.rb +142 -0
  86. data/rakelib/lib/director/graphics_context.rb +3 -2
  87. data/rakelib/lib/director/graphics_object.rb +18 -25
  88. data/rakelib/lib/director/grid_ctrl.rb +2 -2
  89. data/rakelib/lib/director/image.rb +59 -0
  90. data/rakelib/lib/director/menu.rb +2 -3
  91. data/rakelib/lib/director/menu_bar.rb +0 -3
  92. data/rakelib/lib/director/pen.rb +1 -1
  93. data/rakelib/lib/director/richtext_composite_object.rb +2 -4
  94. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  95. data/rakelib/lib/director/secret_store.rb +117 -0
  96. data/rakelib/lib/director/system_settings.rb +1 -1
  97. data/rakelib/lib/director/tree_event.rb +2 -2
  98. data/rakelib/lib/director/window.rb +4 -3
  99. data/rakelib/lib/extractor/function.rb +1 -1
  100. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  101. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  102. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  103. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  104. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  105. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  106. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  107. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  108. data/rakelib/lib/generate/doc/log.yaml +1 -1
  109. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  110. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  111. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  112. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  113. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  114. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  115. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  116. data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
  117. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  118. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  119. data/rakelib/lib/generate/doc.rb +5 -5
  120. data/rakelib/lib/generate/interface.rb +1 -1
  121. data/rakelib/lib/specs/interfaces.rb +4 -0
  122. data/rakelib/lib/swig_runner.rb +24 -3
  123. data/rakelib/lib/typemap/common.rb +10 -0
  124. data/rakelib/lib/typemap/points_list.rb +8 -2
  125. data/rakelib/lib/typemap/richtext.rb +17 -0
  126. data/rakelib/prepost.rake +8 -1
  127. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
  128. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  129. data/samples/dialogs/wizard.rb +20 -19
  130. data/samples/drawing/art/drawing/image.bmp +0 -0
  131. data/samples/drawing/art/drawing/mask.bmp +0 -0
  132. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  133. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  134. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  135. data/samples/drawing/art/drawing/smile.xpm +42 -0
  136. data/samples/drawing/drawing.rb +2276 -0
  137. data/samples/drawing/tn_drawing.png +0 -0
  138. data/samples/html/html.rb +1 -1
  139. data/samples/propgrid/propgrid.rb +1 -1
  140. data/samples/propgrid/propgrid_minimal.rb +1 -1
  141. data/samples/propgrid/sample_props.rb +1 -1
  142. data/samples/sampler/editor.rb +13 -11
  143. data/samples/sampler/sample.rb +2 -0
  144. data/samples/sampler.rb +14 -10
  145. data/samples/text/richtext.rb +53 -0
  146. data/samples/text/scintilla.rb +1 -1
  147. data/samples/text/unicode.rb +4 -4
  148. data/tests/lib/wxapp_runner.rb +1 -1
  149. data/tests/test_config.rb +7 -4
  150. data/tests/test_ext_controls.rb +12 -5
  151. data/tests/test_secret_store.rb +83 -0
  152. data/tests/test_std_controls.rb +12 -12
  153. metadata +66 -47
  154. data/lib/wx/doc/extra/00_starting.md +0 -154
  155. data/lib/wx/doc/extra/01_packages.md +0 -180
  156. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  157. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  158. data/lib/wx/doc/extra/04_enums.md +0 -143
  159. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  160. data/lib/wx/doc/extra/06_geometry.md +0 -62
  161. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  162. data/lib/wx/doc/extra/08_extensions.md +0 -144
  163. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  164. data/lib/wx/doc/extra/10_art.md +0 -111
  165. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  166. data/lib/wx/doc/extra/12_client_data.md +0 -89
  167. data/lib/wx/doc/extra/13_validators.md +0 -139
  168. data/lib/wx/doc/extra/14_config.md +0 -101
  169. data/lib/wx/doc/extra/15_persistence.md +0 -148
  170. data/rakefile +0 -14
  171. data/rakelib/lib/config/pkgman/arch.rb +0 -53
  172. data/rakelib/lib/config/pkgman/debian.rb +0 -66
  173. data/rakelib/lib/config/pkgman/rhel.rb +0 -54
  174. data/rakelib/lib/config/pkgman/suse.rb +0 -54
  175. data/samples/sampler/back.xpm +0 -21
  176. data/samples/sampler/copy.xpm +0 -44
  177. data/samples/sampler/cut.xpm +0 -46
  178. data/samples/sampler/filesave.xpm +0 -42
  179. data/samples/sampler/find.xpm +0 -62
  180. data/samples/sampler/findrepl.xpm +0 -63
  181. data/samples/sampler/forward.xpm +0 -21
  182. data/samples/sampler/paste.xpm +0 -46
  183. data/samples/sampler/redo.xpm +0 -58
  184. data/samples/sampler/undo.xpm +0 -58
@@ -0,0 +1,182 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # wxruby check command handler
6
+ #--------------------------------------------------------------------
7
+
8
+ require 'fileutils'
9
+ require 'plat4m'
10
+
11
+ module WxRuby
12
+ module Commands
13
+
14
+ class Check
15
+
16
+ LOAD_ERRORS = {
17
+ linux: /cannot\s+open\s+shared\s+object/i,
18
+ darwin: /library\s+not\s+loaded/i,
19
+ windows: /specified\s+module\s+could\s+not\s+be\s+found/i
20
+ }
21
+
22
+ DESC = 'Run wxRuby3 runtime readiness check.'
23
+
24
+ def self.description
25
+ " check -h|[options]\t\t\t#{DESC}"
26
+ end
27
+
28
+ def self.options
29
+ Commands.options['check'] ||= { verbose: Commands.options[:verbose] }
30
+ end
31
+
32
+ def self.parse_args(args)
33
+ opts = OptionParser.new
34
+ opts.banner = "#{DESC}\n\nUsage: wxruby check -h|--help OR wxruby check [options]\n\n" +
35
+ "Returns:\n"+
36
+ " 0 if wxRuby3 is ready to run\n"+
37
+ " 1 if wxRuby3 does not seem to be built yet\n"+
38
+ " 2 if wxRuby3 has problems loading extension libraries\n"+
39
+ " 3 if an unexpected Ruby error occurred\n\n"+
40
+ "Unless '-q|--quiet' has been specified a description of the possible problem cause will\n"+
41
+ "be shown on failure.\n\n"
42
+ opts.separator ''
43
+ opts.on('-q', '--quiet',
44
+ "Do not show problem analysis messages on failures.") do |v|
45
+ Check.options[:quiet] = true
46
+ Check.options[:verbose] = false
47
+ end
48
+ opts.on('-v', '--verbose',
49
+ 'Show verbose output') do |v|
50
+ Check.options[:verbose] = true
51
+ Check.options[:quiet] = false
52
+ end
53
+ opts.on('-h', '--help',
54
+ 'Show this message.') do |v|
55
+ puts opts
56
+ puts
57
+ exit(0)
58
+ end
59
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
60
+ end
61
+
62
+ def self.show_error(msg)
63
+ $stderr.puts(msg) unless options[:quiet]
64
+ end
65
+
66
+ def self.show_log(msg)
67
+ $stdout.puts(msg) if options[:verbose]
68
+ end
69
+
70
+ def self.run(argv)
71
+ return description if argv == :describe
72
+
73
+ parse_args(argv)
74
+
75
+ show_log('Checking build (or binary package installation) completion...')
76
+ # check if the binary setup (packages or built) has been completed successfully
77
+ unless Commands.setup_done?
78
+ $stderr.puts <<~__INFO_TXT
79
+
80
+ wxRuby3 requires the post-install setup cmd to be run to build and finish installing
81
+ the required runtime binaries. Execute the command like:
82
+
83
+ $ wxruby setup
84
+
85
+ To see the available options for the command execute:
86
+
87
+ $ wxruby setup -h
88
+
89
+ __INFO_TXT
90
+ exit(1)
91
+ end
92
+
93
+ # check runtime
94
+ show_log('Attempting to load wxRuby3 libraries...')
95
+ sysinfo = Plat4m.current
96
+ begin
97
+ require 'wx'
98
+ rescue LoadError => ex
99
+ if ex.message =~ LOAD_ERRORS[sysinfo.os.id]
100
+ # error loading shared libraries
101
+ show_log("Captured LoadError: #{ex.message}")
102
+ # check if wxWidgets libs can be located
103
+ show_log('Checking wxWidgets availability...')
104
+ wx_found = if Dir[File.join(WxRuby::ROOT, 'ext', "*.#{RbConfig::CONFIG['SOEXT']}")].empty?
105
+ # no embedded wxWidgets -> if system installed than 'wx-config' should be in the path
106
+ if system("wx-config --version>#{sysinfo.dev_null} 2>&1")
107
+ true # system installed
108
+ else
109
+ # no system installed wxWidgets
110
+ # check the system dependent load paths if any wxWidgets libs can be found
111
+ case sysinfo.os.id
112
+ when :linux
113
+ (ENV['LD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.so')].empty? }
114
+ when :darwin
115
+ (ENV['DYLD_LIBRARY_PATH']||'').split(':').any? { |p| !Dir[File.join(p, 'libwx_base*.dylib')].empty? }
116
+ when :windows
117
+ (ENV['PATH']||'').split(';').any? { |p| !Dir[File.join(p, 'wxbase*.dll')].empty? }
118
+ else
119
+ true # do not know how to search so assume wxWidgets found
120
+ end
121
+ end
122
+ else
123
+ true # embedded wxWidgets
124
+ end
125
+ if wx_found
126
+ show_log('wxWidgets found')
127
+ show_error <<~__INFO_TXT
128
+
129
+ The runtime environment of this system seems to be missing some required libraries for
130
+ executing wxRuby3 apps.
131
+ Please be aware wxRuby3 requires a properly configured GUI based system to function.
132
+ See the documentation for more information on the required runtime environment.
133
+
134
+ __INFO_TXT
135
+ else
136
+ show_log('NO wxWidgets found')
137
+ show_error <<~__INFO_TXT
138
+
139
+ It seems wxRuby3 is not able to load any of the required wxWidgets libraries it was built
140
+ for.
141
+ Please make sure these (shared) libraries are available in the appropriate search path
142
+ for this system.
143
+
144
+ __INFO_TXT
145
+ end
146
+ else
147
+ show_error <<~__INFO_TXT
148
+
149
+ There is an unexpected problem loading the wxRuby3 extension libraries.
150
+ Please check the problem report below for a probable cause analysis. If you have reason
151
+ to suspect a bug to be the cause of this problem please file an issue at Github and attach
152
+ the problem report.
153
+
154
+ #{ex.message}
155
+ #{ex.backtrace.join("\n")}
156
+
157
+ __INFO_TXT
158
+ end
159
+ exit(2)
160
+ rescue Exception => ex
161
+ show_log("Captured Exception: #{ex.message}")
162
+ show_error <<~__INFO_TXT
163
+
164
+ There is an unexpected problem loading the wxRuby3 libraries.
165
+ Please check the problem report below for a probable cause analysis. If you have reason
166
+ to suspect a bug to be the cause of this problem please file an issue at Github and attach
167
+ the problem report.
168
+
169
+ #{ex.message}
170
+ #{ex.backtrace.join("\n")}
171
+
172
+ __INFO_TXT
173
+ exit(3)
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ self.register('check', Check)
180
+
181
+ end
182
+ end
@@ -34,7 +34,7 @@ module WxRuby
34
34
  puts
35
35
  exit(0)
36
36
  end
37
- opts.parse!(args)
37
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
38
38
  end
39
39
 
40
40
  def self.run(argv)
@@ -14,7 +14,7 @@ module WxRuby
14
14
  DESC = 'Run wxRuby3 post-install setup.'
15
15
 
16
16
  def self.description
17
- " setup -h|[options]\t\t#{DESC}"
17
+ " setup -h|[options]\t\t\t#{DESC}"
18
18
  end
19
19
 
20
20
  def self.options
@@ -26,11 +26,16 @@ module WxRuby
26
26
  opts.banner = "#{DESC}\n\nUsage: wxruby setup -h|--help OR wxruby setup [options]\n\n"
27
27
  opts.separator ''
28
28
  opts.on('--wxwin=path',
29
- "the installation root for the wxWidgets libraries and headers if not using the system default") {|v| Setup.options['wxwin'] = File.expand_path(v)}
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
30
33
  opts.on('--wxxml=path',
31
34
  "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| Setup.options['wxxml'] = File.expand_path(v)}
32
35
  opts.on('--with-wxwin',
33
36
  "build a local copy of wxWidgets for use with wxRuby [false]") {|v| Setup.options['with-wxwin'] = true}
37
+ opts.on('--with-wxhead',
38
+ "build with the head (master) version of wxWidgets [false]", "(implies '--with-wxwin')") {|v| Setup.options['with-wxhead'] = true}
34
39
  opts.on('--swig=path',
35
40
  "the path to swig executable [swig]") {|v| Setup.options['swig'] = v}
36
41
  opts.on('--doxygen=path',
@@ -47,7 +52,7 @@ module WxRuby
47
52
  puts
48
53
  exit(0)
49
54
  end
50
- opts.parse!(args)
55
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
51
56
  end
52
57
 
53
58
  def self.run(argv)
@@ -59,6 +64,7 @@ module WxRuby
59
64
  cfg_args << "--wxwin=#{Setup.options['wxwin']}" if Setup.options['wxwin']
60
65
  cfg_args << "--wxxml=#{Setup.options['wxxml']}" if Setup.options['wxxml']
61
66
  cfg_args << '--with-wxwin' if Setup.options['with-wxwin']
67
+ cfg_args << '--with-wxhead' if Setup.options['with-wxhead']
62
68
  cfg_args << "--swig=#{Setup.options['swig']}" if Setup.options['swig']
63
69
  cfg_args << "--doxygen=#{Setup.options['doxygen']}" if Setup.options['doxygen']
64
70
  cfg_args << "--git=#{Setup.options['git']}" if Setup.options['git']
@@ -45,7 +45,7 @@ module WxRuby
45
45
  puts
46
46
  exit(0)
47
47
  end
48
- opts.parse!(args)
48
+ opts.parse!(args) rescue ($stderr.puts $!.message; exit(127))
49
49
  end
50
50
 
51
51
  def self.run(argv)
data/rakelib/configure.rb CHANGED
@@ -57,13 +57,33 @@ 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
+ CONFIG['with-wxhead'] = false
67
+ else
68
+ CONFIG['wxwin'] = File.expand_path(v)
69
+ CONFIG[WXW_SYS_KEY] = false
70
+ end
71
+ }
61
72
  opts.on('--wxxml=path',
62
73
  "the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| CONFIG['wxxml'] = File.expand_path(v)}
63
74
  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}
75
+ "the directory where the wxWidgets dlls are installed (do not change if not absolutely needed) [#{instance.get_config('wxwininstdir')}]") {|v| CONFIG['wxwininstdir'] = v}
65
76
  opts.on('--with-wxwin',
66
- "build a local copy of wxWidgets for use with wxRuby [false]") {|v| CONFIG['with-wxwin'] = true}
77
+ "build a local copy of wxWidgets for use with wxRuby [false]") { |v|
78
+ CONFIG['with-wxwin'] = true
79
+ CONFIG[WXW_SYS_KEY] = false
80
+ }
81
+ opts.on('--with-wxhead',
82
+ "build with the head (master) version of wxWidgets; implies '--with-wxwin'") { |v|
83
+ CONFIG['with-wxhead'] = true
84
+ CONFIG['with-wxwin'] = true
85
+ CONFIG[WXW_SYS_KEY] = false
86
+ }
67
87
  opts.on('--with-debug',
68
88
  "build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true}
69
89
  opts.on('--swig=path',
@@ -84,69 +104,64 @@ module WXRuby3
84
104
  def self.check
85
105
  instance.init # re-initialize
86
106
 
87
- if Dir[File.join('ext', 'wxruby_*.so')].empty? # Don't check for wxWidgets installation when executed for binary gem install
107
+ # should we try to use a system or user defined wxWidgets installation?
108
+ if !get_config('with-wxwin')
88
109
 
89
- if !get_config('with-wxwin')
90
- # check if a user defined wxWidgets location is specified or we're using a system standard install
91
- if get_cfg_string('wxwin').empty?
92
- # assume system standard install; will be checked below
93
- set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
94
- elsif get_cfg_string('wxwininstdir').empty?
95
- if instance.windows?
96
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
97
- else
98
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
99
- end
100
- end
101
- elsif !get_cfg_string('wxwin').empty?
102
- if get_cfg_string('wxwininstdir').empty?
103
- if instance.windows?
104
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
105
- else
106
- set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
107
- end
110
+ # check if a user defined wxWidgets location is specified or should be using a system standard install
111
+ if get_cfg_string('wxwin').empty?
112
+ # assume/force system standard install; will be checked below
113
+ set_config('wxwininstdir', get_cfg_string('libdir')) if get_cfg_string('wxwininstdir').empty?
114
+ elsif get_cfg_string('wxwininstdir').empty? # if not explicitly specified derive from 'wxwin'
115
+ if instance.windows?
116
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'bin'))
117
+ else
118
+ set_config('wxwininstdir', File.join(get_cfg_string('wxwin'), 'lib'))
108
119
  end
109
- else
110
- set_config('wxwininstdir', get_cfg_string('sodir')) if get_cfg_string('wxwininstdir').empty?
111
120
  end
112
121
 
113
- if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
114
- # check wxWidgets availability through 'wx-config' command
115
- if instance.check_wx_config
116
- if instance.wx_config("--version") < '3.2.0'
117
- if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty?
118
- # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
119
- set_config('with-wxwin', true)
120
- else
121
- # if someone wants to customize they HAVE to do it right
122
- STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release."
123
- exit(1)
124
- end
125
- end
126
- else
127
- if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty?
128
- # no custom wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
122
+ # or should we use an embedded (automatically built) wxWidgets installation
123
+ else
124
+
125
+ set_config('wxwininstdir', instance.ext_dir)
126
+
127
+ end
128
+
129
+ if !get_cfg_string('wxwin').empty? || !get_config('with-wxwin')
130
+ # check wxWidgets availability through 'wx-config' command
131
+ if instance.check_wx_config
132
+ if instance.wx_config("--version") < '3.2.0'
133
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
134
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
129
135
  set_config('with-wxwin', true)
130
136
  else
131
137
  # if someone wants to customize they HAVE to do it right
132
- STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release."
138
+ STDERR.puts "ERROR: Incompatible wxWidgets version. wxRuby requires a wxWidgets >= 3.2.0 release."
133
139
  exit(1)
134
140
  end
135
141
  end
136
- # else we're are assumed to build wxWidgets ourselves so cannot test anything yet
137
- end
138
-
139
- if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
140
- # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
141
- xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
142
- # if not there see if the standard setup 'wxw_root/<install dir>' was used
143
- xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path)
144
- if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty?
145
- set_config('wxxml', xml_path)
142
+ else
143
+ if get_cfg_string('wxwin').empty? && get_cfg_string('wxxml').empty? && !get_config(WXW_SYS_KEY)
144
+ # no custom (or forced system) wxWidgets build specified so switch to assuming we should include building wxWidgets ourselves
145
+ set_config('with-wxwin', true)
146
+ else
147
+ # if someone wants to customize they HAVE to do it right
148
+ STDERR.puts "ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release."
149
+ exit(1)
146
150
  end
147
151
  end
152
+ # else we're assumed to build wxWidgets ourselves so cannot test anything yet
153
+ end
148
154
 
155
+ if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
156
+ # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
157
+ xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
158
+ # if not there see if the standard setup 'wxw_root/<install dir>' was used
159
+ xml_path = File.join(get_cfg_string('wxwin'), '..', 'docs', 'doxygen', 'out', 'xml') unless File.directory?(xml_path)
160
+ if File.directory?(xml_path) && !Dir.glob(File.join(xml_path, '*.xml')).empty?
161
+ set_config('wxxml', xml_path)
162
+ end
149
163
  end
164
+
150
165
  end
151
166
 
152
167
  end
data/rakelib/gem.rake CHANGED
@@ -12,14 +12,10 @@ namespace :wxruby do
12
12
 
13
13
  namespace :gem do
14
14
 
15
- task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)]
15
+ task :srcgem => ['bin:build', WXRuby3::Gem.gem_file]
16
16
 
17
- if WXRuby3.is_bootstrapped?
18
- task :bingem => ['bin:build', File.join(WXRuby3.config.rb_docgen_path, 'window.rb'), WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin)]
19
- end
20
-
21
- # this task only exists for installed source gems (where package tasks have been removed)
22
- unless File.file?(File.join(__dir__, 'package.rake'))
17
+ # this task only exists for installed (source) gems (where run tasks have been removed)
18
+ unless File.file?(File.join(__dir__, 'run.rake'))
23
19
 
24
20
  task :setup => 'config:bootstrap' do |_t, args|
25
21
  begin
@@ -51,7 +47,7 @@ namespace :wxruby do
51
47
 
52
48
  $ ./wxruby test
53
49
 
54
- The wxRuby3 sample selector can be run by executing:
50
+ The wxRuby3 sample explorer can be run by executing:
55
51
 
56
52
  $ ./wxruby sampler
57
53
 
@@ -65,13 +61,14 @@ namespace :wxruby do
65
61
  end
66
62
 
67
63
  # source gem file
68
- file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.manifest do
69
- gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION) do |gem|
64
+ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do
65
+ gemspec = WXRuby3::Gem.define_spec do |gem|
70
66
  gem.summary = %Q{wxWidgets extension for Ruby}
71
67
  gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework}
72
68
  gem.email = 'mcorino@m2c-software.nl'
73
69
  gem.homepage = "https://github.com/mcorino/wxRuby3"
74
70
  gem.authors = ['Martin Corino']
71
+ gem.extensions = ['ext/mkrf_conf_ext.rb']
75
72
  gem.files = WXRuby3::Gem.manifest
76
73
  gem.require_paths = %w{lib}
77
74
  gem.bindir = 'bin'
@@ -82,6 +79,7 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m
82
79
  gem.add_dependency 'rake'
83
80
  gem.add_dependency 'minitest', '~> 5.15'
84
81
  gem.add_dependency 'test-unit', '~> 3.5'
82
+ gem.add_dependency 'plat4m', '~> 1.0'
85
83
  gem.rdoc_options <<
86
84
  '--exclude=\\.dll' <<
87
85
  '--exclude=\\.so' <<
@@ -90,17 +88,40 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m
90
88
  "'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'"
91
89
  gem.metadata = {
92
90
  "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
91
+ "homepage_uri" => "https://github.com/mcorino/wxRuby3/wiki",
93
92
  "source_code_uri" => "https://github.com/mcorino/wxRuby3",
94
93
  "documentation_uri" => "https://mcorino.github.io/wxRuby3",
95
- "homepage_uri" => "https://github.com/mcorino/wxRuby3",
94
+ "github_repo" => "https://github.com/mcorino/wxRuby3"
96
95
  }
97
96
  gem.post_install_message = <<~__MSG
98
97
 
99
- The wxRuby3 Gem has been successfully installed.
100
- Before being able to use wxRuby3 you need to run the post-install setup process
101
- by executing the command 'wxruby setup'.
98
+ The wxRuby3 Gem has been successfully installed including the 'wxruby' utility.
99
+
100
+ In case no suitable binary release package was available for your platform you
101
+ will need to run the post-install setup process by executing:
102
+
103
+ $ wxruby setup
104
+
105
+ To check whether wxRuby3 is ready to run or not you can at any time execute the
106
+ following command:
107
+
108
+ $ wxruby check
109
+
110
+ Run 'wxruby check -h' for more information.
111
+
112
+ When the wxRuby3 setup has been fully completed you can start using wxRuby3.
113
+
114
+ You can run the regression tests to verify the installation by executing:
115
+
116
+ $ wxruby test
117
+
118
+ The wxRuby3 sample explorer can be run by executing:
102
119
 
103
- Run 'wxruby setup -h' to see information on the available commandline options.
120
+ $ wxruby sampler
121
+
122
+ Have fun using wxRuby3.
123
+
124
+ Run 'wxruby -h' to see information on the available commands.
104
125
 
105
126
  __MSG
106
127
  end
@@ -110,60 +131,70 @@ end
110
131
  desc 'Build wxRuby 3 gem'
111
132
  task :gem => 'wxruby:gem:srcgem'
112
133
 
113
- if WXRuby3.is_bootstrapped?
114
-
115
- # binary gem file
116
- file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) => WXRuby3::Gem.manifest(:bin) + ['ext/mkrf_conf_bingem.rb'] do
117
- WXRuby3::Install.install_wxwin_shlibs
118
- begin
119
- # create gemspec
120
- gemspec = WXRuby3::Gem.define_spec('wxruby3', WXRuby3::WXRUBY_VERSION, :bin) do |gem|
121
- gem.summary = %Q{wxWidgets extension for Ruby}
122
- gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework}
123
- gem.email = 'mcorino@m2c-software.nl'
124
- gem.homepage = "https://github.com/mcorino/wxRuby3"
125
- gem.authors = ['Martin Corino']
126
- gem.files = WXRuby3::Gem.manifest(:bin)
127
- gem.require_paths = %w{lib}
128
- gem.require_paths << 'ext' if WXRuby3.config.get_config('with-wxwin')
129
- gem.bindir = 'bin'
130
- gem.executables = WXRuby3::Bin.binaries
131
- gem.extensions = ['ext/mkrf_conf_bingem.rb']
132
- gem.required_ruby_version = ">= #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor}",
133
- "< #{WXRuby3::Config.rb_ver_major}.#{WXRuby3::Config.rb_ver_minor+1}"
134
- gem.licenses = ['MIT']
135
- gem.add_dependency 'rake'
136
- gem.add_dependency 'minitest', '~> 5.15'
137
- gem.add_dependency 'test-unit', '~> 3.5'
138
- gem.rdoc_options << '--exclude=\\.dll' << '--exclude=\\.so'
139
- gem.metadata = {
140
- "bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
141
- "source_code_uri" => "https://github.com/mcorino/wxRuby3",
142
- "documentation_uri" => "https://mcorino.github.io/wxRuby3",
143
- "homepage_uri" => "https://github.com/mcorino/wxRuby3",
144
- }
145
- gem.post_install_message = <<~__MSG
146
-
147
- wxRuby3 has been successfully installed including the 'wxruby' utility.
148
-
149
- You can run the regression tests to verify the installation by executing:
150
-
151
- $ ./wxruby test
152
-
153
- The wxRuby3 sample selector can be run by executing:
154
-
155
- $ ./wxruby sampler
156
-
157
- Have fun using wxRuby3.
158
- __MSG
134
+ # these tasks do not exist for installed (source) gems (where run tasks have been removed)
135
+ if File.file?(File.join(__dir__, 'run.rake'))
136
+
137
+ if WXRuby3.is_bootstrapped?
138
+
139
+ namespace :wxruby do
140
+
141
+ namespace :gem do
142
+ task :binpkg => ['wxruby:build', 'wxruby:doc', 'bin:build', WXRuby3::Gem.bin_pkg_file]
159
143
  end
160
- WXRuby3::Gem.build_gem(gemspec)
161
- ensure
162
- WXRuby3::Install.remove_wxwin_shlibs
144
+
163
145
  end
146
+
147
+ # binary package file
148
+ file WXRuby3::Gem.bin_pkg_file => WXRuby3::Gem.bin_pkg_manifest do |t|
149
+ WXRuby3::Install.install_wxwin_shlibs
150
+ begin
151
+ # create bin package
152
+ WXRuby3::Gem.build_bin_pkg
153
+ ensure
154
+ # cleanup
155
+ WXRuby3::Install.remove_wxwin_shlibs
156
+ end
157
+ end
158
+
159
+ desc 'Build wxRuby 3 binary release package'
160
+ task :binpkg => 'wxruby:gem:binpkg'
161
+
164
162
  end
165
163
 
166
- desc 'Build wxRuby 3 binary gem'
167
- task :bingem => 'wxruby:gem:bingem'
164
+ else # in case of installed source gem the following tasks exist
165
+
166
+ namespace :wxruby do
167
+
168
+ namespace :gem do
169
+ kwargs = {}
170
+ no_prebuilt = false
171
+ task :install do |_, args|
172
+ argv = args.extras
173
+ until argv.empty?
174
+ switch = argv.shift
175
+ case switch
176
+ when '--prebuilt'
177
+ kwargs[:prebuilt_only] = true
178
+ when '--no-prebuilt'
179
+ no_prebuilt = true unless kwargs[:package]
180
+ when '--package'
181
+ fail "Missing value for '--package' argument for wxruby:gem:install." if argv.empty?
182
+ kwargs[:package] = argv.shift
183
+ no_prebuilt = false
184
+ else
185
+ fail "Invalid argument #{switch} for wxruby:gem:install."
186
+ end
187
+ end
188
+ unless no_prebuilt # do not even try to find&install a binary package
189
+ if WXRuby3::Gem.install_gem(**kwargs)
190
+ # binaries have been installed -> finish install
191
+ Rake::Task['wxruby:post:binpkg'].invoke
192
+ end
193
+ end
194
+ end
195
+
196
+ end
197
+
198
+ end
168
199
 
169
200
  end