This updates Ruby 4.0 to the latest patch release. Release notes at
https://www.ruby-lang.org/en/news/2026/05/11/ruby-4-0-4-released/
Ports-wise, this uses a patch to remove a non-ASCII character in a
comment, as otherwise the build breaks during rdoc generation. A
fix has already been merged upstream, so this will only be needed
temporarily.
Tested on amd64. Will be committing in a couple days unless I hear
objections.
Best,
Jeremy
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/Makefile,v
diff -u -p -u -p -r1.9 Makefile
--- Makefile 8 May 2026 04:11:42 -0000 1.9
+++ Makefile 12 May 2026 05:48:07 -0000
@@ -1,4 +1,4 @@
-VERSION = 4.0.3
+VERSION = 4.0.4
DISTNAME = ruby-${VERSION}
PKGNAME-main = ruby-${VERSION}
PKGNAME-ri_docs = ruby${BINREV}-ri_docs-${VERSION}
@@ -7,8 +7,7 @@ NEXTVER = 4.1
PKGSPEC-main ?= ruby->=4.0.0beta0,<${NEXTVER}
SITES.rubygems = https://github.com/ruby/rubygems/commit/
-PATCHFILES.p =
ruby-box-test-fix{099da884fe95ccf6c684a1563ed1c4b0fd8e1196}.patch
-PATCHFILES.rubygems =
ruby402-gem-fix{60e7365256ddd055b3cc59a28c2288b37ad6bf29}.patch
+PATCHFILES.p =
ruby-box-test-fix{099da884fe95ccf6c684a1563ed1c4b0fd8e1196}.patch
PSEUDO_FLAVORS= no_ri_docs bootstrap
# Do not build the RI docs on slow arches
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/distinfo,v
diff -u -p -u -p -r1.4 distinfo
--- distinfo 8 May 2026 04:11:42 -0000 1.4
+++ distinfo 12 May 2026 05:48:01 -0000
@@ -1,6 +1,4 @@
-SHA256 (ruby-4.0.3.tar.gz) = d5ZKzDcNXIN1uVAuW6bBPAPvkaueufUhyE+0K5yaaw8=
+SHA256 (ruby-4.0.4.tar.gz) = 819u36Pauz9yP50M8ZBsZRKud/TkEqseaMxukdIw+oA=
SHA256 (ruby-box-test-fix.patch) = GbHsCPL9ZNdpXZl62mqghVbwkVoqKj6H3KtVJOoSrdk=
-SHA256 (ruby402-gem-fix.patch) = KyimCdjFgcYMTU1LJvA0SW/Wrj9IG5Ip/MumzjafhA8=
-SIZE (ruby-4.0.3.tar.gz) = 23806898
+SIZE (ruby-4.0.4.tar.gz) = 23816838
SIZE (ruby-box-test-fix.patch) = 1047
-SIZE (ruby402-gem-fix.patch) = 2248
Index: patches/patch-class_c
===================================================================
RCS file: patches/patch-class_c
diff -N patches/patch-class_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-class_c 12 May 2026 05:51:11 -0000
@@ -0,0 +1,19 @@
+Remove non-ASCII comments
+
+This fixes the build when trying to generate the rdoc.
+
+Index: class.c
+--- class.c.orig
++++ class.c
+@@ -705,9 +705,9 @@ static VALUE
+ class_associate_super(VALUE klass, VALUE super, bool init)
+ {
+ if (super && !UNDEF_P(super)) {
+- // Only maintain subclass lists for T_CLASS???T_CLASS relationships.
++ // Only maintain subclass lists for T_CLASS->T_CLASS relationships.
+ // Include/prepend inserts ICLASSes into the super chain, but T_CLASS
+- // subclass lists should track only the immutable T_CLASS???T_CLASS
link.
++ // subclass lists should track only the immutable T_CLASS->T_CLASS
link.
+ if (RB_TYPE_P(klass, T_CLASS) && RB_TYPE_P(super, T_CLASS)) {
+ class_switch_superclass(super, klass);
+ }
Index: patches/patch-compile_c
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/patches/patch-compile_c,v
diff -u -p -u -p -r1.2 patch-compile_c
--- patches/patch-compile_c 20 Jan 2026 13:03:11 -0000 1.2
+++ patches/patch-compile_c 12 May 2026 05:26:30 -0000
@@ -18,7 +18,7 @@ Index: compile.c
again:
optimize_checktype(iseq, iobj);
-@@ -14436,8 +14440,11 @@ static VALUE
+@@ -14438,8 +14442,11 @@ static VALUE
ibf_load_object_complex_rational(const struct ibf_load *load, const struct
ibf_object_header *header, ibf_offset_t offset)
{
const struct ibf_object_complex_rational *nums = IBF_OBJBODY(struct
ibf_object_complex_rational, offset);
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/patches/patch-configure,v
diff -u -p -u -p -r1.1.1.1 patch-configure
--- patches/patch-configure 27 Dec 2025 16:25:13 -0000 1.1.1.1
+++ patches/patch-configure 12 May 2026 05:26:26 -0000
@@ -19,7 +19,7 @@ Index: configure
do :
# Try these flags in the _prepended_ position - i.e. we want
to try building a program
-@@ -31848,7 +31848,7 @@ main (void)
+@@ -31845,7 +31845,7 @@ main (void)
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
@@ -28,7 +28,7 @@ Index: configure
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: -A -n" >&5
-@@ -32396,7 +32396,7 @@ fi
+@@ -32393,7 +32393,7 @@ fi
;; #(
openbsd*|mirbsd*) :
@@ -37,7 +37,7 @@ Index: configure
;; #(
solaris*) :
-@@ -34645,7 +34645,7 @@ then :
+@@ -34642,7 +34642,7 @@ then :
else $as_nop
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/pkg/PLIST-main,v
diff -u -p -u -p -r1.4 PLIST-main
--- pkg/PLIST-main 8 May 2026 04:11:42 -0000 1.4
+++ pkg/PLIST-main 12 May 2026 06:04:16 -0000
@@ -462,6 +462,7 @@ lib/ruby/${REV}/bundler/templates/newgem
lib/ruby/${REV}/bundler/templates/newgem/ext/
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/Cargo.toml.tt
+lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/build.rs.tt
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt
@@ -474,6 +475,7 @@ lib/ruby/${REV}/bundler/templates/newgem
lib/ruby/${REV}/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
lib/ruby/${REV}/bundler/templates/newgem/github/
lib/ruby/${REV}/bundler/templates/newgem/github/workflows/
+lib/ruby/${REV}/bundler/templates/newgem/github/workflows/build-gems.yml.tt
lib/ruby/${REV}/bundler/templates/newgem/github/workflows/main.yml.tt
lib/ruby/${REV}/bundler/templates/newgem/gitignore.tt
lib/ruby/${REV}/bundler/templates/newgem/gitlab-ci.yml.tt
@@ -1451,10 +1453,10 @@ lib/ruby/gems/${REV}/gems/bigdecimal-4.0
lib/ruby/gems/${REV}/gems/bigdecimal-4.0.1/sample/linear.rb
lib/ruby/gems/${REV}/gems/bigdecimal-4.0.1/sample/nlsolve.rb
lib/ruby/gems/${REV}/gems/bigdecimal-4.0.1/sample/pi.rb
-lib/ruby/gems/${REV}/gems/bundler-4.0.6/
-lib/ruby/gems/${REV}/gems/bundler-4.0.6/exe/
-lib/ruby/gems/${REV}/gems/bundler-4.0.6/exe/bundle
-lib/ruby/gems/${REV}/gems/bundler-4.0.6/exe/bundler
+lib/ruby/gems/${REV}/gems/bundler-4.0.10/
+lib/ruby/gems/${REV}/gems/bundler-4.0.10/exe/
+lib/ruby/gems/${REV}/gems/bundler-4.0.10/exe/bundle
+lib/ruby/gems/${REV}/gems/bundler-4.0.10/exe/bundler
lib/ruby/gems/${REV}/gems/csv-3.3.5/
lib/ruby/gems/${REV}/gems/csv-3.3.5/LICENSE.txt
lib/ruby/gems/${REV}/gems/csv-3.3.5/NEWS.md
@@ -3469,7 +3471,7 @@ lib/ruby/gems/${REV}/specifications/bigd
lib/ruby/gems/${REV}/specifications/csv-3.3.5.gemspec
lib/ruby/gems/${REV}/specifications/debug-1.11.1.gemspec
lib/ruby/gems/${REV}/specifications/default/
-lib/ruby/gems/${REV}/specifications/default/bundler-4.0.6.gemspec
+lib/ruby/gems/${REV}/specifications/default/bundler-4.0.10.gemspec
lib/ruby/gems/${REV}/specifications/default/date-3.5.1.gemspec
lib/ruby/gems/${REV}/specifications/default/delegate-0.6.1.gemspec
lib/ruby/gems/${REV}/specifications/default/did_you_mean-2.0.0.gemspec
Index: pkg/PLIST-ri_docs
===================================================================
RCS file: /cvs/ports/lang/ruby/4.0/pkg/PLIST-ri_docs,v
diff -u -p -u -p -r1.3 PLIST-ri_docs
--- pkg/PLIST-ri_docs 20 Mar 2026 01:39:32 -0000 1.3
+++ pkg/PLIST-ri_docs 12 May 2026 06:04:36 -0000
@@ -2032,6 +2032,8 @@ share/ri/${REV}/system/Gem/Commands/Sign
share/ri/${REV}/system/Gem/Commands/SignoutCommand/execute-i.ri
share/ri/${REV}/system/Gem/Commands/SignoutCommand/new-c.ri
share/ri/${REV}/system/Gem/Commands/SourcesCommand/
+share/ri/${REV}/system/Gem/Commands/SourcesCommand/build_new_source-i.ri
+share/ri/${REV}/system/Gem/Commands/SourcesCommand/build_source-i.ri
share/ri/${REV}/system/Gem/Commands/SourcesCommand/cdesc-SourcesCommand.ri
share/ri/${REV}/system/Gem/Commands/SourcesCommand/check_typo_squatting-i.ri
share/ri/${REV}/system/Gem/Commands/SourcesCommand/config_file_name-i.ri
@@ -3880,6 +3882,7 @@ share/ri/${REV}/system/Gem/Version/appro
share/ri/${REV}/system/Gem/Version/bump-i.ri
share/ri/${REV}/system/Gem/Version/canonical_segments-i.ri
share/ri/${REV}/system/Gem/Version/cdesc-Version.ri
+share/ri/${REV}/system/Gem/Version/compute_sort_key-i.ri
share/ri/${REV}/system/Gem/Version/correct%3f-c.ri
share/ri/${REV}/system/Gem/Version/create-c.ri
share/ri/${REV}/system/Gem/Version/eql%3f-i.ri