mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-io: migrate HAL to ports/ directories
Move hal-posix-io and hal-win-io into mruby-io/ports/posix/ and mruby-io/ports/win/. Platform sources are now compiled automatically based on conf.ports setting. Remove HAL auto-detection logic from mrbgem.rake. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
MRuby::Gem::Specification.new('hal-posix-io') do |spec|
|
||||
spec.license = 'MIT'
|
||||
spec.author = 'mruby developers'
|
||||
spec.summary = 'POSIX HAL for mruby-io (Linux, macOS, BSD, Unix)'
|
||||
|
||||
# HAL gem depends on feature gem - brings in mruby-io automatically
|
||||
spec.add_dependency 'mruby-io', core: 'mruby-io'
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
MRuby::Gem::Specification.new('hal-win-io') do |spec|
|
||||
spec.license = 'MIT'
|
||||
spec.author = 'mruby developers'
|
||||
spec.summary = 'Windows HAL for mruby-io (Windows, MinGW)'
|
||||
|
||||
# HAL gem depends on feature gem - brings in mruby-io automatically
|
||||
spec.add_dependency 'mruby-io', core: 'mruby-io'
|
||||
|
||||
# Link Windows socket library
|
||||
spec.linker.libraries << "ws2_32"
|
||||
end
|
||||
@@ -5,30 +5,4 @@ MRuby::Gem::Specification.new('mruby-io') do |spec|
|
||||
|
||||
spec.build.defines << "HAVE_MRUBY_IO_GEM"
|
||||
spec.add_test_dependency 'mruby-time', core: 'mruby-time'
|
||||
|
||||
# Check if HAL gem is loaded
|
||||
# HAL gems must be explicitly specified in build config (recommended) or via auto-selection below
|
||||
spec.build.gems.one? { |g| g.name =~ /^hal-.*-io$/ } or begin
|
||||
# No HAL found - determine appropriate error message or auto-load
|
||||
suggested_hal = if spec.for_windows?
|
||||
'hal-win-io'
|
||||
elsif RUBY_PLATFORM =~ /linux|darwin|bsd/
|
||||
'hal-posix-io'
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
||||
if suggested_hal
|
||||
# Auto-load HAL gem for convenience (for development)
|
||||
# This works because HAL gems declare dependency on mruby-io
|
||||
warn "mruby-io: No HAL specified, loading #{suggested_hal} (explicit selection recommended)"
|
||||
spec.build.gem core: suggested_hal
|
||||
else
|
||||
# Unknown platform - fail with helpful message
|
||||
fail "mruby-io: No HAL available for platform '#{RUBY_PLATFORM}'.\n" \
|
||||
"Please specify HAL gem explicitly in your build config:\n" \
|
||||
" conf.gem core: 'hal-posix-io' # For Linux/macOS/BSD\n" \
|
||||
" conf.gem core: 'hal-win-io' # For Windows"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -571,21 +571,3 @@ mrb_hal_io_final(mrb_state *mrb)
|
||||
(void)mrb;
|
||||
/* No special cleanup needed for POSIX */
|
||||
}
|
||||
|
||||
/*
|
||||
* Gem initialization
|
||||
*/
|
||||
|
||||
void
|
||||
mrb_hal_posix_io_gem_init(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* HAL interface functions are called by mruby-io gem */
|
||||
}
|
||||
|
||||
void
|
||||
mrb_hal_posix_io_gem_final(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* Cleanup handled by mrb_hal_io_final called from mruby-io */
|
||||
}
|
||||
@@ -618,21 +618,3 @@ mrb_hal_io_final(mrb_state *mrb)
|
||||
/* Cleanup Winsock */
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
/*
|
||||
* Gem initialization
|
||||
*/
|
||||
|
||||
void
|
||||
mrb_hal_win_io_gem_init(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* HAL interface functions are called by mruby-io gem */
|
||||
}
|
||||
|
||||
void
|
||||
mrb_hal_win_io_gem_final(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* Cleanup handled by mrb_hal_io_final called from mruby-io */
|
||||
}
|
||||
Reference in New Issue
Block a user