wxruby3 0.9.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +183 -42
- data/README.md +40 -48
- data/ext/mkrf_conf_ext.rb +72 -0
- data/lib/wx/core/app.rb +16 -0
- data/lib/wx/core/colour.rb +36 -28
- data/lib/wx/core/const.rb +19 -0
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/geometry.rb +121 -0
- data/lib/wx/core/graphics_pen_info.rb +18 -0
- data/lib/wx/core/image.rb +49 -0
- data/lib/wx/core/menu_bar.rb +11 -0
- data/lib/wx/core/paintdc.rb +9 -3
- data/lib/wx/core/secret_store.rb +38 -0
- data/lib/wx/doc/app.rb +97 -41
- data/lib/wx/doc/bitmap.rb +4 -0
- data/lib/wx/doc/client_dc.rb +2 -2
- data/lib/wx/doc/clipboard.rb +1 -1
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/const.rb +16 -0
- data/lib/wx/doc/cursor.rb +4 -0
- data/lib/wx/doc/dc_overlay.rb +34 -0
- data/lib/wx/doc/enum.rb +7 -1
- data/lib/wx/doc/event_blocker.rb +1 -1
- data/lib/wx/doc/evthandler.rb +25 -3
- data/lib/wx/doc/functions.rb +3 -6
- data/lib/wx/doc/gc_dc.rb +13 -4
- data/lib/wx/doc/geometry.rb +136 -0
- data/lib/wx/doc/graphics_context.rb +25 -7
- data/lib/wx/doc/icon.rb +4 -0
- data/lib/wx/doc/image.rb +56 -0
- data/lib/wx/doc/list_ctrl.rb +6 -6
- data/lib/wx/doc/memory_dc.rb +2 -11
- data/lib/wx/doc/mirror_dc.rb +1 -1
- data/lib/wx/doc/pen.rb +26 -0
- data/lib/wx/doc/persistence_manager.rb +1 -1
- data/lib/wx/doc/persistent_object.rb +1 -1
- data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/region_iterator.rb +1 -1
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/screen_dc.rb +1 -1
- data/lib/wx/doc/secret_store.rb +55 -0
- data/lib/wx/doc/svg_file_dc.rb +1 -1
- data/lib/wx/doc/textctrl.rb +1 -1
- data/lib/wx/doc/tree_ctrl.rb +2 -2
- data/lib/wx/doc/validator.rb +6 -6
- data/lib/wx/doc/variant.rb +2 -2
- data/lib/wx/doc/window.rb +5 -4
- data/lib/wx/grid/keyword_defs.rb +1 -1
- data/lib/wx/html/keyword_defs.rb +3 -3
- data/lib/wx/keyword_defs.rb +76 -71
- data/lib/wx/pg/keyword_defs.rb +2 -2
- data/lib/wx/pg/pg_property.rb +12 -0
- data/lib/wx/rbn/keyword_defs.rb +1 -1
- data/lib/wx/rtc/keyword_defs.rb +1 -1
- data/lib/wx/stc/keyword_defs.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +3 -5
- data/lib/wx/wxruby/cmd/check.rb +182 -0
- data/lib/wx/wxruby/cmd/sampler.rb +1 -1
- data/lib/wx/wxruby/cmd/setup.rb +9 -3
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/configure.rb +67 -52
- data/rakelib/gem.rake +97 -66
- data/rakelib/gem.rb +294 -41
- data/rakelib/install.rb +3 -3
- data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +42 -11
- data/rakelib/lib/config/mingw.rb +2 -2
- data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
- data/rakelib/lib/config/pkgman/macosx.rb +17 -78
- data/rakelib/lib/config/unixish.rb +17 -8
- data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
- data/rakelib/lib/config.rb +74 -33
- data/rakelib/lib/core/include/enum.inc +31 -1
- data/rakelib/lib/director/affine_matrix.rb +51 -0
- data/rakelib/lib/director/app.rb +29 -13
- data/rakelib/lib/director/art_provider.rb +4 -0
- data/rakelib/lib/director/aui_manager.rb +1 -1
- data/rakelib/lib/director/cursor.rb +6 -2
- data/rakelib/lib/director/dc.rb +1 -6
- data/rakelib/lib/director/derived_dc.rb +88 -31
- data/rakelib/lib/director/geometry.rb +142 -0
- data/rakelib/lib/director/graphics_context.rb +3 -2
- data/rakelib/lib/director/graphics_object.rb +18 -25
- data/rakelib/lib/director/grid_ctrl.rb +2 -2
- data/rakelib/lib/director/image.rb +59 -0
- data/rakelib/lib/director/menu.rb +2 -3
- data/rakelib/lib/director/menu_bar.rb +0 -3
- data/rakelib/lib/director/pen.rb +1 -1
- data/rakelib/lib/director/richtext_composite_object.rb +2 -4
- data/rakelib/lib/director/richtext_ctrl.rb +1 -1
- data/rakelib/lib/director/secret_store.rb +117 -0
- data/rakelib/lib/director/system_settings.rb +1 -1
- data/rakelib/lib/director/tree_event.rb +2 -2
- data/rakelib/lib/director/window.rb +4 -3
- data/rakelib/lib/extractor/function.rb +1 -1
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
- data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
- data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
- data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
- data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
- data/rakelib/lib/generate/doc/icon.yaml +10 -0
- data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
- data/rakelib/lib/generate/doc/log.yaml +1 -1
- data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
- data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
- data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
- data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
- data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
- data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
- data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
- data/rakelib/lib/generate/doc/wizard.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +5 -5
- data/rakelib/lib/generate/interface.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +4 -0
- data/rakelib/lib/swig_runner.rb +24 -3
- data/rakelib/lib/typemap/common.rb +10 -0
- data/rakelib/lib/typemap/points_list.rb +8 -2
- data/rakelib/lib/typemap/richtext.rb +17 -0
- data/rakelib/prepost.rake +8 -1
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
- data/samples/dialogs/wizard.rb +20 -19
- data/samples/drawing/art/drawing/image.bmp +0 -0
- data/samples/drawing/art/drawing/mask.bmp +0 -0
- data/samples/drawing/art/drawing/pat35.bmp +0 -0
- data/samples/drawing/art/drawing/pat36.bmp +0 -0
- data/samples/drawing/art/drawing/pat4.bmp +0 -0
- data/samples/drawing/art/drawing/smile.xpm +42 -0
- data/samples/drawing/drawing.rb +2276 -0
- data/samples/drawing/tn_drawing.png +0 -0
- data/samples/html/html.rb +1 -1
- data/samples/propgrid/propgrid.rb +1 -1
- data/samples/propgrid/propgrid_minimal.rb +1 -1
- data/samples/propgrid/sample_props.rb +1 -1
- data/samples/sampler/editor.rb +13 -11
- data/samples/sampler/sample.rb +2 -0
- data/samples/sampler.rb +14 -10
- data/samples/text/richtext.rb +53 -0
- data/samples/text/scintilla.rb +1 -1
- data/samples/text/unicode.rb +4 -4
- data/tests/lib/wxapp_runner.rb +1 -1
- data/tests/test_config.rb +7 -4
- data/tests/test_ext_controls.rb +12 -5
- data/tests/test_secret_store.rb +83 -0
- data/tests/test_std_controls.rb +12 -12
- metadata +66 -47
- data/lib/wx/doc/extra/00_starting.md +0 -154
- data/lib/wx/doc/extra/01_packages.md +0 -180
- data/lib/wx/doc/extra/02_lifecycles.md +0 -166
- data/lib/wx/doc/extra/03_dialogs.md +0 -57
- data/lib/wx/doc/extra/04_enums.md +0 -143
- data/lib/wx/doc/extra/05_event-handling.md +0 -191
- data/lib/wx/doc/extra/06_geometry.md +0 -62
- data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
- data/lib/wx/doc/extra/08_extensions.md +0 -144
- data/lib/wx/doc/extra/09_exceptions.md +0 -54
- data/lib/wx/doc/extra/10_art.md +0 -111
- data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
- data/lib/wx/doc/extra/12_client_data.md +0 -89
- data/lib/wx/doc/extra/13_validators.md +0 -139
- data/lib/wx/doc/extra/14_config.md +0 -101
- data/lib/wx/doc/extra/15_persistence.md +0 -148
- data/rakefile +0 -14
- data/rakelib/lib/config/pkgman/arch.rb +0 -53
- data/rakelib/lib/config/pkgman/debian.rb +0 -66
- data/rakelib/lib/config/pkgman/rhel.rb +0 -54
- data/rakelib/lib/config/pkgman/suse.rb +0 -54
- data/samples/sampler/back.xpm +0 -21
- data/samples/sampler/copy.xpm +0 -44
- data/samples/sampler/cut.xpm +0 -46
- data/samples/sampler/filesave.xpm +0 -42
- data/samples/sampler/find.xpm +0 -62
- data/samples/sampler/findrepl.xpm +0 -63
- data/samples/sampler/forward.xpm +0 -21
- data/samples/sampler/paste.xpm +0 -46
- data/samples/sampler/redo.xpm +0 -58
- data/samples/sampler/undo.xpm +0 -58
data/rakelib/gem.rb
CHANGED
@@ -13,6 +13,13 @@ begin
|
|
13
13
|
require 'rubygems/builder'
|
14
14
|
rescue LoadError
|
15
15
|
end
|
16
|
+
require 'zlib'
|
17
|
+
require 'tempfile'
|
18
|
+
require 'json'
|
19
|
+
require 'uri'
|
20
|
+
require 'net/https'
|
21
|
+
require 'fileutils'
|
22
|
+
require 'digest/sha2'
|
16
23
|
|
17
24
|
require_relative './lib/config'
|
18
25
|
require_relative './install'
|
@@ -21,60 +28,306 @@ module WXRuby3
|
|
21
28
|
|
22
29
|
module Gem
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
manifest.include
|
35
|
-
manifest.
|
36
|
-
manifest.include
|
37
|
-
else
|
31
|
+
BINPKG_EXT = '.pkg'
|
32
|
+
DIGEST_EXT = '.sha'
|
33
|
+
|
34
|
+
class << self
|
35
|
+
|
36
|
+
# Gem helpers
|
37
|
+
|
38
|
+
def manifest
|
39
|
+
# create MANIFEST list with included files
|
40
|
+
manifest = Rake::FileList.new
|
41
|
+
manifest.include %w[bin/*] # *nix executables in bin/
|
42
|
+
manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows?
|
43
|
+
manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*]
|
38
44
|
manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}"
|
39
|
-
manifest.include 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*'
|
45
|
+
manifest.include 'ext/mkrf_conf_ext.rb', 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*'
|
40
46
|
manifest.exclude 'ext/wxruby3/swig/classes/**/*'
|
41
47
|
manifest.include 'rakelib/**/*'
|
42
48
|
manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*]
|
43
|
-
manifest.include
|
49
|
+
manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts}
|
50
|
+
manifest
|
44
51
|
end
|
45
|
-
manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts}
|
46
|
-
manifest
|
47
|
-
end
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
gemspec
|
53
|
+
def define_spec(&block)
|
54
|
+
gemspec = ::Gem::Specification.new('wxruby3', WXRuby3::WXRUBY_VERSION)
|
55
|
+
gemspec.required_rubygems_version = ::Gem::Requirement.new(">= 0") if gemspec.respond_to? :required_rubygems_version=
|
56
|
+
block.call(gemspec) if block_given?
|
57
|
+
gemspec
|
54
58
|
end
|
55
|
-
gemspec.required_rubygems_version = ::Gem::Requirement.new(">= 0") if gemspec.respond_to? :required_rubygems_version=
|
56
|
-
block.call(gemspec) if block_given?
|
57
|
-
gemspec
|
58
|
-
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
def gem_name
|
61
|
+
define_spec.full_name
|
62
|
+
end
|
63
|
+
private :gem_name
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
def gem_file
|
66
|
+
File.join('pkg', "#{gem_name}.gem")
|
67
|
+
end
|
68
|
+
|
69
|
+
def build_gem(gemspec)
|
70
|
+
if defined?(::Gem::Package) && ::Gem::Package.respond_to?(:build)
|
71
|
+
gem_file_name = ::Gem::Package.build(gemspec)
|
72
|
+
else
|
73
|
+
gem_file_name = ::Gem::Builder.new(gemspec).build
|
74
|
+
end
|
75
|
+
|
76
|
+
FileUtils.mkdir_p('pkg')
|
67
77
|
|
68
|
-
|
69
|
-
if defined?(::Gem::Package) && ::Gem::Package.respond_to?(:build)
|
70
|
-
gem_file_name = ::Gem::Package.build(gemspec)
|
71
|
-
else
|
72
|
-
gem_file_name = ::Gem::Builder.new(gemspec).build
|
78
|
+
FileUtils.mv(gem_file_name, 'pkg')
|
73
79
|
end
|
74
80
|
|
75
|
-
|
81
|
+
# Binary package helpers
|
82
|
+
|
83
|
+
def bin_pkg_manifest
|
84
|
+
# create MANIFEST list with included files
|
85
|
+
manifest = Rake::FileList.new
|
86
|
+
manifest.include "lib/*.#{WXRuby3.config.dll_mask}"
|
87
|
+
manifest.include 'lib/wx/**/events/*.rb', 'lib/wx/**/ext/*.rb', 'lib/wx/core/font/*.rb'
|
88
|
+
manifest.include "lib/wx/doc/gen/**/*.rb"
|
89
|
+
if WXRuby3.config.get_config('with-wxwin')
|
90
|
+
manifest.include "ext/*.#{WXRuby3.config.dll_mask}"
|
91
|
+
end
|
92
|
+
manifest
|
93
|
+
end
|
94
|
+
|
95
|
+
def make_bin_name
|
96
|
+
basename = "wxruby3#{WXRuby3.config.with_wxhead? ? '-head' : ''}"
|
97
|
+
os = WXRuby3.config.sysinfo.os
|
98
|
+
case os.id
|
99
|
+
when :windows
|
100
|
+
"#{basename}_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
|
101
|
+
else
|
102
|
+
"#{basename}_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
private :make_bin_name
|
106
|
+
|
107
|
+
def bin_pkg_name
|
108
|
+
gemspec = ::Gem::Specification.new(make_bin_name, WXRuby3::WXRUBY_VERSION)
|
109
|
+
platform = ::Gem::Platform.new(RB_CONFIG["arch"])
|
110
|
+
if platform.os == 'darwin'
|
111
|
+
# loose the version for darwin kernels as that does not seem to affect wxRuby runtime compatibility
|
112
|
+
# (until proven otherwise)
|
113
|
+
platform.version = nil
|
114
|
+
end
|
115
|
+
gemspec.platform = platform.to_s
|
116
|
+
gemspec.full_name
|
117
|
+
end
|
118
|
+
private :bin_pkg_name
|
119
|
+
|
120
|
+
def bin_pkg_file
|
121
|
+
File.join('pkg', bin_pkg_name+BINPKG_EXT)
|
122
|
+
end
|
123
|
+
|
124
|
+
def build_bin_pkg
|
125
|
+
# make sure pkg directory exists
|
126
|
+
FileUtils.mkdir_p('pkg')
|
127
|
+
|
128
|
+
fname = bin_pkg_file
|
129
|
+
|
130
|
+
# package registry and essential config
|
131
|
+
registry = []
|
132
|
+
config = %w{wxwininstdir with-wxwin}.reduce({}) { |h, k| h[k] = WXRuby3.config.get_config(k); h }
|
133
|
+
# package temp deflate stream
|
134
|
+
deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true)
|
135
|
+
begin
|
136
|
+
# pack binaries into temp deflate stream
|
137
|
+
bin_pkg_manifest.each do |path|
|
138
|
+
registry << pack_file(deflate_stream, path)
|
139
|
+
end
|
140
|
+
# convert registry and config to deflated json string
|
141
|
+
registry_json_z = Zlib::Deflate.deflate(registry.to_json)
|
142
|
+
config_json_z = Zlib::Deflate.deflate(config.to_json)
|
143
|
+
|
144
|
+
# create final package archive
|
145
|
+
deflate_stream.rewind
|
146
|
+
digest = Digest::SHA256.new
|
147
|
+
File.open(fname, 'w', binmode: true) do |fout|
|
148
|
+
# pack config
|
149
|
+
data = [config_json_z.size].pack('Q')
|
150
|
+
digest << data
|
151
|
+
fout.write(data)
|
152
|
+
digest << config_json_z
|
153
|
+
fout.write(config_json_z)
|
154
|
+
# pack registry
|
155
|
+
data = [registry_json_z.size].pack('Q')
|
156
|
+
digest << data
|
157
|
+
fout.write(data)
|
158
|
+
digest << registry_json_z
|
159
|
+
fout.write(registry_json_z)
|
160
|
+
# pack files
|
161
|
+
registry.each do |entry|
|
162
|
+
if entry[2] > 0
|
163
|
+
data = deflate_stream.read(entry[2])
|
164
|
+
digest << data
|
165
|
+
fout.write(data)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
sha_file = File.join('pkg', bin_pkg_name+DIGEST_EXT)
|
170
|
+
File.open(sha_file, 'w') { |fsha| fsha << digest.hexdigest! }
|
171
|
+
ensure
|
172
|
+
deflate_stream.close(true)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def pack_file(os, path)
|
177
|
+
pack = true
|
178
|
+
entry = [path, File.stat(path).mode, 0]
|
179
|
+
unless WXRuby3.config.windows?
|
180
|
+
if File.symlink?(path)
|
181
|
+
pack = false
|
182
|
+
entry << File.readlink(path)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
if pack
|
186
|
+
offs = os.tell
|
187
|
+
os.write(Zlib::Deflate.deflate(File.read(path, binmode: true)))
|
188
|
+
entry[2] = os.tell - offs # packed data size
|
189
|
+
end
|
190
|
+
entry
|
191
|
+
end
|
192
|
+
private :pack_file
|
193
|
+
|
194
|
+
# Gem installation helpers
|
195
|
+
|
196
|
+
def install_gem(prebuilt_only: false, package: nil)
|
197
|
+
# check if a user specified binary package is to be used
|
198
|
+
if package
|
199
|
+
uri = File.file?(package) ? nil : URI(package)
|
200
|
+
if uri.nil? || uri.scheme == 'file'
|
201
|
+
filename = package
|
202
|
+
if uri
|
203
|
+
filename = uri.host ? "#{uri.host}:#{uri.path}" : uri.path
|
204
|
+
filename = nil unless File.file?(filename)
|
205
|
+
end
|
206
|
+
if filename
|
207
|
+
$stdout.puts "Installing user package #{filename}..."
|
208
|
+
exit(1) unless install_bin_pkg(filename)
|
209
|
+
$stdout.puts 'Done!'
|
210
|
+
true
|
211
|
+
else
|
212
|
+
$stderr.puts "ERROR: Cannot access file #{package}."
|
213
|
+
exit(1)
|
214
|
+
end
|
215
|
+
elsif uri.scheme == 'http' || uri.scheme == 'https'
|
216
|
+
# download the binary release package
|
217
|
+
$stdout.puts "Downloading #{uri.path}..."
|
218
|
+
filename = File.basename(uri.path)
|
219
|
+
if WXRuby3.config.download_file(uri.path, filename)
|
220
|
+
sha_file = File.basename(filename, '.*')+DIGEST_EXT
|
221
|
+
uri.path = File.join(File.dirname(uri.path), sha_file)
|
222
|
+
unless WXRuby3.config.download_file(uri.path, sha_file)
|
223
|
+
$stderr.puts "ERROR: Unable to download digest signature for binary release package : #{package}"
|
224
|
+
exit(1)
|
225
|
+
end
|
226
|
+
exit(1) unless install_bin_pkg(filename)
|
227
|
+
true
|
228
|
+
else
|
229
|
+
$stderr.puts "ERROR: Unable to download binary release package (#{package})!"
|
230
|
+
exit(1)
|
231
|
+
end
|
232
|
+
else
|
233
|
+
end
|
234
|
+
# check if there exists a pre-built binary release package for the current platform
|
235
|
+
elsif has_release_package?
|
236
|
+
# download the binary release package
|
237
|
+
$stdout.puts "Downloading #{bin_pkg_url(BINPKG_EXT)}..."
|
238
|
+
if WXRuby3.config.download_file(bin_pkg_url(BINPKG_EXT), bin_pkg_name+BINPKG_EXT)
|
239
|
+
unless WXRuby3.config.download_file(bin_pkg_url(DIGEST_EXT), bin_pkg_name+DIGEST_EXT)
|
240
|
+
$stderr.puts "ERROR: Unable to download digest signature for binary release package : #{bin_pkg_name}"
|
241
|
+
exit(1)
|
242
|
+
end
|
243
|
+
exit(1) unless install_bin_pkg(bin_pkg_name+BINPKG_EXT)
|
244
|
+
true
|
245
|
+
else
|
246
|
+
if prebuilt_only
|
247
|
+
$stderr.puts "ERROR: Unable to download binary release package (#{bin_pkg_name})!"
|
248
|
+
exit(1)
|
249
|
+
end
|
250
|
+
$stdout.puts "WARNING: Unable to download binary release package (#{bin_pkg_name})! Reverting to source install."
|
251
|
+
false
|
252
|
+
end
|
253
|
+
else
|
254
|
+
if prebuilt_only
|
255
|
+
$stderr.puts "ERROR: No binary release package available!"
|
256
|
+
exit(1)
|
257
|
+
end
|
258
|
+
false
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def bin_pkg_url(ext)
|
263
|
+
# which package are we looking for
|
264
|
+
pkg_name = bin_pkg_name
|
265
|
+
"https://github.com/mcorino/wxRuby3/releases/download/v#{WXRuby3::WXRUBY_VERSION}/#{pkg_name}#{ext}"
|
266
|
+
end
|
267
|
+
private :bin_pkg_url
|
268
|
+
|
269
|
+
def has_release_package?
|
270
|
+
# check if the release package exists on Github
|
271
|
+
uri = URI(bin_pkg_url(BINPKG_EXT))
|
272
|
+
$stdout.print "Checking #{uri.to_s}..." if WXRuby3.config.verbose?
|
273
|
+
response = Net::HTTP.start('github.com', use_ssl: true) do |http|
|
274
|
+
request = Net::HTTP::Head.new(uri)
|
275
|
+
http.request(request)
|
276
|
+
end
|
277
|
+
$stdout.puts "response #{response}" if WXRuby3.config.verbose?
|
278
|
+
# directly found or with redirect
|
279
|
+
Net::HTTPOK === response || Net::HTTPRedirection === response
|
280
|
+
end
|
281
|
+
private :has_release_package?
|
282
|
+
|
283
|
+
def install_bin_pkg(fname)
|
284
|
+
# first get digest signature (if available)
|
285
|
+
sha_file = File.join(File.dirname(fname), File.basename(fname, '.*')+DIGEST_EXT)
|
286
|
+
unless File.file?(sha_file)
|
287
|
+
$stderr.puts "ERROR: Cannot access package digest signature file : #{sha_file}."
|
288
|
+
return false
|
289
|
+
end
|
290
|
+
sha_sig = File.read(sha_file)
|
291
|
+
File.open(fname, 'r', binmode: true) do |fin|
|
292
|
+
# check digest signature
|
293
|
+
digest = Digest::SHA256.new
|
294
|
+
while (data = fin.read(1024*1024))
|
295
|
+
digest << data
|
296
|
+
end
|
297
|
+
if sha_sig != digest.hexdigest!
|
298
|
+
$stderr.puts 'ERROR: Package digest signature does NOT match.'
|
299
|
+
return false
|
300
|
+
end
|
301
|
+
fin.rewind
|
302
|
+
# get packed config size
|
303
|
+
config_size = fin.read(8).unpack('Q').shift
|
304
|
+
# unpack config
|
305
|
+
config = JSON.parse!(Zlib::Inflate.inflate(fin.read(config_size)))
|
306
|
+
# get packed registry size
|
307
|
+
registry_size = fin.read(8).unpack('Q').shift
|
308
|
+
# unpack registry
|
309
|
+
registry = JSON.parse!(Zlib::Inflate.inflate(fin.read(registry_size)))
|
310
|
+
# unpack and create binaries
|
311
|
+
registry.each do |entry|
|
312
|
+
path, mode, size, symlink = entry
|
313
|
+
if symlink
|
314
|
+
FileUtils.mkdir_p(File.dirname(symlink))
|
315
|
+
FileUtils.ln_s(symlink, path)
|
316
|
+
else
|
317
|
+
FileUtils.mkdir_p(File.dirname(path))
|
318
|
+
File.open(path, 'w', binmode: true) do |fbin|
|
319
|
+
fbin << Zlib::Inflate.inflate(fin.read(size))
|
320
|
+
end
|
321
|
+
File.chmod(mode, path)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
# merge config
|
325
|
+
config.each_pair { |k,v| WXRuby3.config.set_config(k, v) }
|
326
|
+
end
|
327
|
+
true
|
328
|
+
end
|
329
|
+
private :install_bin_pkg
|
76
330
|
|
77
|
-
FileUtils.mv(gem_file_name, 'pkg')
|
78
331
|
end
|
79
332
|
|
80
333
|
end
|
data/rakelib/install.rb
CHANGED
@@ -67,7 +67,7 @@ module WXRuby3
|
|
67
67
|
FileUtils.ln_s(File.join('.', File.basename(src_shlib)), File.join('ext', File.basename(shlib)))
|
68
68
|
else
|
69
69
|
FileUtils.cp(shlib, inshlib = File.join('ext', File.basename(shlib)))
|
70
|
-
unless WXRuby3.config.
|
70
|
+
unless WXRuby3.config.update_shlib_loadpaths(inshlib)
|
71
71
|
# cleanup and exit
|
72
72
|
FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"])
|
73
73
|
exit(1)
|
@@ -77,14 +77,14 @@ module WXRuby3
|
|
77
77
|
end
|
78
78
|
# prepare wxRuby shared libs
|
79
79
|
Dir["lib/*.#{WXRuby3.config.dll_mask}"].each do |shlib|
|
80
|
-
unless WXRuby3.config.
|
80
|
+
unless WXRuby3.config.update_shlib_loadpaths(shlib) && WXRuby3.config.update_shlib_ruby_libpath(shlib)
|
81
81
|
# cleanup and exit
|
82
82
|
FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"])
|
83
83
|
exit(1)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
(wxwin_inshlibs + Dir["lib/*.#{WXRuby3.config.dll_mask}"]).each do |shlib|
|
87
|
-
unless WXRuby3.config.
|
87
|
+
unless WXRuby3.config.update_shlib_wxwin_libpaths(shlib, WXRuby3::Install.wxwin_shlibs)
|
88
88
|
# cleanup and exit
|
89
89
|
FileUtils.rm_f(Dir["ext/*.#{WXRuby3.config.dll_mask}"])
|
90
90
|
exit(1)
|
data/rakelib/lib/config/linux.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
###
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
|
-
require_relative 'pkgman/
|
10
|
+
require_relative 'pkgman/linux'
|
11
11
|
|
12
12
|
module WXRuby3
|
13
13
|
|
@@ -42,6 +42,7 @@ module WXRuby3
|
|
42
42
|
end
|
43
43
|
true
|
44
44
|
end
|
45
|
+
protected :check_rpath_patch
|
45
46
|
|
46
47
|
def patch_rpath(shlib, *rpath)
|
47
48
|
if check_rpath_patch
|
@@ -50,6 +51,7 @@ module WXRuby3
|
|
50
51
|
end
|
51
52
|
false
|
52
53
|
end
|
54
|
+
protected :patch_rpath
|
53
55
|
|
54
56
|
def check_tool_pkgs
|
55
57
|
pkg_deps = super
|
@@ -79,7 +81,7 @@ module WXRuby3
|
|
79
81
|
@dll_pfx = 'lib'
|
80
82
|
|
81
83
|
if @wx_version
|
82
|
-
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized]
|
84
|
+
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized -Wno-deprecated-copy]
|
83
85
|
@extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
|
84
86
|
|
85
87
|
@ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
|
@@ -9,6 +9,8 @@
|
|
9
9
|
require_relative './unixish'
|
10
10
|
require_relative 'pkgman/macosx'
|
11
11
|
|
12
|
+
require 'pathname'
|
13
|
+
|
12
14
|
module WXRuby3
|
13
15
|
|
14
16
|
module Config
|
@@ -33,12 +35,7 @@ module WXRuby3
|
|
33
35
|
def get_rpath_origin
|
34
36
|
"@loader_path"
|
35
37
|
end
|
36
|
-
|
37
|
-
def check_rpath_patch
|
38
|
-
# no need to check anything; install_name_tool is part of XCode cmdline tools
|
39
|
-
# and without these we couldn't build anything
|
40
|
-
true
|
41
|
-
end
|
38
|
+
protected :get_rpath_origin
|
42
39
|
|
43
40
|
def patch_rpath(shlib, *rpath)
|
44
41
|
# don't leave old rpath-s behind
|
@@ -47,13 +44,44 @@ module WXRuby3
|
|
47
44
|
sh("install_name_tool #{rpath.collect {|rp| "-add_rpath '#{rp}'"}.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
48
45
|
true
|
49
46
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
protected :patch_rpath
|
48
|
+
|
49
|
+
# add Ruby library path for wxruby shared libraries
|
50
|
+
def update_shlib_ruby_libpath(shlib)
|
51
|
+
# fix lookup for the Ruby shared library
|
52
|
+
# on MacOSX the Ruby library will be linked with it's full path from the **development** environment
|
53
|
+
# which is no use after binary deployment so we change that to be relative to the executable's path
|
54
|
+
# loading the shared libs (which is always going to be the Ruby exe)
|
55
|
+
|
56
|
+
# get the development folder holding ruby lib
|
57
|
+
ruby_libdir = Pathname.new(RB_CONFIG['libdir'])
|
58
|
+
# determine the relative path to the lib directory from the executable dir
|
59
|
+
# (this remains constant for any similar deployed Ruby for this platform)
|
60
|
+
rel_ruby_libdir = ruby_libdir.relative_path_from(RB_CONFIG['bindir'])
|
61
|
+
# get the Ruby library name used for linking
|
62
|
+
ld_ruby_lib = (RB_CONFIG['LIBRUBYARG_SHARED'].split.find { |s| s =~ /^-lruby/ }).sub(/^-l/,'')
|
63
|
+
# match the full shared library name that will be linked
|
64
|
+
ruby_so = [RB_CONFIG['LIBRUBY_SO'], RB_CONFIG['LIBRUBY_SONAME'], *RB_CONFIG['LIBRUBY_ALIASES'].split].find do |soname|
|
65
|
+
soname =~ /^lib#{ld_ruby_lib}\./
|
66
|
+
end
|
67
|
+
# form the full path of the shared Ruby library linked
|
68
|
+
ruby_lib = File.join(ruby_libdir.to_s, RB_CONFIG['LIBRUBY_SO'])
|
69
|
+
# change the full path to a path relative to the Ruby executable
|
70
|
+
sh("install_name_tool -change #{ruby_lib} '@executable_path/#{rel_ruby_libdir.to_s}/#{ruby_so}' #{shlib}")
|
54
71
|
true
|
55
72
|
end
|
56
73
|
|
74
|
+
# add deployment lookup paths for wxwidgets shared libraries
|
75
|
+
def update_shlib_wxwin_libpaths(shlib, deplibs)
|
76
|
+
if super
|
77
|
+
changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"}
|
78
|
+
sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
79
|
+
true
|
80
|
+
else
|
81
|
+
false
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
57
85
|
def check_tool_pkgs
|
58
86
|
pkg_deps = super
|
59
87
|
# need g++ to build wxRuby3 extensions in any case
|
@@ -104,7 +132,10 @@ module WXRuby3
|
|
104
132
|
private
|
105
133
|
|
106
134
|
def wx_configure
|
107
|
-
bash(
|
135
|
+
bash("./configure --with-macosx-version-min=#{WXRuby3.config.sysinfo.os.release}.0 " +
|
136
|
+
"--disable-optimise --disable-sys-libs --without-liblzma --without-regex " +
|
137
|
+
"--prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info " +
|
138
|
+
"CFLAGS=\"-Wno-unused-but-set-variable\"")
|
108
139
|
end
|
109
140
|
|
110
141
|
def wx_make
|
data/rakelib/lib/config/mingw.rb
CHANGED
@@ -171,7 +171,7 @@ module WXRuby3
|
|
171
171
|
mkdir(tmp_tool_root) unless File.directory?(tmp_tool_root)
|
172
172
|
# download
|
173
173
|
chdir(tmp_tool_root) do
|
174
|
-
unless
|
174
|
+
unless download_file(url, zip)
|
175
175
|
STDERR.puts "ERROR: Failed to download installation package for #{exe}"
|
176
176
|
exit(1)
|
177
177
|
end
|
@@ -242,7 +242,7 @@ module WXRuby3
|
|
242
242
|
@wx_cppflags.each { |flags| flags.gsub!(/-I(\S+)/) { |s| "-I#{win_path($1)}" } }
|
243
243
|
@wx_libs.each { |libflag| libflag.gsub!(/-L(\S+)/) { |s| "-L#{win_path($1)}" } }
|
244
244
|
|
245
|
-
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized]
|
245
|
+
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized -Wno-deprecated-copy]
|
246
246
|
@extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
|
247
247
|
|
248
248
|
# create a .dll binary
|
@@ -14,6 +14,17 @@ module WXRuby3
|
|
14
14
|
|
15
15
|
module PkgManager
|
16
16
|
|
17
|
+
PLATFORM_DEPS = {
|
18
|
+
debian: %w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev],
|
19
|
+
rhel: %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],
|
20
|
+
suse: %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],
|
21
|
+
arch: %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12]
|
22
|
+
}
|
23
|
+
PLATFORM_ALTS = {
|
24
|
+
suse: { 'g++' => 'gcc-c++' },
|
25
|
+
rhel: { 'git' => 'git-core' },
|
26
|
+
arch: { 'g++' => 'gcc' }
|
27
|
+
}
|
17
28
|
MIN_GENERIC_PKGS = %w[gtk3-devel patchelf g++ make git webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel]
|
18
29
|
|
19
30
|
class << self
|
@@ -21,25 +32,21 @@ module WXRuby3
|
|
21
32
|
def install(pkgs)
|
22
33
|
# do we need to install anything?
|
23
34
|
if !pkgs.empty? || builds_wxwidgets?
|
24
|
-
#
|
25
|
-
|
26
|
-
begin
|
27
|
-
# load distro installation support
|
28
|
-
require_relative "./#{distro[:type]}"
|
29
|
-
rescue LoadError
|
35
|
+
# check linux distro compatibility
|
36
|
+
unless no_autoinstall? || pkgman
|
30
37
|
# do we need to build wxWidgets?
|
31
38
|
pkgs.concat(MIN_GENERIC_PKGS) if builds_wxwidgets?
|
32
39
|
$stderr.puts <<~__ERROR_TXT
|
33
|
-
ERROR: Do not know how to install required packages for distro type '#{
|
40
|
+
ERROR: Do not know how to install required packages for distro type '#{WXRuby3.config.sysinfo.os.variant}'.
|
34
41
|
|
35
|
-
Make sure the following packages (or equivalent) are installed and than try again with
|
42
|
+
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
|
36
43
|
#{pkgs.join(', ')}
|
37
44
|
__ERROR_TXT
|
38
45
|
exit(1)
|
39
46
|
end
|
40
47
|
# can we install?
|
41
48
|
unless no_autoinstall? || has_sudo? || is_root?
|
42
|
-
$stderr.puts 'ERROR: Cannot check for or install required packages. Please install sudo
|
49
|
+
$stderr.puts 'ERROR: Cannot check for or install required packages. Please install sudo and try again.'
|
43
50
|
exit(1)
|
44
51
|
end
|
45
52
|
# do we need to build wxWidgets?
|
@@ -60,7 +67,7 @@ module WXRuby3
|
|
60
67
|
exit(1)
|
61
68
|
end
|
62
69
|
# do the actual install
|
63
|
-
unless
|
70
|
+
unless run(pkgman.make_install_command(*pkgs))
|
64
71
|
$stderr.puts <<~__ERROR_TXT
|
65
72
|
ERROR: Failed to install all or some of the following required software packages:
|
66
73
|
#{pkgs.join(', ')}
|
@@ -78,6 +85,23 @@ module WXRuby3
|
|
78
85
|
|
79
86
|
private
|
80
87
|
|
88
|
+
def pkgman
|
89
|
+
@pkgman ||= WXRuby3.config.sysinfo.os.pkgman
|
90
|
+
end
|
91
|
+
|
92
|
+
def platform_pkgs
|
93
|
+
PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || []
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_platform_pkgs(pkgs)
|
97
|
+
# transform any platform specific package alternatives
|
98
|
+
(PLATFORM_ALTS[WXRuby3.config.sysinfo.os.variant.to_sym] || {}).each_pair do |org, alt|
|
99
|
+
pkgs << alt if pkgs.delete(org)
|
100
|
+
end
|
101
|
+
# add any other platform specific package dependencies
|
102
|
+
pkgs.concat(pkgman.select_uninstalled(platform_pkgs))
|
103
|
+
end
|
104
|
+
|
81
105
|
def builds_wxwidgets?
|
82
106
|
Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty?
|
83
107
|
end
|
@@ -100,8 +124,8 @@ module WXRuby3
|
|
100
124
|
|
101
125
|
def run(cmd)
|
102
126
|
$stdout.print "Running #{cmd}..."
|
103
|
-
rc = WXRuby3.config.sh(
|
104
|
-
$stderr.puts
|
127
|
+
rc = WXRuby3.config.sh(cmd)
|
128
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
105
129
|
rc
|
106
130
|
end
|
107
131
|
|
@@ -109,55 +133,6 @@ module WXRuby3
|
|
109
133
|
`#{is_root? ? '' : 'sudo '}#{cmd}`
|
110
134
|
end
|
111
135
|
|
112
|
-
def get_distro
|
113
|
-
if File.file?('/etc/os-release') # works with most (if not all) recent distro releases
|
114
|
-
data = File.readlines('/etc/os-release').reduce({}) do |hash, line|
|
115
|
-
val, var = line.split('=')
|
116
|
-
hash[val] = var.strip.gsub(/(\A")|("\Z)/, '')
|
117
|
-
hash
|
118
|
-
end
|
119
|
-
{
|
120
|
-
type: if data['ID_LIKE']
|
121
|
-
data['ID_LIKE'].split.first.to_sym
|
122
|
-
elsif File.file?('/etc/redhat-release')
|
123
|
-
:rhel
|
124
|
-
elsif File.file?('/etc/SUSE-brand') || File.file?('/etc/SuSE-release')
|
125
|
-
:suse
|
126
|
-
elsif File.file?('/etc/debian_version')
|
127
|
-
:debian
|
128
|
-
else
|
129
|
-
data['ID'].to_sym
|
130
|
-
end,
|
131
|
-
distro: data['ID'].downcase,
|
132
|
-
release: data['VERSION_ID']
|
133
|
-
}
|
134
|
-
elsif File.file?('/etc/redhat-release')
|
135
|
-
data = File.read('/etc/redhat-release').strip
|
136
|
-
{
|
137
|
-
type: :rhel,
|
138
|
-
distro: data.split.shift.downcase,
|
139
|
-
release: data =~ /\d+(\.\d+)*/ ? $~[0] : ''
|
140
|
-
}
|
141
|
-
elsif File.file?('/etc/SUSE-brand') || File.file?('/etc/SuSE-release')
|
142
|
-
data = File.readlines(File.file?('/etc/SUSE-brand') ? '/etc/SUSE-brand' : '/etc/SuSE-release')
|
143
|
-
{
|
144
|
-
type: :suse,
|
145
|
-
distro: data.shift.split.shift.downcase,
|
146
|
-
release: (data.find { |s| s.strip =~ /\AVERSION\s*=/ } || '').split('=').last || ''
|
147
|
-
}
|
148
|
-
elsif File.file?('/etc/debian_version')
|
149
|
-
{
|
150
|
-
type: :debian,
|
151
|
-
distro: 'generic',
|
152
|
-
release: File.read('/etc/debian_version').strip
|
153
|
-
}
|
154
|
-
else
|
155
|
-
{
|
156
|
-
type: :unknown
|
157
|
-
}
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
136
|
end
|
162
137
|
|
163
138
|
end
|