mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-dir: migrate HAL to ports/ directories
Move hal-posix-dir and hal-win-dir into mruby-dir/ports/posix/ and mruby-dir/ports/win/. Remove HAL auto-detection logic from mrbgem.rake. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
MRuby::Gem::Specification.new('hal-posix-dir') do |spec|
|
||||
spec.license = 'MIT'
|
||||
spec.authors = 'mruby developers'
|
||||
spec.summary = 'POSIX HAL for mruby-dir (Linux, macOS, BSD, Unix)'
|
||||
|
||||
spec.add_dependency 'mruby-dir', core: 'mruby-dir'
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
MRuby::Gem::Specification.new('hal-win-dir') do |spec|
|
||||
spec.license = 'MIT and MIT-like license'
|
||||
spec.authors = ['mruby developers', 'Kevlin Henney']
|
||||
spec.summary = 'Windows HAL for mruby-dir'
|
||||
|
||||
spec.add_dependency 'mruby-dir', core: 'mruby-dir'
|
||||
end
|
||||
@@ -1,35 +1,4 @@
|
||||
MRuby::Gem::Specification.new('mruby-dir') do |spec|
|
||||
spec.license = 'MIT and MIT-like license'
|
||||
spec.authors = ['Internet Initiative Japan Inc.', 'Kevlin Henney']
|
||||
|
||||
# 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-.*-dir$/ } or begin
|
||||
# No HAL found - determine appropriate error message or auto-load
|
||||
suggested_hal = if ENV['MRUBY_DIR_HAL']
|
||||
ENV['MRUBY_DIR_HAL']
|
||||
elsif spec.for_windows?
|
||||
'hal-win-dir'
|
||||
elsif RUBY_PLATFORM =~ /linux|darwin|bsd/
|
||||
'hal-posix-dir'
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
||||
if suggested_hal
|
||||
# Auto-load HAL gem for convenience (for development)
|
||||
# This works because HAL gems declare dependency on mruby-dir
|
||||
warn "mruby-dir: No HAL specified, loading #{suggested_hal} (explicit selection recommended)"
|
||||
spec.build.gem core: suggested_hal
|
||||
else
|
||||
# Unknown platform - fail with helpful message
|
||||
fail "mruby-dir: No HAL available for platform '#{RUBY_PLATFORM}'.\n" \
|
||||
"Please specify HAL gem explicitly in your build config:\n" \
|
||||
" conf.gem core: 'hal-posix-dir' # For Linux/macOS/BSD\n" \
|
||||
" conf.gem core: 'hal-win-dir' # For Windows\n" \
|
||||
"Or set environment variable:\n" \
|
||||
" MRUBY_DIR_HAL=hal-myplatform-dir\n" \
|
||||
"See mrbgems/mruby-dir/README.md for creating custom HAL."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -173,21 +173,3 @@ mrb_hal_dir_final(mrb_state *mrb)
|
||||
(void)mrb;
|
||||
/* No cleanup needed for POSIX */
|
||||
}
|
||||
|
||||
/*
|
||||
* Gem initialization
|
||||
*/
|
||||
|
||||
void
|
||||
mrb_hal_posix_dir_gem_init(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* HAL interface functions are called by mruby-dir gem */
|
||||
}
|
||||
|
||||
void
|
||||
mrb_hal_posix_dir_gem_final(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* Cleanup handled by mrb_hal_dir_final called from mruby-dir */
|
||||
}
|
||||
@@ -214,36 +214,3 @@ mrb_hal_dir_final(mrb_state *mrb)
|
||||
(void)mrb;
|
||||
/* No cleanup needed for Windows */
|
||||
}
|
||||
|
||||
/*
|
||||
* Gem initialization
|
||||
*/
|
||||
|
||||
void
|
||||
mrb_hal_win_dir_gem_init(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* HAL interface functions are called by mruby-dir gem */
|
||||
}
|
||||
|
||||
void
|
||||
mrb_hal_win_dir_gem_final(mrb_state *mrb)
|
||||
{
|
||||
(void)mrb;
|
||||
/* Cleanup handled by mrb_hal_dir_final called from mruby-dir */
|
||||
}
|
||||
|
||||
/*
|
||||
** Portions derived from dirent.c by Kevlin Henney:
|
||||
**
|
||||
** Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.
|
||||
**
|
||||
** Permission to use, copy, modify, and distribute this software and its
|
||||
** documentation for any purpose is hereby granted without fee, provided
|
||||
** that this copyright and permissions notice appear in all copies and
|
||||
** derivatives.
|
||||
**
|
||||
** This software is supplied "as is" without express or implied warranty.
|
||||
**
|
||||
** But that said, if there are any problems please get in touch.
|
||||
*/
|
||||
Reference in New Issue
Block a user