wxruby3 0.9.5 → 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 +31 -20
- data/lib/wx/core/ext.rb +22 -3
- 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/package.rb +47 -49
- data/rakelib/lib/director/gdicommon.rb +1 -2
- data/rakelib/lib/generate/doc.rb +29 -14
- data/rakelib/lib/generate/interface.rb +4 -2
- data/rakelib/lib/swig_runner.rb +11 -11
- 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
- metadata +21 -17
- data/ext/mkrf_conf_srcgem.rb +0 -67
- data/rakelib/run.rake +0 -52
data/rakelib/gem.rake
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 rake file
|
7
|
+
###
|
8
|
+
|
9
|
+
require_relative './gem'
|
10
|
+
|
11
|
+
namespace :wxruby do
|
12
|
+
|
13
|
+
namespace :gem do
|
14
|
+
|
15
|
+
task :srcgem => ['bin:build', WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION)]
|
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'))
|
23
|
+
|
24
|
+
task :setup => 'config:bootstrap' do |_t, args|
|
25
|
+
begin
|
26
|
+
$stdout.print "Building wxRuby3 extensions..." if WXRuby3.config.run_silent?
|
27
|
+
WXRuby3.config.set_silent_run_incremental
|
28
|
+
Rake::Task['wxruby:build'].invoke
|
29
|
+
WXRuby3.config.set_silent_run_batched
|
30
|
+
$stdout.puts 'done!' if WXRuby3.config.run_silent?
|
31
|
+
Rake::Task['wxruby:post:srcgem'].invoke
|
32
|
+
# all is well -> cleanup
|
33
|
+
if args.extras.include?(':keep_log')
|
34
|
+
$stdout.puts "Log: #{WXRuby3.config.silent_log_name}"
|
35
|
+
else
|
36
|
+
rm_f(WXRuby3.config.silent_log_name, verbose: WXRuby3.config.verbose?)
|
37
|
+
end
|
38
|
+
rescue Exception => ex
|
39
|
+
$stderr.puts <<~__ERR_TXT
|
40
|
+
#{ex.message}#{WXRuby3.config.verbose? ? "\n#{ex.backtrace.join("\n")}" : ''}
|
41
|
+
|
42
|
+
For error details check #{WXRuby3.config.silent_log_name}
|
43
|
+
__ERR_TXT
|
44
|
+
exit(1)
|
45
|
+
end
|
46
|
+
$stdout.puts <<~__MSG
|
47
|
+
|
48
|
+
wxRuby3 has been successfully installed including the 'wxruby' utility.
|
49
|
+
|
50
|
+
You can run the regression tests to verify the installation by executing:
|
51
|
+
|
52
|
+
$ ./wxruby test
|
53
|
+
|
54
|
+
The wxRuby3 sample selector can be run by executing:
|
55
|
+
|
56
|
+
$ ./wxruby sampler
|
57
|
+
|
58
|
+
Have fun using wxRuby3.
|
59
|
+
__MSG
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
# 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|
|
70
|
+
gem.summary = %Q{wxWidgets extension for Ruby}
|
71
|
+
gem.description = %Q{wxRuby3 is a Ruby library providing an extension for the wxWidgets C++ UI framework}
|
72
|
+
gem.email = 'mcorino@m2c-software.nl'
|
73
|
+
gem.homepage = "https://github.com/mcorino/wxRuby3"
|
74
|
+
gem.authors = ['Martin Corino']
|
75
|
+
gem.files = WXRuby3::Gem.manifest
|
76
|
+
gem.require_paths = %w{lib}
|
77
|
+
gem.bindir = 'bin'
|
78
|
+
gem.executables = WXRuby3::Bin.binaries
|
79
|
+
gem.required_ruby_version = '>= 2.5'
|
80
|
+
gem.licenses = ['MIT']
|
81
|
+
gem.add_dependency 'nokogiri', '~> 1.12'
|
82
|
+
gem.add_dependency 'rake'
|
83
|
+
gem.add_dependency 'minitest', '~> 5.15'
|
84
|
+
gem.add_dependency 'test-unit', '~> 3.5'
|
85
|
+
gem.rdoc_options <<
|
86
|
+
'--exclude=\\.dll' <<
|
87
|
+
'--exclude=\\.so' <<
|
88
|
+
'--exclude=lib/wx.rb' <<
|
89
|
+
'--exclude=lib/wx/*.rb' <<
|
90
|
+
"'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'"
|
91
|
+
gem.metadata = {
|
92
|
+
"bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
|
93
|
+
"source_code_uri" => "https://github.com/mcorino/wxRuby3",
|
94
|
+
"documentation_uri" => "https://mcorino.github.io/wxRuby3",
|
95
|
+
"homepage_uri" => "https://github.com/mcorino/wxRuby3",
|
96
|
+
}
|
97
|
+
gem.post_install_message = <<~__MSG
|
98
|
+
|
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'.
|
102
|
+
|
103
|
+
Run 'wxruby setup -h' to see information on the available commandline options.
|
104
|
+
|
105
|
+
__MSG
|
106
|
+
end
|
107
|
+
WXRuby3::Gem.build_gem(gemspec)
|
108
|
+
end
|
109
|
+
|
110
|
+
desc 'Build wxRuby 3 gem'
|
111
|
+
task :gem => 'wxruby:gem:srcgem'
|
112
|
+
|
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
|
159
|
+
end
|
160
|
+
WXRuby3::Gem.build_gem(gemspec)
|
161
|
+
ensure
|
162
|
+
WXRuby3::Install.remove_wxwin_shlibs
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
desc 'Build wxRuby 3 binary gem'
|
167
|
+
task :bingem => 'wxruby:gem:bingem'
|
168
|
+
|
169
|
+
end
|
data/rakelib/gem.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 rake gem support
|
7
|
+
###
|
8
|
+
|
9
|
+
require 'set'
|
10
|
+
require 'rubygems'
|
11
|
+
require 'rubygems/package'
|
12
|
+
begin
|
13
|
+
require 'rubygems/builder'
|
14
|
+
rescue LoadError
|
15
|
+
end
|
16
|
+
|
17
|
+
require_relative './lib/config'
|
18
|
+
require_relative './install'
|
19
|
+
|
20
|
+
module WXRuby3
|
21
|
+
|
22
|
+
module Gem
|
23
|
+
|
24
|
+
def self.manifest(gemtype = :src)
|
25
|
+
# create MANIFEST list with included files
|
26
|
+
manifest = Rake::FileList.new
|
27
|
+
manifest.include %w[bin/*] # *nix executables in bin/
|
28
|
+
manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows?
|
29
|
+
manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*]
|
30
|
+
if gemtype == :bin
|
31
|
+
if WXRuby3.config.get_config('with-wxwin')
|
32
|
+
manifest.include "ext/*.#{WXRuby3.config.dll_mask}"
|
33
|
+
end
|
34
|
+
manifest.include 'ext/mkrf_conf_bingem.rb'
|
35
|
+
manifest.include %w[rakelib/prepost.* rakelib/install.rb rakelib/lib/config.rb rakelib/lib/config/**/* rakelib/lib/ext/**/* rakelib/yard/**/*]
|
36
|
+
manifest.include WXRuby3::BUILD_CFG
|
37
|
+
else
|
38
|
+
manifest.exclude "lib/*.#{WXRuby3.config.dll_mask}"
|
39
|
+
manifest.include 'ext/wxruby3/wxruby.ico', 'ext/wxruby3/swig/**/*', 'ext/wxruby3/include/**/*'
|
40
|
+
manifest.exclude 'ext/wxruby3/swig/classes/**/*'
|
41
|
+
manifest.include 'rakelib/**/*'
|
42
|
+
manifest.exclude %w[rakelib/run.* rakelib/help.* rakelib/package.* rakelib/memcheck.* rakelib/memcheck/**/*]
|
43
|
+
manifest.include 'rakefile'
|
44
|
+
end
|
45
|
+
manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts}
|
46
|
+
manifest
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.define_spec(name, version, gemtype = :src, &block)
|
50
|
+
gemspec = ::Gem::Specification.new(name, version)
|
51
|
+
if gemtype == :bin
|
52
|
+
platform = ::Gem::Platform.local.to_s
|
53
|
+
gemspec.platform = platform
|
54
|
+
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
|
+
|
60
|
+
def self.gem_name(name, version, gemtype = :src)
|
61
|
+
define_spec(name, version, gemtype).full_name
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.gem_file(name, version, gemtype = :src)
|
65
|
+
File.join('pkg', "#{WXRuby3::Gem.gem_name(name, version, gemtype)}.gem")
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.build_gem(gemspec)
|
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
|
73
|
+
end
|
74
|
+
|
75
|
+
FileUtils.mkdir_p('pkg')
|
76
|
+
|
77
|
+
FileUtils.mv(gem_file_name, 'pkg')
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
data/rakelib/install.rb
CHANGED
@@ -57,6 +57,7 @@ module WXRuby3
|
|
57
57
|
|
58
58
|
def install_wxwin_shlibs
|
59
59
|
if WXRuby3.config.get_config('with-wxwin')
|
60
|
+
$stdout.print "Installing wxRuby3 extensions..." if WXRuby3.config.run_silent?
|
60
61
|
# prepare required wxWidgets shared libs
|
61
62
|
wxwin_inshlibs = []
|
62
63
|
WXRuby3::Install.wxwin_shlibs.each do |shlib|
|
@@ -89,6 +90,7 @@ module WXRuby3
|
|
89
90
|
exit(1)
|
90
91
|
end
|
91
92
|
end
|
93
|
+
$stdout.puts 'done!' if WXRuby3.config.run_silent?
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
data/rakelib/lib/config/linux.rb
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
###
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
|
+
require_relative 'pkgman/base'
|
10
11
|
|
11
12
|
module WXRuby3
|
12
13
|
|
@@ -17,6 +18,7 @@ module WXRuby3
|
|
17
18
|
def self.included(base)
|
18
19
|
base.class_eval do
|
19
20
|
include Config::UnixLike
|
21
|
+
|
20
22
|
alias :base_ldflags :ldflags
|
21
23
|
def ldflags(target)
|
22
24
|
"-Wl,-soname,#{File.basename(target)} #{base_ldflags(target)}"
|
@@ -31,10 +33,10 @@ module WXRuby3
|
|
31
33
|
|
32
34
|
def check_rpath_patch
|
33
35
|
unless @rpath_patch
|
34
|
-
if system('
|
36
|
+
if system('command -v patchelf > /dev/null')
|
35
37
|
@rpath_patch = 'patchelf --set-rpath'
|
36
38
|
else
|
37
|
-
STDERR.puts 'Installation of binary gem with-wxwin requires an installed version of
|
39
|
+
STDERR.puts 'Installation of binary gem with-wxwin requires an installed version of the patchelf utility.'
|
38
40
|
return false
|
39
41
|
end
|
40
42
|
end
|
@@ -48,6 +50,26 @@ module WXRuby3
|
|
48
50
|
end
|
49
51
|
false
|
50
52
|
end
|
53
|
+
|
54
|
+
def check_tool_pkgs
|
55
|
+
pkg_deps = super
|
56
|
+
# need g++ to build wxRuby3 extensions in any case
|
57
|
+
pkg_deps << 'g++' unless system('command -v g++>/dev/null')
|
58
|
+
# do we need to build wxWidgets?
|
59
|
+
if get_config('with-wxwin') && get_cfg_string('wxwin').empty?
|
60
|
+
pkg_deps << 'patchelf' unless system('command -v patchelf>/dev/null')
|
61
|
+
pkg_deps << 'make' unless system('command -v make>/dev/null')
|
62
|
+
pkg_deps << 'git' unless system('command -v git>/dev/null')
|
63
|
+
end
|
64
|
+
pkg_deps
|
65
|
+
end
|
66
|
+
|
67
|
+
def install_prerequisites
|
68
|
+
pkg_deps = check_tool_pkgs
|
69
|
+
PkgManager.install(pkg_deps)
|
70
|
+
[]
|
71
|
+
end
|
72
|
+
|
51
73
|
end
|
52
74
|
end
|
53
75
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
###
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
|
+
require_relative 'pkgman/macosx'
|
10
11
|
|
11
12
|
module WXRuby3
|
12
13
|
|
@@ -53,6 +54,21 @@ module WXRuby3
|
|
53
54
|
true
|
54
55
|
end
|
55
56
|
|
57
|
+
def check_tool_pkgs
|
58
|
+
pkg_deps = super
|
59
|
+
# need g++ to build wxRuby3 extensions in any case
|
60
|
+
pkg_deps << 'gcc' unless system('command -v g++>/dev/null')
|
61
|
+
# need this to build anything (like wxRuby3 extensions itself)
|
62
|
+
pkg_deps << 'xcode' unless system('command -v install_name_tool>/dev/null')
|
63
|
+
pkg_deps
|
64
|
+
end
|
65
|
+
|
66
|
+
def install_prerequisites
|
67
|
+
pkg_deps = check_tool_pkgs
|
68
|
+
PkgManager.install(pkg_deps)
|
69
|
+
[]
|
70
|
+
end
|
71
|
+
|
56
72
|
def get_wx_libs
|
57
73
|
wx_libset = ::Set.new
|
58
74
|
lib_list = wx_config("--libs all").split(' ')
|
data/rakelib/lib/config/mingw.rb
CHANGED
@@ -8,6 +8,9 @@
|
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
10
|
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
|
11
14
|
if ENV['RI_DEVKIT'].nil?
|
12
15
|
begin
|
13
16
|
require 'devkit'
|
@@ -23,6 +26,13 @@ module WXRuby3
|
|
23
26
|
|
24
27
|
module Platform
|
25
28
|
|
29
|
+
SWIG_URL = 'https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.0/swigwin-4.2.0.zip/download'
|
30
|
+
SWIG_ZIP = 'swigwin-4.2.0.zip'
|
31
|
+
|
32
|
+
DOXYGEN_URL = 'https://www.doxygen.nl/files/doxygen-1.10.0.windows.x64.bin.zip'
|
33
|
+
|
34
|
+
GIT_URL = 'https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/MinGit-2.43.0-64-bit.zip'
|
35
|
+
|
26
36
|
def self.included(base)
|
27
37
|
base.class_eval do
|
28
38
|
include Config::UnixLike
|
@@ -65,20 +75,79 @@ module WXRuby3
|
|
65
75
|
ftmp.unlink # cleanup
|
66
76
|
end
|
67
77
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
78
|
+
def check_tool_pkgs
|
79
|
+
pkg_deps = []
|
80
|
+
pkg_deps << 'doxygen' if expand("which #{get_cfg_string('doxygen')} 2>/dev/null").strip.empty?
|
81
|
+
pkg_deps << 'swig' if expand("which #{get_cfg_string('swig')} 2>/dev/null").strip.empty?
|
82
|
+
pkg_deps << 'git' if expand("which #{get_cfg_string('git')} 2>/dev/null").strip.empty?
|
83
|
+
pkg_deps
|
72
84
|
end
|
73
85
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
86
|
+
def install_prerequisites
|
87
|
+
pkg_deps = super
|
88
|
+
unless pkg_deps.empty?
|
89
|
+
# autoinstall or not?
|
90
|
+
unless wants_autoinstall?
|
91
|
+
STDERR.puts <<~__ERROR_TXT
|
92
|
+
ERROR: This system lacks installed versions of the following required software packages:
|
93
|
+
#{pkg_deps.join(', ')}
|
94
|
+
|
95
|
+
Install these packages and try again.
|
96
|
+
__ERROR_TXT
|
97
|
+
exit(1)
|
98
|
+
end
|
99
|
+
# if SWIG was not found in the PATH
|
100
|
+
if pkg_deps.include?('swig')
|
101
|
+
$stdout.print 'Installing SWIG...' if run_silent?
|
102
|
+
# download and install SWIG
|
103
|
+
fname = download_and_install(SWIG_URL, SWIG_ZIP, 'swig.exe')
|
104
|
+
$stdout.puts 'done!' if run_silent?
|
105
|
+
Config.instance.log_progress("Installed #{fname}")
|
106
|
+
set_config('swig', fname)
|
107
|
+
Config.save
|
108
|
+
end
|
109
|
+
# if doxygen was not found in the PATH
|
110
|
+
if pkg_deps.include?('doxygen')
|
111
|
+
$stdout.print 'Installing Doxygen...' if run_silent?
|
112
|
+
# download and install doxygen
|
113
|
+
fname = download_and_install(DOXYGEN_URL, File.basename(URI(DOXYGEN_URL).path), 'doxygen.exe', 'doxygen')
|
114
|
+
$stdout.puts 'done!' if run_silent?
|
115
|
+
Config.instance.log_progress("Installed #{fname}")
|
116
|
+
set_config('doxygen', fname)
|
117
|
+
Config.save
|
118
|
+
end
|
119
|
+
# if git was not found in the PATH
|
120
|
+
if pkg_deps.include?('git')
|
121
|
+
$stdout.print 'Installing Git...' if run_silent?
|
122
|
+
# download and install doxygen
|
123
|
+
fname = download_and_install(GIT_URL, File.basename(URI(GIT_URL).path), 'git.exe', 'git')
|
124
|
+
$stdout.puts 'done!' if run_silent?
|
125
|
+
Config.instance.log_progress("Installed #{fname}")
|
126
|
+
set_config('git', fname)
|
127
|
+
Config.save
|
128
|
+
end
|
77
129
|
end
|
130
|
+
[]
|
78
131
|
end
|
79
132
|
|
80
|
-
|
81
|
-
|
133
|
+
# only called after src gem build
|
134
|
+
def cleanup_prerequisites
|
135
|
+
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
|
136
|
+
path = get_cfg_string('swig')
|
137
|
+
unless path.empty? || !path.start_with?(tmp_tool_root)
|
138
|
+
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
139
|
+
rm_rf(path)
|
140
|
+
end
|
141
|
+
path = get_cfg_string('doxygen')
|
142
|
+
unless path.empty? || !path.start_with?(tmp_tool_root)
|
143
|
+
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
144
|
+
rm_rf(path)
|
145
|
+
end
|
146
|
+
path = get_cfg_string('git')
|
147
|
+
unless path.empty? || !path.start_with?(tmp_tool_root)
|
148
|
+
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
149
|
+
rm_rf(path)
|
150
|
+
end
|
82
151
|
end
|
83
152
|
|
84
153
|
def expand(cmd)
|
@@ -93,6 +162,61 @@ module WXRuby3
|
|
93
162
|
super(*cmd, **kwargs)
|
94
163
|
end
|
95
164
|
|
165
|
+
private
|
166
|
+
|
167
|
+
def download_and_install(url, zip, exe, unpack_to=nil)
|
168
|
+
# make sure the download destination exists
|
169
|
+
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
|
170
|
+
dest = unpack_to ? File.join(tmp_tool_root, unpack_to) : File.join(tmp_tool_root, File.basename(zip, '.*'))
|
171
|
+
mkdir(tmp_tool_root) unless File.directory?(tmp_tool_root)
|
172
|
+
# download
|
173
|
+
chdir(tmp_tool_root) do
|
174
|
+
unless sh("curl -L #{url} --output #{zip}")
|
175
|
+
STDERR.puts "ERROR: Failed to download installation package for #{exe}"
|
176
|
+
exit(1)
|
177
|
+
end
|
178
|
+
# unpack
|
179
|
+
unless sh("powershell Expand-Archive -LiteralPath '#{zip}' -DestinationPath #{dest} -Force")
|
180
|
+
STDERR.puts "ERROR: Failed to unpack installation package for #{exe}"
|
181
|
+
exit(1)
|
182
|
+
end
|
183
|
+
# cleanup
|
184
|
+
rm_f(zip)
|
185
|
+
end
|
186
|
+
# find executable
|
187
|
+
find_exe(dest, exe)
|
188
|
+
end
|
189
|
+
|
190
|
+
def find_exe(path, exe)
|
191
|
+
fp = Dir.glob(File.join(path, '*')).find { |p| File.file?(p) && File.basename(p) == exe }
|
192
|
+
unless fp
|
193
|
+
Dir.glob(File.join(path, '*')).each do |p|
|
194
|
+
fp = find_exe(p, exe) if File.directory?(p)
|
195
|
+
return fp if fp
|
196
|
+
end
|
197
|
+
end
|
198
|
+
fp
|
199
|
+
end
|
200
|
+
|
201
|
+
def wx_make
|
202
|
+
bash('make && make install')
|
203
|
+
end
|
204
|
+
|
205
|
+
def wx_generate_xml
|
206
|
+
doxygen = get_cfg_string("doxygen")
|
207
|
+
doxygen = nix_path(doxygen) unless doxygen == 'doxygen'
|
208
|
+
chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
|
209
|
+
unless bash({ 'DOXYGEN' => doxygen, 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh', 'xml')
|
210
|
+
$stderr.puts 'ERROR: Failed to generate wxWidgets XML API specifications for parsing by wxRuby3.'
|
211
|
+
exit(1)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def respawn_rake(argv = ARGV)
|
217
|
+
Kernel.exec('rake', *argv)
|
218
|
+
end
|
219
|
+
|
96
220
|
def nix_path(winpath)
|
97
221
|
(winpath.nil? || winpath.empty?) ? '' : `cygpath -a -u #{winpath}`.strip
|
98
222
|
end
|
@@ -0,0 +1,53 @@
|
|
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 Arch Linux type systems
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
16
|
+
|
17
|
+
PLATFORM_DEPS = %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12]
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def do_install(distro, pkgs)
|
24
|
+
run_pacman(make_install_cmd(pkgs))
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_platform_pkgs(pkgs)
|
28
|
+
if pkgs.include?('g++')
|
29
|
+
pkgs.delete('g++')
|
30
|
+
pkgs << 'gcc'
|
31
|
+
end
|
32
|
+
# find pkgs we need
|
33
|
+
PLATFORM_DEPS.inject(pkgs) { |list, pkg| list << pkg unless system("pacman -Qq #{pkg} >/dev/null 2>&1"); list }
|
34
|
+
end
|
35
|
+
|
36
|
+
def run_pacman(cmd)
|
37
|
+
run("pacman -q --noconfirm #{cmd}")
|
38
|
+
end
|
39
|
+
|
40
|
+
def make_install_cmd(pkgs)
|
41
|
+
# create install command
|
42
|
+
"-S --needed #{ pkgs.join(' ') }"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|