Skip to content

Commit

Permalink
Merge pull request #284 from mcorino/develop
Browse files Browse the repository at this point in the history
Fixing minor release issues
  • Loading branch information
mcorino committed Jun 1, 2024
2 parents f5e4241 + 1dece0e commit 1ea1e7f
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 146 deletions.
8 changes: 8 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ verify_1_task:
env:
osname: linux
distro: opensuse
- name: Cirrus CI / Ubuntu AMD64 Release
container:
image: ubuntu:latest
cpu: 4
memory: 8G
env:
osname: linux
distro: ubuntu

before_script: |
./tools/scripts/cirrus/setup-$distro.sh
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem 'rake'
gem 'nokogiri', '~> 1.12'
gem 'minitest', '~> 5.15'
gem 'test-unit', '~> 3.5'
gem 'plat4m', '~> 1.0'
gem 'plat4m', '~> 1.1'
group :develop, optional: true do
gem 'ruby_memcheck', '~> 1.2'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/wx/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# This software is released under the MIT license.

module Wx
WXRUBY_VERSION = '1.0.0'
WXRUBY_VERSION = '1.0.1'
end
2 changes: 1 addition & 1 deletion rakelib/gem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do
gem.add_dependency 'rake'
gem.add_dependency 'minitest', '~> 5.15'
gem.add_dependency 'test-unit', '~> 3.5'
gem.add_dependency 'plat4m', '~> 1.0'
gem.add_dependency 'plat4m', '~> 1.1'
gem.rdoc_options <<
'--exclude=\\.dll' <<
'--exclude=\\.so' <<
Expand Down
105 changes: 4 additions & 101 deletions rakelib/lib/config/mingw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
###

require_relative './unixish'
require_relative 'pkgman/mingw'

require 'uri'

Expand All @@ -26,13 +27,6 @@ module Config

module Platform

SWIG_URL = 'https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.0/swigwin-4.2.0.zip/download'
SWIG_ZIP = 'swigwin-4.2.0.zip'

DOXYGEN_URL = 'https://www.doxygen.nl/files/doxygen-1.10.0.windows.x64.bin.zip'

GIT_URL = 'https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/MinGit-2.43.0-64-bit.zip'

def self.included(base)
base.class_eval do
include Config::UnixLike
Expand Down Expand Up @@ -85,71 +79,10 @@ def check_tool_pkgs

def install_prerequisites
pkg_deps = super
unless pkg_deps.empty?
# autoinstall or not?
unless wants_autoinstall?
STDERR.puts <<~__ERROR_TXT
ERROR: This system lacks installed versions of the following required software packages:
#{pkg_deps.join(', ')}
Install these packages and try again.
__ERROR_TXT
exit(1)
end
# if SWIG was not found in the PATH
if pkg_deps.include?('swig')
$stdout.print 'Installing SWIG...' if run_silent?
# download and install SWIG
fname = download_and_install(SWIG_URL, SWIG_ZIP, 'swig.exe')
$stdout.puts 'done!' if run_silent?
Config.instance.log_progress("Installed #{fname}")
set_config('swig', fname)
Config.save
end
# if doxygen was not found in the PATH
if pkg_deps.include?('doxygen')
$stdout.print 'Installing Doxygen...' if run_silent?
# download and install doxygen
fname = download_and_install(DOXYGEN_URL, File.basename(URI(DOXYGEN_URL).path), 'doxygen.exe', 'doxygen')
$stdout.puts 'done!' if run_silent?
Config.instance.log_progress("Installed #{fname}")
set_config('doxygen', fname)
Config.save
end
# if git was not found in the PATH
if pkg_deps.include?('git')
$stdout.print 'Installing Git...' if run_silent?
# download and install doxygen
fname = download_and_install(GIT_URL, File.basename(URI(GIT_URL).path), 'git.exe', 'git')
$stdout.puts 'done!' if run_silent?
Config.instance.log_progress("Installed #{fname}")
set_config('git', fname)
Config.save
end
end
PkgManager.install(pkg_deps)
[]
end

# only called after src gem build
def cleanup_prerequisites
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
path = get_cfg_string('swig')
unless path.empty? || !path.start_with?(tmp_tool_root)
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
rm_rf(path)
end
path = get_cfg_string('doxygen')
unless path.empty? || !path.start_with?(tmp_tool_root)
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
rm_rf(path)
end
path = get_cfg_string('git')
unless path.empty? || !path.start_with?(tmp_tool_root)
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
rm_rf(path)
end
end

def expand(cmd)
super("bash -c \"#{cmd}\"")
end
Expand All @@ -164,38 +97,8 @@ def bash(*cmd, **kwargs)

private

def download_and_install(url, zip, exe, unpack_to=nil)
# make sure the download destination exists
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
dest = unpack_to ? File.join(tmp_tool_root, unpack_to) : File.join(tmp_tool_root, File.basename(zip, '.*'))
mkdir(tmp_tool_root) unless File.directory?(tmp_tool_root)
# download
chdir(tmp_tool_root) do
unless download_file(url, zip)
STDERR.puts "ERROR: Failed to download installation package for #{exe}"
exit(1)
end
# unpack
unless sh("powershell Expand-Archive -LiteralPath '#{zip}' -DestinationPath #{dest} -Force")
STDERR.puts "ERROR: Failed to unpack installation package for #{exe}"
exit(1)
end
# cleanup
rm_f(zip)
end
# find executable
find_exe(dest, exe)
end

def find_exe(path, exe)
fp = Dir.glob(File.join(path, '*')).find { |p| File.file?(p) && File.basename(p) == exe }
unless fp
Dir.glob(File.join(path, '*')).each do |p|
fp = find_exe(p, exe) if File.directory?(p)
return fp if fp
end
end
fp
def wx_configure
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --without-regex --with-expat=builtin --with-zlib=builtin --disable-debug_info')
end

def wx_make
Expand Down
39 changes: 31 additions & 8 deletions rakelib/lib/config/pkgman/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,33 @@ module Platform

module PkgManager

class PlatformDependencies
def initialize(*defaults)
@dependencies = ::Hash.new
@dependencies.default = ::Hash.new(defaults.flatten)
end

def add(distro, *deps, release: nil)
@dependencies[distro] ||= ::Hash.new
if release
@dependencies[distro][release] = deps.flatten
else
@dependencies[distro].default = deps.flatten
end
self
end

def get(distro, release: nil)
@dependencies[distro][release]
end
end

PLATFORM_DEPS = {
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],
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],
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],
arch: %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12]
debian: PlatformDependencies.new(%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])
.add('ubuntu', %w[libgtk-3-dev libwebkit2gtk-4.1-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev], release: '24.04'),
rhel: PlatformDependencies.new(%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]),
suse: PlatformDependencies.new(%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]),
arch: PlatformDependencies.new(%w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12])
}
PLATFORM_ALTS = {
suse: { 'g++' => 'gcc-c++' },
Expand All @@ -41,7 +63,7 @@ def install(pkgs)
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
#{pkgs.join(', ')}
__ERROR_TXT
__ERROR_TXT
exit(1)
end
# can we install?
Expand All @@ -63,7 +85,7 @@ def install(pkgs)
#{pkgs.join(', ')}
Install these packages and try again.
__ERROR_TXT
__ERROR_TXT
exit(1)
end
# do the actual install
Expand All @@ -73,7 +95,7 @@ def install(pkgs)
#{pkgs.join(', ')}
Fix any problems or install these packages yourself and try again.
__ERROR_TXT
__ERROR_TXT
if WXRuby3.config.run_silent?
$stderr.puts "For error details check #{WXRuby3.config.silent_log_name}"
end
Expand All @@ -90,7 +112,8 @@ def pkgman
end

def platform_pkgs
PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym] || []
deps = PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym]
deps ? deps.get(WXRuby3.config.sysinfo.os.distro, release: WXRuby3.config.sysinfo.os.release) : []
end

def add_platform_pkgs(pkgs)
Expand Down
112 changes: 112 additions & 0 deletions rakelib/lib/config/pkgman/mingw.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

###
# wxRuby3 buildtools platform pkg manager base
###

module WXRuby3

module Config

module Platform

module PkgManager

XTRA_PLATFORM_DEPS = %w[python]

class << self

def install(pkgs)
# do we need to install anything?
if !pkgs.empty? || builds_wxwidgets?
# check windows distro compatibility
unless no_autoinstall? || pkgman
# do we need to build wxWidgets?
pkgs.concat(XTRA_PLATFORM_DEPS) if builds_wxwidgets?
$stderr.puts <<~__ERROR_TXT
ERROR: Do not know how to install required packages for distro type '#{WXRuby3.config.sysinfo.os.variant}'.
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
#{pkgs.join(', ')}
__ERROR_TXT
exit(1)
end
# can we install?
unless no_autoinstall? || pkgman
$stderr.puts 'ERROR: Do not know how to check for or install required packages. Please install manually and than try again with `--no-autoinstall`.'
exit(1)
end
# do we need to build wxWidgets?
if builds_wxwidgets?
# add platform specific packages for wxWidgets
pkgs.concat(XTRA_PLATFORM_DEPS)
end
# do we actually have any packages to install?
unless pkgs.empty?
# autoinstall or not?
unless wants_autoinstall?
$stderr.puts <<~__ERROR_TXT
ERROR: This system may lack installed versions of the following required software packages:
#{pkgs.join(', ')}
Install these packages and try again.
__ERROR_TXT
exit(1)
end
# do the actual install
unless run(pkgman.make_install_command(*pkgs))
$stderr.puts <<~__ERROR_TXT
ERROR: Failed to install all or some of the following required software packages:
#{pkgs.join(', ')}
Fix any problems or install these packages yourself and try again.
__ERROR_TXT
if WXRuby3.config.run_silent?
$stderr.puts "For error details check #{WXRuby3.config.silent_log_name}"
end
exit(1)
end
end
end
end

private

def pkgman
@pkgman ||= WXRuby3.config.sysinfo.os.pkgman
end

def builds_wxwidgets?
Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty?
end

def no_autoinstall?
Config.get_config('autoinstall') == false
end

def wants_autoinstall?
WXRuby3.config.wants_autoinstall?
end

def run(cmd)
$stdout.print "Running #{cmd}..."
rc = WXRuby3.config.bash(cmd)
$stderr.puts(rc ? 'done!' : 'FAILED!')
rc
end

def expand(cmd)
`#{is_root? ? '' : 'sudo '}#{cmd}`
end

end

end

end

end

end
5 changes: 5 additions & 0 deletions rakelib/lib/director/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ def process(gendoc: false)
"#{spec.class_name(citem)}::WarpPointer",
"#{spec.class_name(citem)}::AdjustForLayoutDirection",
"#{spec.class_name(citem)}::IsTransparentBackgroundSupported")
if Config.instance.features_set?('USE_ACCESSIBILITY')
if Config.instance.wx_version > '3.2.4'
spec.no_proxy "#{spec.class_name(citem)}::CreateAccessible"
end
end
end
end
if spec.module_name == 'wxWindow'
Expand Down
Loading

0 comments on commit 1ea1e7f

Please sign in to comment.