Download raw body.
qtwebkit: Allow building with current Ruby
> On Sat, Oct 5, 2024 at 10:03 AM Jeremy Evans <jeremy@openbsd.org> wrote:
>
> > This allows building qtwebkit the current default ports version of
> > Ruby. This is a necessary step to remove Ruby 3.1.
> >
> > No RDEP on ruby means this is only a build system change, not a
> > package change, so no bump is needed.
Cc rsadowski, who is maintainer of x11/qt5/*.
jeremy's parser.rb patch works for me. I looked at webkit in
https://repology.org/ and noticed that some Linux distros use a patch
from upstream webkit (https://commits.webkit.org/219400@main). I
swapped in that patch, which also works for me. With either patch, I
can package qtwebkit-5.212.0alpha4p13v0 on my amd64 with Ruby 3.3 and
without Ruby 3.1.
The problem is a change to operator =~ in Ruby 3.2. If @tokens[@idx]
was in the wrong class, then "@tokens[@idx] =~ final" was false in 3.1
but raised an error in 3.2. jeremy's patch fixes it by defining
Object#=~ to be false. Upstream's patch is less complete; it moves up
1 of 3 checks for "@tokens[@idx].is_a? Annotation", fixing only 1 of 3
"=~"s. The other 2 "=~"s might still raise an error, but they didn't
break my build.
jeremy's patch also redefines String#=~ in a way that would break the
match variables like $& and $1, but didn't break my qtwebkit build.
If we pick jeremy's patch and it builds without the String#=~ part,
ok gkoehler@
If we pick upstream's patch, ok gkoehler@
Upstream's patch is
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/qt5/qtwebkit/Makefile,v
diff -u -p -r1.47 Makefile
--- Makefile 24 Oct 2024 08:54:32 -0000 1.47
+++ Makefile 13 Nov 2024 23:02:55 -0000
@@ -53,7 +53,6 @@ ALL_TARGET =
MODPY_RUNDEP = No
MODRUBY_RUNDEP = No
-MODRUBY_REV = 3.1
BUILD_DEPENDS = devel/bison \
devel/gperf \
Index: patches/patch-Source_JavaScriptCore_offlineasm_parser_rb
===================================================================
RCS file: patches/patch-Source_JavaScriptCore_offlineasm_parser_rb
diff -N patches/patch-Source_JavaScriptCore_offlineasm_parser_rb
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_JavaScriptCore_offlineasm_parser_rb 13 Nov 2024 23:02:55 -0000
@@ -0,0 +1,26 @@
+Work with Ruby 3.2+
+https://commits.webkit.org/219400@main
+
+Index: Source/JavaScriptCore/offlineasm/parser.rb
+--- Source/JavaScriptCore/offlineasm/parser.rb.orig
++++ Source/JavaScriptCore/offlineasm/parser.rb
+@@ -584,9 +584,7 @@ class Parser
+ firstCodeOrigin = @tokens[@idx].codeOrigin
+ list = []
+ loop {
+- if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
+- break
+- elsif @tokens[@idx].is_a? Annotation
++ if @tokens[@idx].is_a? Annotation
+ # This is the only place where we can encounter a global
+ # annotation, and hence need to be able to distinguish between
+ # them.
+@@ -600,6 +598,8 @@ class Parser
+ list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string)
+ @annotation = nil
+ @idx += 2 # Consume the newline as well.
++ elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
++ break
+ elsif @tokens[@idx] == "\n"
+ # ignore
+ @idx += 1
qtwebkit: Allow building with current Ruby