wxruby3 0.9.4 → 0.9.7
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.
- checksums.yaml +4 -4
- data/INSTALL.md +315 -78
- data/README.md +32 -21
- data/ext/wxruby3/include/wxruby-ComboPopup.h +777 -0
- data/lib/wx/core/combo_ctrl.rb +171 -0
- data/lib/wx/core/ext.rb +22 -3
- data/lib/wx/doc/comboctrl.rb +128 -3
- data/lib/wx/doc/owner_drawn_combobox.rb +5 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +6 -4
- data/lib/wx/wxruby/cmd/sampler.rb +39 -29
- data/lib/wx/wxruby/cmd/setup.rb +122 -0
- data/lib/wx/wxruby/cmd/test.rb +56 -6
- data/rakefile +14 -0
- data/rakelib/bin.rake +48 -0
- data/rakelib/bin.rb +62 -0
- data/rakelib/build.rb +11 -7
- data/rakelib/config.rake +3 -1
- data/rakelib/configure.rb +28 -8
- data/rakelib/doc.rake +3 -1
- data/rakelib/gem.rake +169 -0
- data/rakelib/gem.rb +82 -0
- data/rakelib/install.rb +2 -0
- data/rakelib/lib/config/linux.rb +24 -2
- data/rakelib/lib/config/macosx.rb +16 -0
- data/rakelib/lib/config/mingw.rb +133 -9
- data/rakelib/lib/config/pkgman/arch.rb +53 -0
- data/rakelib/lib/config/pkgman/base.rb +169 -0
- data/rakelib/lib/config/pkgman/debian.rb +66 -0
- data/rakelib/lib/config/pkgman/macosx.rb +183 -0
- data/rakelib/lib/config/pkgman/rhel.rb +54 -0
- data/rakelib/lib/config/pkgman/suse.rb +54 -0
- data/rakelib/lib/config/unixish.rb +36 -19
- data/rakelib/lib/config.rb +254 -61
- data/rakelib/lib/core/include/funcall.inc +2 -1
- data/rakelib/lib/core/package.rb +47 -49
- data/rakelib/lib/director/comboctrl.rb +104 -3
- data/rakelib/lib/director/defs.rb +1 -3
- data/rakelib/lib/director/gdicommon.rb +5 -0
- data/rakelib/lib/director/menu_item.rb +1 -1
- data/rakelib/lib/director/num_validator.rb +5 -7
- data/rakelib/lib/director/owner_drawn_combobox.rb +1 -0
- data/rakelib/lib/director/persistent_window.rb +2 -2
- data/rakelib/lib/director/pgeditor.rb +1 -1
- data/rakelib/lib/director/pgproperties.rb +3 -3
- data/rakelib/lib/director/pgproperty.rb +5 -1
- data/rakelib/lib/director/richtext_style_listbox.rb +5 -0
- data/rakelib/lib/director/sizer.rb +1 -1
- data/rakelib/lib/director/window.rb +4 -0
- data/rakelib/lib/extractor/module.rb +15 -0
- data/rakelib/lib/generate/doc/combo_ctrl.yaml +135 -0
- data/rakelib/lib/generate/doc/file_dialog_customize_hook.yaml +62 -0
- data/rakelib/lib/generate/doc/file_system.yaml +28 -0
- data/rakelib/lib/generate/doc.rb +29 -14
- data/rakelib/lib/generate/interface.rb +16 -6
- data/rakelib/lib/swig_runner.rb +18 -15
- data/rakelib/lib/typemap/combo_popup.rb +42 -0
- data/rakelib/prepost.rake +9 -4
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +14 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +5 -5
- data/rakelib/yard/yard/relative_markdown_links.rb +7 -1
- data/tests/test_combo_ctrl.rb +196 -0
- metadata +28 -17
- data/ext/mkrf_conf_srcgem.rb +0 -67
- data/rakelib/run.rake +0 -52
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 buildtools platform pkg manager for RHEL type systems
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
16
|
+
|
17
|
+
PLATFORM_DEPS = %w[expat-devel findutils gspell-devel gstreamer1-plugins-base-devel gtk3-devel libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel]
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def do_install(distro, pkgs)
|
24
|
+
run_dnf(make_install_cmd(pkgs))
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_platform_pkgs(pkgs)
|
28
|
+
# add build tools
|
29
|
+
if pkgs.include?('git')
|
30
|
+
pkgs.delete('git')
|
31
|
+
pkgs << 'git-core'
|
32
|
+
end
|
33
|
+
# find pkgs we need
|
34
|
+
PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("dnf list installed #{pkg} >/dev/null 2>&1"); list }
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_dnf(cmd)
|
38
|
+
run("dnf #{cmd}")
|
39
|
+
end
|
40
|
+
|
41
|
+
def make_install_cmd(pkgs)
|
42
|
+
# create install command
|
43
|
+
"install -y #{ pkgs.join(' ') }"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 buildtools platform pkg manager for SuSE type systems
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
16
|
+
|
17
|
+
PLATFORM_DEPS = %w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel]
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def do_install(distro, pkgs)
|
24
|
+
run_zypper(make_install_cmd(pkgs))
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_platform_pkgs(pkgs)
|
28
|
+
# add build tools
|
29
|
+
if pkgs.include?('g++')
|
30
|
+
pkgs.delete('g++')
|
31
|
+
pkgs << 'gcc-c++'
|
32
|
+
end
|
33
|
+
# find pkgs we need
|
34
|
+
PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("rpm -q --whatprovides #{pkg} >/dev/null 2>&1"); list }
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_zypper(cmd)
|
38
|
+
run("zypper -t -i #{cmd}")
|
39
|
+
end
|
40
|
+
|
41
|
+
def make_install_cmd(pkgs)
|
42
|
+
# create install command
|
43
|
+
"install -y #{ pkgs.join(' ') }"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -52,32 +52,49 @@ module WXRuby3
|
|
52
52
|
objs = pkg.all_obj_files.collect { |o| File.join('..', o) }.join(' ') + ' '
|
53
53
|
depsh = pkg.dep_libnames.collect { |dl| "#{dl}.#{dll_ext}" }.join(' ')
|
54
54
|
sh "cd lib && #{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} #{depsh} " +
|
55
|
-
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
|
55
|
+
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}",
|
56
|
+
fail_on_error: true
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_tool_pkgs
|
60
|
+
pkg_deps = super
|
61
|
+
pkg_deps << 'doxygen' unless system('command -v doxygen>/dev/null')
|
62
|
+
pkg_deps << 'swig' unless system('command -v swig>/dev/null')
|
63
|
+
pkg_deps
|
56
64
|
end
|
57
65
|
|
58
66
|
def get_rpath_origin
|
59
67
|
"$ORIGIN"
|
60
68
|
end
|
61
69
|
|
70
|
+
def expand(cmd)
|
71
|
+
STDERR.puts "> sh: #{cmd}" if verbose?
|
72
|
+
s = super
|
73
|
+
STDERR.puts "< #{s}" if verbose?
|
74
|
+
s
|
75
|
+
end
|
76
|
+
|
62
77
|
private
|
63
78
|
|
64
79
|
def wx_checkout
|
65
|
-
|
80
|
+
$stdout.print 'Checking out wxWidgets...' if run_silent?
|
66
81
|
# clone wxWidgets GIT repository under ext_path
|
67
82
|
chdir(ext_path) do
|
68
|
-
if (rc = sh("git clone https://github.com/wxWidgets/wxWidgets.git"))
|
83
|
+
if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
|
69
84
|
chdir('wxWidgets') do
|
70
85
|
tag = if @wx_version
|
71
86
|
"v#{@wx_version}"
|
72
87
|
else
|
73
|
-
expand('git tag
|
88
|
+
expand("#{get_cfg_string('git')} tag").split("\n").select { |t| (/\Av3\.(\d+)/ =~ t) && $1.to_i >= 2 }.max
|
74
89
|
end
|
75
90
|
# checkout the version we are building against
|
76
|
-
rc = sh("git checkout #{tag}")
|
91
|
+
rc = sh("#{get_cfg_string('git')} checkout #{tag}")
|
77
92
|
end
|
78
93
|
end
|
79
|
-
|
80
|
-
|
94
|
+
if rc
|
95
|
+
$stdout.puts 'done!' if run_silent?
|
96
|
+
else
|
97
|
+
$stderr.puts "ERROR: Failed to checkout wxWidgets."
|
81
98
|
exit(1)
|
82
99
|
end
|
83
100
|
end
|
@@ -92,36 +109,36 @@ module WXRuby3
|
|
92
109
|
end
|
93
110
|
|
94
111
|
def wx_build
|
112
|
+
$stdout.print 'Configuring wxWidgets...' if run_silent?
|
95
113
|
# initialize submodules
|
96
|
-
unless sh('git submodule update --init
|
97
|
-
|
114
|
+
unless sh("#{get_cfg_string('git')} submodule update --init")
|
115
|
+
$stderr.puts "ERROR: Failed to update wxWidgets submodules."
|
98
116
|
exit(1)
|
99
117
|
end
|
100
118
|
# configure wxWidgets
|
101
119
|
unless wx_configure
|
102
|
-
|
120
|
+
$stderr.puts "ERROR: Failed to configure wxWidgets."
|
103
121
|
exit(1)
|
104
122
|
end
|
123
|
+
$stdout.puts 'done!' if run_silent?
|
124
|
+
$stdout.print 'Building wxWidgets...' if run_silent?
|
105
125
|
# make and install wxWidgets
|
106
126
|
unless wx_make
|
107
|
-
|
127
|
+
$stderr.puts "ERROR: Failed to build wxWidgets libraries."
|
108
128
|
exit(1)
|
109
129
|
end
|
130
|
+
$stdout.puts 'done!' if run_silent?
|
110
131
|
end
|
111
132
|
|
112
133
|
def wx_generate_xml
|
113
134
|
chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
|
114
|
-
sh({ 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh xml')
|
135
|
+
unless sh({ 'DOXYGEN' => get_cfg_string("doxygen"), 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh xml')
|
136
|
+
$stderr.puts 'ERROR: Failed to generate wxWidgets XML API specifications for parsing by wxRuby3.'
|
137
|
+
exit(1)
|
138
|
+
end
|
115
139
|
end
|
116
140
|
end
|
117
141
|
|
118
|
-
def expand(cmd)
|
119
|
-
STDERR.puts "> sh: #{cmd}" if verbose?
|
120
|
-
s = super
|
121
|
-
STDERR.puts "< #{s}" if verbose?
|
122
|
-
s
|
123
|
-
end
|
124
|
-
|
125
142
|
# Allow specification of custom wxWidgets build (mostly useful for
|
126
143
|
# static wxRuby3 builds)
|
127
144
|
def get_wx_path
|
data/rakelib/lib/config.rb
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
require 'rbconfig'
|
10
10
|
require 'fileutils'
|
11
11
|
require 'json'
|
12
|
+
require 'open3'
|
13
|
+
require 'monitor'
|
12
14
|
|
13
15
|
module FileUtils
|
14
16
|
# add convenience methods
|
@@ -73,14 +75,16 @@ module WXRuby3
|
|
73
75
|
'with-wxwin' => !!ENV['WITH_WXWIN'],
|
74
76
|
'with-debug' => ((ENV['WXRUBY_DEBUG'] || '') == '1'),
|
75
77
|
'swig' => ENV['WXRUBY_SWIG'] || 'swig',
|
76
|
-
'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen'
|
78
|
+
'doxygen' => ENV['WXRUBY_DOXYGEN'] || 'doxygen',
|
79
|
+
'git' => ENV['WXRUBY_GIT'] || 'git'
|
77
80
|
})
|
81
|
+
CONFIG['autoinstall'] = (ENV['WXRUBY_AUTOINSTALL'] != '0') if ENV['WXRUBY_AUTOINSTALL']
|
78
82
|
BUILD_CFG = '.wxconfig'
|
79
83
|
|
80
84
|
# Ruby 2.5 is the minimum version for wxRuby3
|
81
85
|
__rb_ver = RUBY_VERSION.split('.').collect {|v| v.to_i}
|
82
86
|
if (__rb_major = __rb_ver.shift) < 2 || (__rb_major == 2 && __rb_ver.shift < 5)
|
83
|
-
|
87
|
+
$stderr.puts 'ERROR: wxRuby3 requires Ruby >= 2.5.0!'
|
84
88
|
exit(1)
|
85
89
|
end
|
86
90
|
|
@@ -111,38 +115,186 @@ module WXRuby3
|
|
111
115
|
|
112
116
|
module Config
|
113
117
|
|
114
|
-
def
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
118
|
+
def self.command_to_s(*cmd)
|
119
|
+
txt = if ::Hash === cmd.first
|
120
|
+
cmd = cmd.dup
|
121
|
+
env = cmd.shift
|
122
|
+
env.collect { |k, v| "#{k}=#{v}" }.join(' ') << ' '
|
123
|
+
else
|
124
|
+
''
|
125
|
+
end
|
126
|
+
txt << cmd.join(' ')
|
127
|
+
end
|
128
|
+
|
129
|
+
def run_silent?
|
130
|
+
!!ENV['WXRUBY_RUN_SILENT']
|
131
|
+
end
|
132
|
+
|
133
|
+
def silent_log_name
|
134
|
+
ENV['WXRUBY_RUN_SILENT'] || 'silent_run.log'
|
135
|
+
end
|
136
|
+
|
137
|
+
def log_progress(msg)
|
138
|
+
run_silent? ? silent_runner.log(msg) : $stdout.puts(msg)
|
139
|
+
end
|
140
|
+
|
141
|
+
class SilentRunner < Monitor
|
142
|
+
|
143
|
+
PROGRESS_CH = '.|/-\\|/-\\|'
|
144
|
+
|
145
|
+
def initialize
|
146
|
+
super
|
147
|
+
@cout = 0
|
148
|
+
@incremental = false
|
149
|
+
end
|
150
|
+
|
151
|
+
def incremental(f=true)
|
152
|
+
synchronize do
|
153
|
+
@cout = 0
|
154
|
+
@incremental = !!f
|
120
155
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
|
127
|
-
when :err, :all
|
128
|
-
cmd << '2>&1'
|
156
|
+
end
|
157
|
+
|
158
|
+
def run(*cmd, **kwargs)
|
159
|
+
synchronize do
|
160
|
+
@cout = 0 unless @incremental
|
129
161
|
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
162
|
+
output = nil
|
163
|
+
verbose = kwargs.delete(:verbose)
|
164
|
+
capture = kwargs.delete(:capture)
|
165
|
+
if (Config.instance.verbose? && verbose != false) || !capture
|
166
|
+
txt = Config.command_to_s(*cmd)
|
167
|
+
if Config.instance.verbose? && verbose != false
|
168
|
+
$stdout.puts txt
|
169
|
+
end
|
170
|
+
if !capture
|
171
|
+
silent_log { |f| f.puts txt }
|
172
|
+
end
|
173
|
+
end
|
174
|
+
if capture
|
175
|
+
if capture == :out || capture == :no_err
|
176
|
+
kwargs[:err] = (Config.instance.windows? ? 'NULL' : '/dev/null') if capture == :no_err
|
177
|
+
Open3.popen2(*cmd, **kwargs) do |_ins, os, tw|
|
178
|
+
output = silent_runner(os)
|
179
|
+
tw.value
|
180
|
+
end
|
181
|
+
else
|
182
|
+
Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
|
183
|
+
output = silent_runner(eos)
|
184
|
+
tw.value
|
141
185
|
end
|
142
186
|
end
|
187
|
+
output.join
|
188
|
+
else
|
189
|
+
rc = silent_log do |fout|
|
190
|
+
Open3.popen2e(*cmd, **kwargs) do |_ins, eos, tw|
|
191
|
+
silent_runner(eos, fout)
|
192
|
+
v = tw.value.exitstatus
|
193
|
+
fout.puts "-> Exit code: #{v}"
|
194
|
+
v
|
195
|
+
end
|
196
|
+
end
|
197
|
+
rc
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def log(msg)
|
202
|
+
silent_log { |f| f.puts(msg) }
|
203
|
+
end
|
204
|
+
|
205
|
+
private
|
206
|
+
|
207
|
+
def silent_runner(os, output=[])
|
208
|
+
synchronize do
|
209
|
+
if @incremental
|
210
|
+
@cout += 1
|
211
|
+
$stdout.print "#{PROGRESS_CH[@cout%10]}\b"
|
212
|
+
$stdout.flush
|
213
|
+
end
|
214
|
+
end
|
215
|
+
os.each do |ln|
|
216
|
+
synchronize do
|
217
|
+
unless @incremental
|
218
|
+
@cout += 1
|
219
|
+
$stdout.print "#{PROGRESS_CH[@cout%10]}\b"
|
220
|
+
$stdout.flush
|
221
|
+
end
|
222
|
+
output << ln
|
223
|
+
end
|
224
|
+
end
|
225
|
+
output
|
226
|
+
end
|
227
|
+
|
228
|
+
def silent_log(&block)
|
229
|
+
File.open(Config.instance.silent_log_name, 'a') do |fout|
|
230
|
+
block.call(fout)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
def silent_runner
|
237
|
+
@silent_runner ||= SilentRunner.new
|
238
|
+
end
|
239
|
+
private :silent_runner
|
240
|
+
|
241
|
+
def do_silent_run(*cmd, **kwargs)
|
242
|
+
silent_runner.run(*cmd, **kwargs)
|
243
|
+
end
|
244
|
+
private :do_silent_run
|
245
|
+
|
246
|
+
def do_silent_run_step(*cmd, **kwargs)
|
247
|
+
silent_runner.run_one(*cmd, **kwargs)
|
248
|
+
end
|
249
|
+
private :do_silent_run_step
|
250
|
+
|
251
|
+
def set_silent_run_incremental
|
252
|
+
silent_runner.incremental
|
253
|
+
end
|
254
|
+
|
255
|
+
def set_silent_run_batched
|
256
|
+
silent_runner.incremental(false)
|
257
|
+
end
|
258
|
+
|
259
|
+
def do_run(*cmd, capture: nil)
|
260
|
+
output = nil
|
261
|
+
if run_silent?
|
262
|
+
output = do_silent_run(exec_env, *cmd, capture: capture)
|
263
|
+
unless capture
|
264
|
+
fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" unless output == 0
|
143
265
|
end
|
144
266
|
else
|
145
|
-
|
267
|
+
if capture
|
268
|
+
env_bup = exec_env.keys.inject({}) do |h, ev|
|
269
|
+
h[ev] = ENV[ev] ? ENV[ev].dup : nil
|
270
|
+
h
|
271
|
+
end
|
272
|
+
case capture
|
273
|
+
when :out
|
274
|
+
# default
|
275
|
+
when :no_err
|
276
|
+
# redirect stderr to null sink
|
277
|
+
cmd << '2> ' << (windows? ? 'NULL' : '/dev/null')
|
278
|
+
when :err, :all
|
279
|
+
cmd << '2>&1'
|
280
|
+
end
|
281
|
+
begin
|
282
|
+
# setup ENV for child execution
|
283
|
+
ENV.merge!(Config.instance.exec_env)
|
284
|
+
output = `#{cmd.join(' ')}`
|
285
|
+
ensure
|
286
|
+
# restore ENV
|
287
|
+
env_bup.each_pair do |k,v|
|
288
|
+
if v
|
289
|
+
ENV[k] = v
|
290
|
+
else
|
291
|
+
ENV.delete(k)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
else
|
296
|
+
Rake.sh(exec_env, *cmd, verbose: verbose?)
|
297
|
+
end
|
146
298
|
end
|
147
299
|
output
|
148
300
|
end
|
@@ -182,24 +334,32 @@ module WXRuby3
|
|
182
334
|
def expand(cmd)
|
183
335
|
`#{cmd}`
|
184
336
|
end
|
185
|
-
private :expand
|
186
337
|
|
187
|
-
def sh(*cmd, **kwargs)
|
188
|
-
|
338
|
+
def sh(*cmd, fail_on_error: false, **kwargs)
|
339
|
+
if run_silent?
|
340
|
+
rc = do_silent_run(*cmd, **kwargs)
|
341
|
+
fail "Command failed with status (#{rc}): #{Config.command_to_s(*cmd)}" if fail_on_error && rc != 0
|
342
|
+
rc == 0
|
343
|
+
elsif fail_on_error
|
344
|
+
Rake.sh(*cmd, **kwargs)
|
345
|
+
else
|
346
|
+
Rake.sh(*cmd, **kwargs) { |ok,_| !!ok }
|
347
|
+
end
|
189
348
|
end
|
190
|
-
private :sh
|
191
349
|
alias :bash :sh
|
192
|
-
private :bash
|
193
350
|
|
194
351
|
def test(*tests, **options)
|
195
352
|
errors = 0
|
353
|
+
excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(';')
|
196
354
|
tests = Dir.glob(File.join(Config.instance.test_dir, '*.rb')) if tests.empty?
|
197
355
|
tests.each do |test|
|
198
|
-
unless
|
199
|
-
|
200
|
-
|
356
|
+
unless excludes.include?(File.basename(test, '.*'))
|
357
|
+
unless File.exist?(test)
|
358
|
+
test = File.join(Config.instance.test_dir, test)
|
359
|
+
test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
|
360
|
+
end
|
361
|
+
Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
|
201
362
|
end
|
202
|
-
Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
|
203
363
|
end
|
204
364
|
fail "ERRORS: ##{errors} test scripts failed." if errors>0
|
205
365
|
end
|
@@ -209,26 +369,56 @@ module WXRuby3
|
|
209
369
|
Rake.sh(Config.instance.exec_env, *make_ruby_cmd('-x', irb_cmd), **options)
|
210
370
|
end
|
211
371
|
|
212
|
-
def
|
213
|
-
|
214
|
-
STDERR.puts 'ERROR: Need GIT installed to run wxRuby3 bootstrap!'
|
215
|
-
exit(1)
|
216
|
-
end
|
372
|
+
def check_wx_config
|
373
|
+
false
|
217
374
|
end
|
218
375
|
|
219
|
-
def
|
220
|
-
|
221
|
-
|
376
|
+
def wx_config(_option)
|
377
|
+
nil
|
378
|
+
end
|
379
|
+
|
380
|
+
def check_tool_pkgs
|
381
|
+
[]
|
382
|
+
end
|
383
|
+
|
384
|
+
def install_prerequisites
|
385
|
+
pkg_deps = check_tool_pkgs
|
386
|
+
if get_config('autoinstall') == false
|
387
|
+
$stderr.puts <<~__ERROR_TXT
|
388
|
+
ERROR: This system lacks installed versions of the following required software packages:
|
389
|
+
#{pkg_deps.join(', ')}
|
390
|
+
|
391
|
+
Install these packages and try again.
|
392
|
+
__ERROR_TXT
|
222
393
|
exit(1)
|
223
394
|
end
|
395
|
+
pkg_deps
|
224
396
|
end
|
225
397
|
|
226
|
-
|
227
|
-
|
398
|
+
# only called after src gem build
|
399
|
+
def cleanup_prerequisites
|
400
|
+
# noop
|
228
401
|
end
|
229
402
|
|
230
|
-
def
|
231
|
-
|
403
|
+
def wants_autoinstall?
|
404
|
+
flag = get_config('autoinstall')
|
405
|
+
if flag.nil?
|
406
|
+
$stdout.puts <<~__Q_TEXT
|
407
|
+
|
408
|
+
[ --- ATTENTION! --- ]
|
409
|
+
wxRuby3 requires some software packages to be installed before being able to continue building.
|
410
|
+
If you like these can be automatically installed next (if you are building the source gem the
|
411
|
+
software will be removed again after building finishes).
|
412
|
+
Do you want to have the required software installed now? [yN] :
|
413
|
+
__Q_TEXT
|
414
|
+
answer = $stdin.gets(chomp: true).strip
|
415
|
+
while !answer.empty? && !%w[Y y N n].include?(answer)
|
416
|
+
$stdout.puts 'Please answer Y/y or N/n [Yn] : '
|
417
|
+
answer = $stdin.gets(chomp: true).strip
|
418
|
+
end
|
419
|
+
flag = %w[Y y].include?(answer)
|
420
|
+
end
|
421
|
+
flag
|
232
422
|
end
|
233
423
|
|
234
424
|
def get_config(key)
|
@@ -341,10 +531,10 @@ module WXRuby3
|
|
341
531
|
def create
|
342
532
|
load # load the build config (if any)
|
343
533
|
klass = Class.new do
|
344
|
-
include Config
|
345
|
-
|
346
534
|
include FileUtils
|
347
535
|
|
536
|
+
include Config
|
537
|
+
|
348
538
|
def initialize
|
349
539
|
@ruby_exe = RB_CONFIG["ruby_install_name"]
|
350
540
|
|
@@ -431,8 +621,10 @@ module WXRuby3
|
|
431
621
|
@ruby_includes = [ RB_CONFIG["rubyhdrdir"],
|
432
622
|
RB_CONFIG["sitehdrdir"],
|
433
623
|
RB_CONFIG["vendorhdrdir"],
|
434
|
-
|
435
|
-
|
624
|
+
RB_CONFIG['rubyarchhdrdir'] ?
|
625
|
+
RB_CONFIG['rubyarchhdrdir'] :
|
626
|
+
File.join(RB_CONFIG["rubyhdrdir"], RB_CONFIG['arch'])
|
627
|
+
].compact
|
436
628
|
@ruby_includes << File.join(@wxruby_path, 'include')
|
437
629
|
|
438
630
|
@ruby_cppflags = [RB_CONFIG["CFLAGS"]].compact
|
@@ -482,10 +674,9 @@ module WXRuby3
|
|
482
674
|
|
483
675
|
def report
|
484
676
|
if @debug_build
|
485
|
-
|
486
|
-
puts "Enabled debugging output"
|
677
|
+
log_progress("Enabled DEBUG build")
|
487
678
|
else
|
488
|
-
|
679
|
+
log_progress("Enabled RELEASE build")
|
489
680
|
end
|
490
681
|
end
|
491
682
|
|
@@ -550,7 +741,7 @@ module WXRuby3
|
|
550
741
|
end
|
551
742
|
|
552
743
|
def do_bootstrap
|
553
|
-
|
744
|
+
install_prerequisites
|
554
745
|
# do we have a local wxWidgets tree already?
|
555
746
|
unless File.directory?(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen'))
|
556
747
|
wx_checkout
|
@@ -567,6 +758,11 @@ module WXRuby3
|
|
567
758
|
respawn_rake
|
568
759
|
end
|
569
760
|
|
761
|
+
def cleanup_bootstrap
|
762
|
+
rm_rf(File.join(ext_path, 'wxWidgets'), verbose: !WXRuby3.config.run_silent?) if File.directory?(File.join(ext_path, 'wxWidgets'))
|
763
|
+
cleanup_prerequisites
|
764
|
+
end
|
765
|
+
|
570
766
|
# Testing the relevant wxWidgets setup.h file to see what
|
571
767
|
# features are supported.
|
572
768
|
|
@@ -638,10 +834,7 @@ module WXRuby3
|
|
638
834
|
private :create
|
639
835
|
|
640
836
|
def instance
|
641
|
-
|
642
|
-
@instance = create
|
643
|
-
end
|
644
|
-
@instance
|
837
|
+
@instance ||= create
|
645
838
|
end
|
646
839
|
|
647
840
|
def get_config(key)
|
@@ -22,7 +22,8 @@ namespace Swig
|
|
22
22
|
DirectorRubyException(VALUE error, VALUE rcvr, ID fn_id)
|
23
23
|
: DirectorException(Qnil)
|
24
24
|
{
|
25
|
-
VALUE msg = rb_sprintf("Caught exception in SWIG director method for %s#%s", rb_class2name(CLASS_OF(rcvr)), rb_id2name(fn_id));
|
25
|
+
VALUE msg = rb_sprintf("Caught exception in SWIG director method for %s#%s : ", rb_class2name(CLASS_OF(rcvr)), rb_id2name(fn_id));
|
26
|
+
rb_str_append(msg, rb_funcall(error, rb_intern("message"), 0));
|
26
27
|
this->swig_msg = StringValuePtr(msg);
|
27
28
|
swig_error = rb_exc_new_str(rb_eRuntimeError, msg);
|
28
29
|
VALUE bt = rb_funcall(error, rb_intern("backtrace"), 0);
|