wxruby3 0.9.7 → 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.
- checksums.yaml +4 -4
- data/INSTALL.md +161 -42
- data/README.md +28 -22
- data/ext/mkrf_conf_ext.rb +68 -0
- data/lib/wx/core/secret_store.rb +38 -0
- data/lib/wx/doc/extra/02_lifecycles.md +4 -4
- data/lib/wx/doc/extra/14_config.md +1 -1
- data/lib/wx/doc/secret_store.rb +55 -0
- 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 +6 -3
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/configure.rb +60 -52
- data/rakelib/gem.rake +97 -67
- data/rakelib/gem.rb +293 -41
- data/rakelib/install.rb +3 -3
- data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
- data/rakelib/lib/config/linux.rb +3 -1
- 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 +11 -1
- data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
- data/rakelib/lib/config.rb +49 -29
- data/rakelib/lib/director/aui_manager.rb +1 -1
- data/rakelib/lib/director/dialog.rb +8 -0
- data/rakelib/lib/director/grid_ctrl.rb +2 -2
- data/rakelib/lib/director/richtext_composite_object.rb +2 -4
- data/rakelib/lib/director/secret_store.rb +117 -0
- data/rakelib/lib/director/tree_event.rb +2 -2
- data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
- data/rakelib/lib/generate/doc.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +1 -0
- data/rakelib/lib/typemap/common.rb +10 -0
- data/rakelib/prepost.rake +8 -1
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
- data/samples/sampler/sample.rb +2 -0
- data/tests/lib/wxapp_runner.rb +1 -1
- data/tests/test_config.rb +7 -4
- data/tests/test_secret_store.rb +83 -0
- metadata +41 -22
- 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/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,305 @@ 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
|
+
os = WXRuby3.config.sysinfo.os
|
97
|
+
case os.id
|
98
|
+
when :windows
|
99
|
+
"wxruby3_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
|
100
|
+
else
|
101
|
+
"wxruby3_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
private :make_bin_name
|
105
|
+
|
106
|
+
def bin_pkg_name
|
107
|
+
gemspec = ::Gem::Specification.new(make_bin_name, WXRuby3::WXRUBY_VERSION)
|
108
|
+
platform = ::Gem::Platform.new(RB_CONFIG["arch"])
|
109
|
+
if platform.os == 'darwin'
|
110
|
+
# loose the version for darwin kernels as that does not seem to affect wxRuby runtime compatibility
|
111
|
+
# (until proven otherwise)
|
112
|
+
platform.version = nil
|
113
|
+
end
|
114
|
+
gemspec.platform = platform.to_s
|
115
|
+
gemspec.full_name
|
116
|
+
end
|
117
|
+
private :bin_pkg_name
|
118
|
+
|
119
|
+
def bin_pkg_file
|
120
|
+
File.join('pkg', bin_pkg_name+BINPKG_EXT)
|
121
|
+
end
|
122
|
+
|
123
|
+
def build_bin_pkg
|
124
|
+
# make sure pkg directory exists
|
125
|
+
FileUtils.mkdir_p('pkg')
|
126
|
+
|
127
|
+
fname = bin_pkg_file
|
128
|
+
|
129
|
+
# package registry and essential config
|
130
|
+
registry = []
|
131
|
+
config = %w{wxwininstdir with-wxwin}.reduce({}) { |h, k| h[k] = WXRuby3.config.get_config(k); h }
|
132
|
+
# package temp deflate stream
|
133
|
+
deflate_stream = Tempfile.new(File.basename(fname, '.*'), binmode: true)
|
134
|
+
begin
|
135
|
+
# pack binaries into temp deflate stream
|
136
|
+
bin_pkg_manifest.each do |path|
|
137
|
+
registry << pack_file(deflate_stream, path)
|
138
|
+
end
|
139
|
+
# convert registry and config to deflated json string
|
140
|
+
registry_json_z = Zlib::Deflate.deflate(registry.to_json)
|
141
|
+
config_json_z = Zlib::Deflate.deflate(config.to_json)
|
142
|
+
|
143
|
+
# create final package archive
|
144
|
+
deflate_stream.rewind
|
145
|
+
digest = Digest::SHA256.new
|
146
|
+
File.open(fname, 'w', binmode: true) do |fout|
|
147
|
+
# pack config
|
148
|
+
data = [config_json_z.size].pack('Q')
|
149
|
+
digest << data
|
150
|
+
fout.write(data)
|
151
|
+
digest << config_json_z
|
152
|
+
fout.write(config_json_z)
|
153
|
+
# pack registry
|
154
|
+
data = [registry_json_z.size].pack('Q')
|
155
|
+
digest << data
|
156
|
+
fout.write(data)
|
157
|
+
digest << registry_json_z
|
158
|
+
fout.write(registry_json_z)
|
159
|
+
# pack files
|
160
|
+
registry.each do |entry|
|
161
|
+
if entry[2] > 0
|
162
|
+
data = deflate_stream.read(entry[2])
|
163
|
+
digest << data
|
164
|
+
fout.write(data)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
sha_file = File.join('pkg', bin_pkg_name+DIGEST_EXT)
|
169
|
+
File.open(sha_file, 'w') { |fsha| fsha << digest.hexdigest! }
|
170
|
+
ensure
|
171
|
+
deflate_stream.close(true)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def pack_file(os, path)
|
176
|
+
pack = true
|
177
|
+
entry = [path, File.stat(path).mode, 0]
|
178
|
+
unless WXRuby3.config.windows?
|
179
|
+
if File.symlink?(path)
|
180
|
+
pack = false
|
181
|
+
entry << File.readlink(path)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
if pack
|
185
|
+
offs = os.tell
|
186
|
+
os.write(Zlib::Deflate.deflate(File.read(path, binmode: true)))
|
187
|
+
entry[2] = os.tell - offs # packed data size
|
188
|
+
end
|
189
|
+
entry
|
190
|
+
end
|
191
|
+
private :pack_file
|
192
|
+
|
193
|
+
# Gem installation helpers
|
194
|
+
|
195
|
+
def install_gem(prebuilt_only: false, package: nil)
|
196
|
+
# check if a user specified binary package is to be used
|
197
|
+
if package
|
198
|
+
uri = File.file?(package) ? nil : URI(package)
|
199
|
+
if uri.nil? || uri.scheme == 'file'
|
200
|
+
filename = package
|
201
|
+
if uri
|
202
|
+
filename = uri.host ? "#{uri.host}:#{uri.path}" : uri.path
|
203
|
+
filename = nil unless File.file?(filename)
|
204
|
+
end
|
205
|
+
if filename
|
206
|
+
$stdout.puts "Installing user package #{filename}..."
|
207
|
+
exit(1) unless install_bin_pkg(filename)
|
208
|
+
$stdout.puts 'Done!'
|
209
|
+
true
|
210
|
+
else
|
211
|
+
$stderr.puts "ERROR: Cannot access file #{package}."
|
212
|
+
exit(1)
|
213
|
+
end
|
214
|
+
elsif uri.scheme == 'http' || uri.scheme == 'https'
|
215
|
+
# download the binary release package
|
216
|
+
$stdout.puts "Downloading #{uri.path}..."
|
217
|
+
filename = File.basename(uri.path)
|
218
|
+
if WXRuby3.config.download_file(uri.path, filename)
|
219
|
+
sha_file = File.basename(filename, '.*')+DIGEST_EXT
|
220
|
+
uri.path = File.join(File.dirname(uri.path), sha_file)
|
221
|
+
unless WXRuby3.config.download_file(uri.path, sha_file)
|
222
|
+
$stderr.puts "ERROR: Unable to download digest signature for binary release package : #{package}"
|
223
|
+
exit(1)
|
224
|
+
end
|
225
|
+
exit(1) unless install_bin_pkg(filename)
|
226
|
+
true
|
227
|
+
else
|
228
|
+
$stderr.puts "ERROR: Unable to download binary release package (#{package})!"
|
229
|
+
exit(1)
|
230
|
+
end
|
231
|
+
else
|
232
|
+
end
|
233
|
+
# check if there exists a pre-built binary release package for the current platform
|
234
|
+
elsif has_release_package?
|
235
|
+
# download the binary release package
|
236
|
+
$stdout.puts "Downloading #{bin_pkg_url(BINPKG_EXT)}..."
|
237
|
+
if WXRuby3.config.download_file(bin_pkg_url(BINPKG_EXT), bin_pkg_name+BINPKG_EXT)
|
238
|
+
unless WXRuby3.config.download_file(bin_pkg_url(DIGEST_EXT), bin_pkg_name+DIGEST_EXT)
|
239
|
+
$stderr.puts "ERROR: Unable to download digest signature for binary release package : #{bin_pkg_name}"
|
240
|
+
exit(1)
|
241
|
+
end
|
242
|
+
exit(1) unless install_bin_pkg(bin_pkg_name+BINPKG_EXT)
|
243
|
+
true
|
244
|
+
else
|
245
|
+
if prebuilt_only
|
246
|
+
$stderr.puts "ERROR: Unable to download binary release package (#{bin_pkg_name})!"
|
247
|
+
exit(1)
|
248
|
+
end
|
249
|
+
$stdout.puts "WARNING: Unable to download binary release package (#{bin_pkg_name})! Reverting to source install."
|
250
|
+
false
|
251
|
+
end
|
252
|
+
else
|
253
|
+
if prebuilt_only
|
254
|
+
$stderr.puts "ERROR: No binary release package available!"
|
255
|
+
exit(1)
|
256
|
+
end
|
257
|
+
false
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def bin_pkg_url(ext)
|
262
|
+
# which package are we looking for
|
263
|
+
pkg_name = bin_pkg_name
|
264
|
+
"https://github.com/mcorino/wxRuby3/releases/download/v#{WXRuby3::WXRUBY_VERSION}/#{pkg_name}#{ext}"
|
265
|
+
end
|
266
|
+
private :bin_pkg_url
|
267
|
+
|
268
|
+
def has_release_package?
|
269
|
+
# check if the release package exists on Github
|
270
|
+
uri = URI(bin_pkg_url(BINPKG_EXT))
|
271
|
+
$stdout.print "Checking #{uri.to_s}..." if WXRuby3.config.verbose?
|
272
|
+
response = Net::HTTP.start('github.com', use_ssl: true) do |http|
|
273
|
+
request = Net::HTTP::Head.new(uri)
|
274
|
+
http.request(request)
|
275
|
+
end
|
276
|
+
$stdout.puts "response #{response}" if WXRuby3.config.verbose?
|
277
|
+
# directly found or with redirect
|
278
|
+
Net::HTTPOK === response || Net::HTTPRedirection === response
|
279
|
+
end
|
280
|
+
private :has_release_package?
|
281
|
+
|
282
|
+
def install_bin_pkg(fname)
|
283
|
+
# first get digest signature (if available)
|
284
|
+
sha_file = File.join(File.dirname(fname), File.basename(fname, '.*')+DIGEST_EXT)
|
285
|
+
unless File.file?(sha_file)
|
286
|
+
$stderr.puts "ERROR: Cannot access package digest signature file : #{sha_file}."
|
287
|
+
return false
|
288
|
+
end
|
289
|
+
sha_sig = File.read(sha_file)
|
290
|
+
File.open(fname, 'r', binmode: true) do |fin|
|
291
|
+
# check digest signature
|
292
|
+
digest = Digest::SHA256.new
|
293
|
+
while (data = fin.read(1024*1024))
|
294
|
+
digest << data
|
295
|
+
end
|
296
|
+
if sha_sig != digest.hexdigest!
|
297
|
+
$stderr.puts 'ERROR: Package digest signature does NOT match.'
|
298
|
+
return false
|
299
|
+
end
|
300
|
+
fin.rewind
|
301
|
+
# get packed config size
|
302
|
+
config_size = fin.read(8).unpack('Q').shift
|
303
|
+
# unpack config
|
304
|
+
config = JSON.parse!(Zlib::Inflate.inflate(fin.read(config_size)))
|
305
|
+
# get packed registry size
|
306
|
+
registry_size = fin.read(8).unpack('Q').shift
|
307
|
+
# unpack registry
|
308
|
+
registry = JSON.parse!(Zlib::Inflate.inflate(fin.read(registry_size)))
|
309
|
+
# unpack and create binaries
|
310
|
+
registry.each do |entry|
|
311
|
+
path, mode, size, symlink = entry
|
312
|
+
if symlink
|
313
|
+
FileUtils.mkdir_p(File.dirname(symlink))
|
314
|
+
FileUtils.ln_s(symlink, path)
|
315
|
+
else
|
316
|
+
FileUtils.mkdir_p(File.dirname(path))
|
317
|
+
File.open(path, 'w', binmode: true) do |fbin|
|
318
|
+
fbin << Zlib::Inflate.inflate(fin.read(size))
|
319
|
+
end
|
320
|
+
File.chmod(mode, path)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
# merge config
|
324
|
+
config.each_pair { |k,v| WXRuby3.config.set_config(k, v) }
|
325
|
+
end
|
326
|
+
true
|
327
|
+
end
|
328
|
+
private :install_bin_pkg
|
76
329
|
|
77
|
-
FileUtils.mv(gem_file_name, 'pkg')
|
78
330
|
end
|
79
331
|
|
80
332
|
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
|
@@ -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
|