Skip to content

Commit

Permalink
Merge pull request #253 from mcorino/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mcorino authored Mar 6, 2024
2 parents 9ced8be + c5ae823 commit cd16054
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 17 deletions.
26 changes: 25 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Two options are available to control the wxRuby3 gem installation process.
#### The `prebuilt` option
The `prebuilt=none|only` option can be used to either prevent binary package matching and installation (`prebuilt=none`)
The `prebuilt=none|only|head` option can be used to either prevent binary package matching and installation (`prebuilt=none`)
or make binary package installation mandatory (`prebuilt=only`).
The following command therefor forces a wxRuby3 source installation and will never fail:
Expand All @@ -240,6 +240,15 @@ And the following command will force binary package installation and fails if no
gem install wxruby3 -- prebuilt=only
```

It is also possible to specify installing the, experimental, head (master) wxWidgets binary package version (`prebuilt=head`).
This package version may not be as readily available as regular release packages depending on the development state of the
wxWidgets master branch.

> **NOTE**<br>
> Although wxRuby3 endeavors to keep up to date with the wxWidgets master branch your mileage may vary. Any release
> binary 'head' package should have basic stability at least but will not have been as extensively tested as regular
> release packages.
#### The `package` option

The `package=URL` option can be used to explicitly specify a binary package to install. This option implies `prebuilt=only`.
Expand Down Expand Up @@ -334,6 +343,21 @@ wxruby setup --with-wxwin

This will force the setup procedure to build and install an embedded wxWidgets version for wxRuby3.

#### Force embedded wxWidgets head installation

To force the setup procedure to build and install an embedded wxWidgets head (master) version the setup procedure can
be started with the `--with-wxhead` option like this:

```shell
wxruby setup --with-wxhead
```

> **NOTE**<br>
> Although wxRuby3 endeavors to keep up to date with the wxWidgets master branch your mileage may vary depending on
> the development state of the wxWidgets master branch. You can check the latest results of the wxRuby3 CI master build
> workflows of the [wxRuby3 Github Actions](https://github.com/mcorino/wxRuby3/actions) to get a feel of the current
> integration state.
#### Setup with user installed wxWidgets

In case of a (custom) user installation of wxWidgets the `--wxwin` (and optionally `--wxxml`) option(s) can be used to
Expand Down
22 changes: 14 additions & 8 deletions ext/mkrf_conf_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
until ARGV.empty?
switch = ARGV.shift
case switch
when /^prebuilt=(none|only)$/
OPTIONS[:prebuilt] = $1 == 'only'
when /^prebuilt=(none|only|head)$/
OPTIONS[:prebuilt] = $1.to_sym
when /^package=(.+)$/
OPTIONS[:package] = $1
when 'help'
Expand All @@ -24,7 +24,7 @@
options:
prebuilt=OPT Specifies to either require (OPT == 'only') or avoid (OPT == 'none') installing prebuilt
prebuilt=OPT Specifies to either require (OPT == 'only' | 'head') or avoid (OPT == 'none') installing prebuilt
binary packages. If not specified installing a prebuilt package will be attempted reverting
to source install if none found.
Expand All @@ -41,14 +41,20 @@
end
end

task_args = ''
task_args = []
unless OPTIONS[:prebuilt].nil?
task_args << "'#{(OPTIONS[:prebuilt] ? '--prebuilt' : '--no-prebuilt')}'"
case OPTIONS[:prebuilt]
when :only
task_args << "'--prebuilt'"
when :none
task_args << "'--no-prebuilt'"
when :head
task_args << "'--prebuilt'" << "'head'"
end
end
if OPTIONS[:package]
task_args << ', ' unless task_args.empty?
pkg = RUBY_PLATFORM =~ /mingw/ ? OPTIONS[:package].gsub('\\', '/') : OPTIONS[:package] # make sure the path is URI compatible
task_args << "'--package', " << "'#{pkg}'"
task_args << "'--package'" << "'#{pkg}'"
end

# generate new rakefile with appropriate default task (calls actual task in rakelib)
Expand All @@ -61,7 +67,7 @@
unless File.file?(File.join('lib', 'wx', 'wxruby_core.so'))
task :default do
Rake::Task['wxruby:gem:install'].invoke(#{task_args})
Rake::Task['wxruby:gem:install'].invoke(#{task_args.join(', ')})
end
end
EOF__
Expand Down
12 changes: 12 additions & 0 deletions lib/wx/pg/pg_property.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ module Wx::PG

PG_DEFAULT_IMAGE_SIZE = Wx::DEFAULT_SIZE

if Wx::WXWIDGETS_VERSION >= '3.3.0'
# backward compatibility constants
PG_FULL_VALUE = PGPropValFormatFlags::FullValue
PG_REPORT_ERROR = PGPropValFormatFlags::ReportError
PG_PROPERTY_SPECIFIC = PGPropValFormatFlags::PropertySpecific
PG_EDITABLE_VALUE = PGPropValFormatFlags::EditableValue
PG_COMPOSITE_FRAGMENT = PGPropValFormatFlags::CompositeFragment
PG_UNEDITABLE_COMPOSITE_FRAGMENT = PGPropValFormatFlags::UneditableCompositeFragment
PG_VALUE_IS_CURRENT = PGPropValFormatFlags::ValueIsCurrent
PG_PROGRAMMATIC_VALUE = PGPropValFormatFlags::ProgrammaticValue
end

class PGProperty

wx_each_attribute = instance_method :each_attribute
Expand Down
3 changes: 3 additions & 0 deletions lib/wx/wxruby/cmd/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def self.parse_args(args)
"the path to the doxygen generated wxWidgets XML interface specs if not using bootstrap") {|v| Setup.options['wxxml'] = File.expand_path(v)}
opts.on('--with-wxwin',
"build a local copy of wxWidgets for use with wxRuby [false]") {|v| Setup.options['with-wxwin'] = true}
opts.on('--with-wxhead',
"build with the head (master) version of wxWidgets [false]", "(implies '--with-wxwin')") {|v| Setup.options['with-wxhead'] = true}
opts.on('--swig=path',
"the path to swig executable [swig]") {|v| Setup.options['swig'] = v}
opts.on('--doxygen=path',
Expand Down Expand Up @@ -62,6 +64,7 @@ def self.run(argv)
cfg_args << "--wxwin=#{Setup.options['wxwin']}" if Setup.options['wxwin']
cfg_args << "--wxxml=#{Setup.options['wxxml']}" if Setup.options['wxxml']
cfg_args << '--with-wxwin' if Setup.options['with-wxwin']
cfg_args << '--with-wxhead' if Setup.options['with-wxhead']
cfg_args << "--swig=#{Setup.options['swig']}" if Setup.options['swig']
cfg_args << "--doxygen=#{Setup.options['doxygen']}" if Setup.options['doxygen']
cfg_args << "--git=#{Setup.options['git']}" if Setup.options['git']
Expand Down
7 changes: 7 additions & 0 deletions rakelib/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def self.define(task, args)
CONFIG[WXW_SYS_KEY] = true
CONFIG['wxwin'] = nil
CONFIG['with-wxwin'] = false
CONFIG['with-wxhead'] = false
else
CONFIG['wxwin'] = File.expand_path(v)
CONFIG[WXW_SYS_KEY] = false
Expand All @@ -77,6 +78,12 @@ def self.define(task, args)
CONFIG['with-wxwin'] = true
CONFIG[WXW_SYS_KEY] = false
}
opts.on('--with-wxhead',
"build with the head (master) version of wxWidgets; implies '--with-wxwin'") { |v|
CONFIG['with-wxhead'] = true
CONFIG['with-wxwin'] = true
CONFIG[WXW_SYS_KEY] = false
}
opts.on('--with-debug',
"build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true}
opts.on('--swig=path',
Expand Down
5 changes: 5 additions & 0 deletions rakelib/gem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ else # in case of installed source gem the following tasks exist
case switch
when '--prebuilt'
kwargs[:prebuilt_only] = true
if argv.first == 'head'
argv.shift # loose it
# set this config key to make binpkg name come out right
WXRuby3.config.set_config('with-wxhead', true)
end
when '--no-prebuilt'
no_prebuilt = true unless kwargs[:package]
when '--package'
Expand Down
5 changes: 3 additions & 2 deletions rakelib/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ def bin_pkg_manifest
end

def make_bin_name
basename = "wxruby3#{WXRuby3.config.with_wxhead? ? '-head' : ''}"
os = WXRuby3.config.sysinfo.os
case os.id
when :windows
"wxruby3_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
"#{basename}_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
else
"wxruby3_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
"#{basename}_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
end
end
private :make_bin_name
Expand Down
15 changes: 15 additions & 0 deletions rakelib/lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ def with_wxwin?
get_config('with-wxwin')
end

def with_wxhead?
get_config('with-wxhead')
end

def wx_version
@wx_version || ''
end
Expand Down Expand Up @@ -760,6 +764,17 @@ def build_paths
[ rake_deps_path, src_path, src_gen_path, obj_path, classes_path, common_path, interface_path ]
end

def wx_gitref
if @wx_version
"v#{@wx_version}"
elsif get_config('with-wxhead')
'master'
else
nil
end
end
private :wx_gitref

def do_bootstrap
install_prerequisites
# do we have a local wxWidgets tree already?
Expand Down
13 changes: 11 additions & 2 deletions rakelib/lib/config/unixish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def download_file(url, dest)

private

def wx_gitref
super ||
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i == 3 && $2.to_i >= 2) || $1.to_i > 3)
end.max
end

def wx_checkout
$stdout.print 'Checking out wxWidgets...' if run_silent?
# clone wxWidgets GIT repository under ext_path
Expand All @@ -95,10 +102,12 @@ def wx_checkout
tag = if @wx_version
"v#{@wx_version}"
else
expand("#{get_cfg_string('git')} tag").split("\n").select { |t| (/\Av3\.(\d+)/ =~ t) && $1.to_i >= 2 }.max
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i==3 && $2.to_i >= 2) || $1.to_i>3)
end.max
end
# checkout the version we are building against
rc = sh("#{get_cfg_string('git')} checkout #{tag}")
rc = sh("#{get_cfg_string('git')} checkout #{wx_gitref}")
end
end
if rc
Expand Down
8 changes: 7 additions & 1 deletion rakelib/lib/core/include/enum.inc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,13 @@ WXRB_EXPORT_FLAG VALUE wxRuby_GetEnumValueObject(const char* enum_wx_class_name_
VALUE enum_klass = rb_hash_aref(enum_hash, ID2SYM(rb_intern(enum_class_name)));
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
VALUE enum_values_hash = rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
return rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
VALUE rc = rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
if (NIL_P(rc))
{
VALUE args[1] = { INT2NUM(enum_val) };
rc = rb_class_new_instance(1, args, enum_klass);
}
return rc;
}
return Qnil;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/propgrid/sample_props.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def do_get_editor_class
end

def value_to_string(value, argFlags=0)
if (argFlags & Wx::PG::PG_FULL_VALUE) != 0
if argFlags.allbits?(Wx::PG::PG_FULL_VALUE)
generate_value_as_string(-1,false)
elsif value.object == self.value.object
@display # Display cached string only if value truly matches m_value
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ext_controls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_spin_control
assert_equal(100, spin.max)
end

if has_ui_simulator?
if has_ui_simulator? && Wx::PLATFORM != 'WXOSX'

def test_arrows
spin.set_value(0)
Expand Down Expand Up @@ -240,7 +240,7 @@ def test_spin_control
assert_equal(10, spin.digits)
end

if has_ui_simulator?
if has_ui_simulator? && Wx::PLATFORM != 'WXOSX'

def test_arrows
spin.set_value(0.0)
Expand Down

0 comments on commit cd16054

Please sign in to comment.