20 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 43c0b50cbd mruby-socket: implement Socket.ip_address_list
Returns an Array of Addrinfo objects for all local IP addresses
(IPv4 and IPv6) on every network interface, matching CRuby's API.

Backed by getifaddrs(3) on POSIX and GetAdaptersAddresses on
Windows (requires iphlpapi.lib, added to the Windows linker libs).
The HAL returns binary sockaddr strings; src/socket.c wraps each
into Addrinfo so the wrapping code stays platform-agnostic.

Resolves the second error reported in #5659 (after the IO.select
fix from the HAL split): "undefined method 'ip_address_list' for
Class". Issue #5659 itself is closed; this lands the missing API.

Ref #5659.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-09 10:22:19 +09:00
Yukihiro "Matz" Matsumoto 22df8d61be mruby-socket: restore Windows link libraries dropped during HAL migration
Commit d9e107c801 ("mruby-socket: migrate HAL to ports/ directories")
moved the Windows HAL source into mruby-socket/ports/win/ but dropped
the linker.libraries declarations that previously lived in
hal-win-socket/mrbgem.rake. Both mingw and MSVC builds now fail to
link with undefined references to WSAStartup, socket, send, and other
Winsock APIs. Re-declare wsock32 and ws2_32 under a for_windows? guard.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 23:16:02 +09:00
Yukihiro "Matz" Matsumoto d9e107c801 mruby-socket: migrate HAL to ports/ directories
Move hal-posix-socket and hal-win-socket into
mruby-socket/ports/posix/ and mruby-socket/ports/win/.
Remove HAL auto-detection logic from mrbgem.rake.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 19:25:37 +09:00
Yukihiro "Matz" Matsumoto ad51bf848b mrbgem.rake: simplify hal selection logic
remove redundant visualcpp and mingw checks since for_windows? already
detects all windows builds including visual c++ and mingw.

ref #6653

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 11:11:27 +09:00
dearblue ea215bc19c Fixed HAL auto-detection order
Because MinGW was not recognized as Windows during cross-builds.
2025-10-25 21:06:16 +09:00
Yukihiro "Matz" Matsumoto 917add467b mruby-socket: use hal-win-socket for mingw
mingw uses winsock2 instead of posix sockets (sys/socket.h). removed
mingw from linux/bsd pattern to let for_windows? predicate select
hal-win-socket instead.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-16 22:45:19 +09:00
Yukihiro "Matz" Matsumoto feca90ceab hal: fix selection to use toolchain instead of RUBY_PLATFORM
when building with MSVC on Windows, RUBY_PLATFORM (from the Ruby
installation running rake) may indicate "mingw" if Ruby was installed
via RubyInstaller, causing incorrect selection of POSIX HALs instead
of Windows HALs.

fixed by checking spec.build.primary_toolchain first:
- if toolchain is "visualcpp", select Windows HALs
- otherwise fall through to existing platform checks

this ensures MSVC builds use hal-win-* gems even when Ruby itself
was installed with MinGW.

affected gems:
- mruby-dir
- mruby-io
- mruby-socket
- mruby-task

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-16 18:20:32 +09:00
Yukihiro "Matz" Matsumoto 0524526e41 mruby-socket: introduce HAL for platform abstraction
separate platform-specific socket operations into HAL implementations
for POSIX (Linux/macOS/BSD/Unix) and Windows platforms to improve
portability and maintainability

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-15 17:26:40 +09:00
Yukihiro "Matz" Matsumoto 1d7c00e920 mruby-socket/socket.c: implement whole Socket::Option class in C
`mruby-pack` gem no longer needed.
2023-08-15 15:29:36 +09:00
Yukihiro "Matz" Matsumoto 9d370e0851 mruby-socket/socket.c: ensure struct addrinfo to be freed
Instead of referring the last addrinfo via Addrinfo's class variable, we
use `mrb_ensure()` from `mruby-error` gem.
2023-08-09 13:51:25 +09:00
John Bampton 63e170170e mrbgems: standardize spec.authors for whitespace and author name 2023-05-06 06:06:29 +10:00
dearblue 9a84ef926b Avoid adding MRUBY_ROOT/src to cc.include_paths 2022-07-02 09:56:13 +09:00
Yukihiro "Matz" Matsumoto 1a3846b492 mrbgem.rake: avoid implicit receivers in mrbgem.rake. 2021-04-13 07:35:39 +09:00
Reckordp 707933aa8e Helper for link window's library 2020-04-03 20:34:00 +07:00
Reckordp 7c85a1ff07 Increase flexibility of CrossBuild 2020-03-08 14:23:55 +07:00
dearblue 56de911b7a Add "mruby developers" into some gems; Resolve #4709
It is writing side by side with the original authors.
2019-12-09 23:49:03 +09:00
Tomoyuki Sahara 2eeac91098 set sockaddr_un.sun_len on the systems that have sockaddr.sa_len.
If your system has sa_len but is not BSD-derived, define HAVE_SA_LEN=1
on mrbgem.rake or build_config.rb.
2018-06-14 13:36:01 +09:00
MATSUMOTO, Ryosuke 6ae4fb707a Depend mruby-io and mruby-pack in mruby core 2018-02-03 14:57:12 +09:00
Hiroshi Mimaki 584e4e413a Added mrbgem's summary. 2017-12-13 16:05:06 +09:00
Yukihiro "Matz" Matsumoto 73ef548c63 Add 'mrbgems/mruby-socket/' from commit 'ab54185005ec87fe4f5b10df95ad29659884141b'
git-subtree-dir: mrbgems/mruby-socket
git-subtree-mainline: d75266dd1b
git-subtree-split: ab54185005
2017-12-07 18:11:13 +09:00