wxruby3 0.9.5 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +440 -84
- data/README.md +40 -23
- data/ext/mkrf_conf_ext.rb +68 -0
- data/lib/wx/core/ext.rb +22 -3
- 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 +8 -8
- data/lib/wx/wxruby/cmd/check.rb +182 -0
- data/lib/wx/wxruby/cmd/sampler.rb +39 -29
- data/lib/wx/wxruby/cmd/setup.rb +125 -0
- data/lib/wx/wxruby/cmd/test.rb +56 -6
- 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 +63 -35
- data/rakelib/doc.rake +3 -1
- data/rakelib/gem.rake +199 -0
- data/rakelib/gem.rb +334 -0
- data/rakelib/install.rb +5 -3
- data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
- data/rakelib/lib/config/linux.rb +26 -2
- data/rakelib/lib/config/macosx.rb +58 -11
- data/rakelib/lib/config/mingw.rb +134 -10
- data/rakelib/lib/config/pkgman/linux.rb +144 -0
- data/rakelib/lib/config/pkgman/macosx.rb +122 -0
- data/rakelib/lib/config/unixish.rb +47 -20
- data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
- data/rakelib/lib/config.rb +301 -88
- data/rakelib/lib/core/package.rb +47 -49
- data/rakelib/lib/director/aui_manager.rb +1 -1
- data/rakelib/lib/director/dialog.rb +8 -0
- data/rakelib/lib/director/gdicommon.rb +1 -2
- 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 +29 -14
- data/rakelib/lib/generate/interface.rb +4 -2
- data/rakelib/lib/specs/interfaces.rb +1 -0
- data/rakelib/lib/swig_runner.rb +11 -11
- data/rakelib/lib/typemap/common.rb +10 -0
- data/rakelib/prepost.rake +17 -5
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +18 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +5 -5
- data/rakelib/yard/yard/relative_markdown_links.rb +7 -1
- 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 +46 -23
- data/ext/mkrf_conf_srcgem.rb +0 -67
- data/rakelib/run.rake +0 -52
@@ -7,6 +7,9 @@
|
|
7
7
|
###
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
|
+
require_relative 'pkgman/macosx'
|
11
|
+
|
12
|
+
require 'pathname'
|
10
13
|
|
11
14
|
module WXRuby3
|
12
15
|
|
@@ -32,12 +35,7 @@ module WXRuby3
|
|
32
35
|
def get_rpath_origin
|
33
36
|
"@loader_path"
|
34
37
|
end
|
35
|
-
|
36
|
-
def check_rpath_patch
|
37
|
-
# no need to check anything; install_name_tool is part of XCode cmdline tools
|
38
|
-
# and without these we couldn't build anything
|
39
|
-
true
|
40
|
-
end
|
38
|
+
protected :get_rpath_origin
|
41
39
|
|
42
40
|
def patch_rpath(shlib, *rpath)
|
43
41
|
# don't leave old rpath-s behind
|
@@ -46,13 +44,59 @@ module WXRuby3
|
|
46
44
|
sh("install_name_tool #{rpath.collect {|rp| "-add_rpath '#{rp}'"}.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
47
45
|
true
|
48
46
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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}")
|
53
71
|
true
|
54
72
|
end
|
55
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
|
+
|
85
|
+
def check_tool_pkgs
|
86
|
+
pkg_deps = super
|
87
|
+
# need g++ to build wxRuby3 extensions in any case
|
88
|
+
pkg_deps << 'gcc' unless system('command -v g++>/dev/null')
|
89
|
+
# need this to build anything (like wxRuby3 extensions itself)
|
90
|
+
pkg_deps << 'xcode' unless system('command -v install_name_tool>/dev/null')
|
91
|
+
pkg_deps
|
92
|
+
end
|
93
|
+
|
94
|
+
def install_prerequisites
|
95
|
+
pkg_deps = check_tool_pkgs
|
96
|
+
PkgManager.install(pkg_deps)
|
97
|
+
[]
|
98
|
+
end
|
99
|
+
|
56
100
|
def get_wx_libs
|
57
101
|
wx_libset = ::Set.new
|
58
102
|
lib_list = wx_config("--libs all").split(' ')
|
@@ -88,7 +132,10 @@ module WXRuby3
|
|
88
132
|
private
|
89
133
|
|
90
134
|
def wx_configure
|
91
|
-
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\"")
|
92
139
|
end
|
93
140
|
|
94
141
|
def wx_make
|
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 download_file(url, 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
|
@@ -118,7 +242,7 @@ module WXRuby3
|
|
118
242
|
@wx_cppflags.each { |flags| flags.gsub!(/-I(\S+)/) { |s| "-I#{win_path($1)}" } }
|
119
243
|
@wx_libs.each { |libflag| libflag.gsub!(/-L(\S+)/) { |s| "-L#{win_path($1)}" } }
|
120
244
|
|
121
|
-
@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]
|
122
246
|
@extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
|
123
247
|
|
124
248
|
# create a .dll binary
|
@@ -0,0 +1,144 @@
|
|
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 base
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
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
|
+
}
|
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]
|
29
|
+
|
30
|
+
class << self
|
31
|
+
|
32
|
+
def install(pkgs)
|
33
|
+
# do we need to install anything?
|
34
|
+
if !pkgs.empty? || builds_wxwidgets?
|
35
|
+
# check linux distro compatibility
|
36
|
+
unless no_autoinstall? || pkgman
|
37
|
+
# do we need to build wxWidgets?
|
38
|
+
pkgs.concat(MIN_GENERIC_PKGS) if builds_wxwidgets?
|
39
|
+
$stderr.puts <<~__ERROR_TXT
|
40
|
+
ERROR: Do not know how to install required packages for distro type '#{WXRuby3.config.sysinfo.os.variant}'.
|
41
|
+
|
42
|
+
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
|
43
|
+
#{pkgs.join(', ')}
|
44
|
+
__ERROR_TXT
|
45
|
+
exit(1)
|
46
|
+
end
|
47
|
+
# can we install?
|
48
|
+
unless no_autoinstall? || has_sudo? || is_root?
|
49
|
+
$stderr.puts 'ERROR: Cannot check for or install required packages. Please install sudo and try again.'
|
50
|
+
exit(1)
|
51
|
+
end
|
52
|
+
# do we need to build wxWidgets?
|
53
|
+
if builds_wxwidgets?
|
54
|
+
# add platform specific packages for wxWidgets
|
55
|
+
add_platform_pkgs(pkgs)
|
56
|
+
end
|
57
|
+
# do we actually have any packages to install?
|
58
|
+
unless pkgs.empty?
|
59
|
+
# autoinstall or not?
|
60
|
+
unless wants_autoinstall?
|
61
|
+
$stderr.puts <<~__ERROR_TXT
|
62
|
+
ERROR: This system may lack installed versions of the following required software packages:
|
63
|
+
#{pkgs.join(', ')}
|
64
|
+
|
65
|
+
Install these packages and try again.
|
66
|
+
__ERROR_TXT
|
67
|
+
exit(1)
|
68
|
+
end
|
69
|
+
# do the actual install
|
70
|
+
unless run(pkgman.make_install_command(*pkgs))
|
71
|
+
$stderr.puts <<~__ERROR_TXT
|
72
|
+
ERROR: Failed to install all or some of the following required software packages:
|
73
|
+
#{pkgs.join(', ')}
|
74
|
+
|
75
|
+
Fix any problems or install these packages yourself and try again.
|
76
|
+
__ERROR_TXT
|
77
|
+
if WXRuby3.config.run_silent?
|
78
|
+
$stderr.puts "For error details check #{WXRuby3.config.silent_log_name}"
|
79
|
+
end
|
80
|
+
exit(1)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
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
|
+
|
105
|
+
def builds_wxwidgets?
|
106
|
+
Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty?
|
107
|
+
end
|
108
|
+
|
109
|
+
def no_autoinstall?
|
110
|
+
Config.get_config('autoinstall') == false
|
111
|
+
end
|
112
|
+
|
113
|
+
def wants_autoinstall?
|
114
|
+
WXRuby3.config.wants_autoinstall?
|
115
|
+
end
|
116
|
+
|
117
|
+
def has_sudo?
|
118
|
+
system('command -v sudo > /dev/null')
|
119
|
+
end
|
120
|
+
|
121
|
+
def is_root?
|
122
|
+
`id -u 2>/dev/null`.chomp == '0'
|
123
|
+
end
|
124
|
+
|
125
|
+
def run(cmd)
|
126
|
+
$stdout.print "Running #{cmd}..."
|
127
|
+
rc = WXRuby3.config.sh(cmd)
|
128
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
129
|
+
rc
|
130
|
+
end
|
131
|
+
|
132
|
+
def expand(cmd)
|
133
|
+
`#{is_root? ? '' : 'sudo '}#{cmd}`
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,122 @@
|
|
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 MacOSX pkg manager
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
def install(pkgs)
|
20
|
+
# do we need to install anything?
|
21
|
+
unless pkgs.empty?
|
22
|
+
# can we install XCode commandline tools?
|
23
|
+
unless no_autoinstall? || !pkgs.include?('xcode') || has_sudo? || is_root?
|
24
|
+
STDERR.puts 'ERROR: Cannot check for or install required packages. Please install sudo or run as root and try again.'
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
# autoinstall or not?
|
29
|
+
unless pkgs.empty? || wants_autoinstall?
|
30
|
+
$stderr.puts <<~__ERROR_TXT
|
31
|
+
ERROR: This system may lack installed versions of the following required software packages:
|
32
|
+
#{pkgs.join(', ')}
|
33
|
+
|
34
|
+
Install these packages and try again.
|
35
|
+
__ERROR_TXT
|
36
|
+
exit(1)
|
37
|
+
end
|
38
|
+
# do the actual install (or nothing)
|
39
|
+
unless do_install(pkgs)
|
40
|
+
$stderr.puts <<~__ERROR_TXT
|
41
|
+
ERROR: Failed to install all or some of the following required software packages:
|
42
|
+
#{pkgs.join(', ')}
|
43
|
+
|
44
|
+
Fix any problems or install these packages yourself and try again.
|
45
|
+
__ERROR_TXT
|
46
|
+
exit(1)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def pkgman
|
54
|
+
@pkgman ||= WXRuby3.config.sysinfo.os.pkgman
|
55
|
+
end
|
56
|
+
|
57
|
+
def do_install(pkgs)
|
58
|
+
rc = true
|
59
|
+
# first see if we need to install XCode commandline tools
|
60
|
+
if pkgs.include?('xcode')
|
61
|
+
pkgs.delete('xcode')
|
62
|
+
rc = auth_run('xcode-select --install')
|
63
|
+
end
|
64
|
+
# now check if we need any other packages
|
65
|
+
if rc && !pkgs.empty?
|
66
|
+
if pkgman.macports?
|
67
|
+
|
68
|
+
# this is really crap; with MacPorts we need to install swig-ruby instead of simply swig
|
69
|
+
# which for whatever nonsensical reason will pull in another (older) Ruby version (probably 2.3 or such)
|
70
|
+
# although SWIG's Ruby support is version agnostic and has no binary bindings
|
71
|
+
if pkgs.include?('swig')
|
72
|
+
pkgs.delete('swig')
|
73
|
+
pkgs << 'swig-ruby'
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# actually install packages
|
79
|
+
pkgs.each { |pkg| rc &&= run(pkgman.make_install_command(pkg)); break unless rc }
|
80
|
+
end
|
81
|
+
rc
|
82
|
+
end
|
83
|
+
|
84
|
+
def no_autoinstall?
|
85
|
+
Config.get_config('autoinstall') == false
|
86
|
+
end
|
87
|
+
|
88
|
+
def wants_autoinstall?
|
89
|
+
WXRuby3.config.wants_autoinstall?
|
90
|
+
end
|
91
|
+
|
92
|
+
def has_sudo?
|
93
|
+
WXRuby3.config.sysinfo.os.has_sudo?
|
94
|
+
end
|
95
|
+
|
96
|
+
def is_root?
|
97
|
+
WXRuby3.config.sysinfo.os.is_root?
|
98
|
+
end
|
99
|
+
|
100
|
+
def auth_run(cmd)
|
101
|
+
$stdout.print "Running #{cmd}..."
|
102
|
+
rc = WXRuby3.config.sh("#{is_root? ? '' : 'sudo '}#{cmd}")
|
103
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
104
|
+
rc
|
105
|
+
end
|
106
|
+
|
107
|
+
def run(*cmd, title: nil)
|
108
|
+
$stdout.print(title ? title : "Running #{cmd}...")
|
109
|
+
rc = WXRuby3.config.sh(*cmd)
|
110
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
111
|
+
rc
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -52,39 +52,66 @@ 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
|
69
|
+
protected :get_rpath_origin
|
70
|
+
|
71
|
+
# add deployment lookup paths for wxruby shared libraries
|
72
|
+
def update_shlib_loadpaths(shlib)
|
73
|
+
WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin, "#{WXRuby3.config.get_rpath_origin}/../ext")
|
74
|
+
end
|
75
|
+
|
76
|
+
def expand(cmd)
|
77
|
+
STDERR.puts "> sh: #{cmd}" if verbose?
|
78
|
+
s = super
|
79
|
+
STDERR.puts "< #{s}" if verbose?
|
80
|
+
s
|
81
|
+
end
|
82
|
+
|
83
|
+
def download_file(url, dest)
|
84
|
+
sh("curl -L #{url} --output #{dest}")
|
85
|
+
end
|
61
86
|
|
62
87
|
private
|
63
88
|
|
64
89
|
def wx_checkout
|
65
|
-
|
90
|
+
$stdout.print 'Checking out wxWidgets...' if run_silent?
|
66
91
|
# clone wxWidgets GIT repository under ext_path
|
67
92
|
chdir(ext_path) do
|
68
|
-
if (rc = sh("git clone https://github.com/wxWidgets/wxWidgets.git"))
|
93
|
+
if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
|
69
94
|
chdir('wxWidgets') do
|
70
95
|
tag = if @wx_version
|
71
96
|
"v#{@wx_version}"
|
72
97
|
else
|
73
|
-
expand('git tag
|
98
|
+
expand("#{get_cfg_string('git')} tag").split("\n").select { |t| (/\Av3\.(\d+)/ =~ t) && $1.to_i >= 2 }.max
|
74
99
|
end
|
75
100
|
# checkout the version we are building against
|
76
|
-
rc = sh("git checkout #{tag}")
|
101
|
+
rc = sh("#{get_cfg_string('git')} checkout #{tag}")
|
77
102
|
end
|
78
103
|
end
|
79
|
-
|
80
|
-
|
104
|
+
if rc
|
105
|
+
$stdout.puts 'done!' if run_silent?
|
106
|
+
else
|
107
|
+
$stderr.puts "ERROR: Failed to checkout wxWidgets."
|
81
108
|
exit(1)
|
82
109
|
end
|
83
110
|
end
|
84
111
|
end
|
85
112
|
|
86
113
|
def wx_configure
|
87
|
-
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
|
114
|
+
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --without-regex --disable-debug_info')
|
88
115
|
end
|
89
116
|
|
90
117
|
def wx_make
|
@@ -92,36 +119,36 @@ module WXRuby3
|
|
92
119
|
end
|
93
120
|
|
94
121
|
def wx_build
|
122
|
+
$stdout.print 'Configuring wxWidgets...' if run_silent?
|
95
123
|
# initialize submodules
|
96
|
-
unless sh('git submodule update --init
|
97
|
-
|
124
|
+
unless sh("#{get_cfg_string('git')} submodule update --init")
|
125
|
+
$stderr.puts "ERROR: Failed to update wxWidgets submodules."
|
98
126
|
exit(1)
|
99
127
|
end
|
100
128
|
# configure wxWidgets
|
101
129
|
unless wx_configure
|
102
|
-
|
130
|
+
$stderr.puts "ERROR: Failed to configure wxWidgets."
|
103
131
|
exit(1)
|
104
132
|
end
|
133
|
+
$stdout.puts 'done!' if run_silent?
|
134
|
+
$stdout.print 'Building wxWidgets...' if run_silent?
|
105
135
|
# make and install wxWidgets
|
106
136
|
unless wx_make
|
107
|
-
|
137
|
+
$stderr.puts "ERROR: Failed to build wxWidgets libraries."
|
108
138
|
exit(1)
|
109
139
|
end
|
140
|
+
$stdout.puts 'done!' if run_silent?
|
110
141
|
end
|
111
142
|
|
112
143
|
def wx_generate_xml
|
113
144
|
chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
|
114
|
-
sh({ 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh xml')
|
145
|
+
unless sh({ 'DOXYGEN' => get_cfg_string("doxygen"), 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh xml')
|
146
|
+
$stderr.puts 'ERROR: Failed to generate wxWidgets XML API specifications for parsing by wxRuby3.'
|
147
|
+
exit(1)
|
148
|
+
end
|
115
149
|
end
|
116
150
|
end
|
117
151
|
|
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
152
|
# Allow specification of custom wxWidgets build (mostly useful for
|
126
153
|
# static wxRuby3 builds)
|
127
154
|
def get_wx_path
|