aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-05-29 13:20:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-06-04 16:21:24 +0000
commiteff4307ac72a9630c67d030e0565fde34ff82d7d (patch)
tree47c90818daa1fb3b75d9467fc79c49932e3596c9
parentc7753b07bba7d1a4d1b60c8e83758ef25d909cc5 (diff)
downloadports-eff4307ac72a9630c67d030e0565fde34ff82d7d.tar.gz
ports-eff4307ac72a9630c67d030e0565fde34ff82d7d.zip
graphics/rubygem-cairo: fix build with clang 16
Clang 16 has a new error about incompatible function types, which shows up when building graphics/rubygem-cairo: rb_cairo_surface.c:2354:3: error: incompatible function pointer types passing 'VALUE (int, VALUE *, VALUE)' (aka 'unsigned long (int, unsigned long *, unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types] rb_define_method (rb_cCairo_GLSurface, "initialize", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method' #define rb_define_method(klass, mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity)) ^~~~~~ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *) ^ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL' RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \ ^ rb_cairo_surface.c:2368:3: error: incompatible function pointer types passing 'VALUE (int, VALUE *, VALUE)' (aka 'unsigned long (int, unsigned long *, unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types] rb_define_method (rb_cCairo_GLTextureSurface, "initialize", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method' #define rb_define_method(klass, mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity)) ^~~~~~ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *) ^ /usr/local/include/ruby-3.1/ruby/internal/anyargs.h:255:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL' RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _01(__VA_ARGS__, VALUE(*)(VALUE, VALUE), int); \ ^ This is because rb_define_method's last argument is the 'arity' of the method, and in case of cr_gl_surface_initialize() and cr_gl_texture_surface_initialize() it should be -1 to indicate a variable number of arguments. PR: 271706 Approved by: portmgr (buildfix blanket) MFH: 2023Q2
-rw-r--r--graphics/rubygem-cairo/Makefile1
-rw-r--r--graphics/rubygem-cairo/files/patch-ext_cairo_rb__cairo__surface.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/graphics/rubygem-cairo/Makefile b/graphics/rubygem-cairo/Makefile
index 22e38a2fb449..38fb76c950a8 100644
--- a/graphics/rubygem-cairo/Makefile
+++ b/graphics/rubygem-cairo/Makefile
@@ -1,5 +1,6 @@
PORTNAME= cairo
PORTVERSION= 1.17.8
+PORTREVISION= 1
CATEGORIES= graphics rubygems
MASTER_SITES= RG
diff --git a/graphics/rubygem-cairo/files/patch-ext_cairo_rb__cairo__surface.c b/graphics/rubygem-cairo/files/patch-ext_cairo_rb__cairo__surface.c
new file mode 100644
index 000000000000..7ef565a13712
--- /dev/null
+++ b/graphics/rubygem-cairo/files/patch-ext_cairo_rb__cairo__surface.c
@@ -0,0 +1,20 @@
+--- ext/cairo/rb_cairo_surface.c.orig 2023-05-29 13:00:29 UTC
++++ ext/cairo/rb_cairo_surface.c
+@@ -2352,7 +2352,7 @@ Init_cairo_surface (void)
+ rb_define_class_under (rb_mCairo, "GLTextureSurface", rb_cCairo_GLSurface);
+ #ifdef RB_CAIRO_HAS_GL_SURFACE
+ rb_define_method (rb_cCairo_GLSurface, "initialize",
+- cr_gl_surface_initialize, 1);
++ cr_gl_surface_initialize, -1);
+
+ rb_define_method (rb_cCairo_GLSurface, "set_size",
+ cr_gl_surface_set_size, 2);
+@@ -2366,7 +2366,7 @@ Init_cairo_surface (void)
+ RB_CAIRO_DEF_SETTERS (rb_cCairo_GLSurface);
+
+ rb_define_method (rb_cCairo_GLTextureSurface, "initialize",
+- cr_gl_texture_surface_initialize, 1);
++ cr_gl_texture_surface_initialize, -1);
+
+ RB_CAIRO_DEF_SETTERS (rb_cCairo_GLTextureSurface);
+ #endif