pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/graphics/ruby-gd graphics/ruby-gd: fix build problem w...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3a27395e14d0
branches:  trunk
changeset: 446935:3a27395e14d0
user:      taca <taca%pkgsrc.org@localhost>
date:      Sun Feb 14 14:59:38 2021 +0000

description:
graphics/ruby-gd: fix build problem with Ruby 3.0

Use more modern Ruby API.

diffstat:

 graphics/ruby-gd/distinfo         |    4 +-
 graphics/ruby-gd/patches/patch-aa |  214 +++++++++++++++++++++----------------
 2 files changed, 122 insertions(+), 96 deletions(-)

diffs (truncated from 707 to 300 lines):

diff -r 1f72eeba881c -r 3a27395e14d0 graphics/ruby-gd/distinfo
--- a/graphics/ruby-gd/distinfo Sun Feb 14 14:58:20 2021 +0000
+++ b/graphics/ruby-gd/distinfo Sun Feb 14 14:59:38 2021 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.8 2015/11/03 21:34:19 agc Exp $
+$NetBSD: distinfo,v 1.9 2021/02/14 14:59:38 taca Exp $
 
 SHA1 (ruby-gd-0.8.0.gem) = a38a2eaa786afd1ad1fe56961ff7168e8fab7996
 RMD160 (ruby-gd-0.8.0.gem) = 73369970a3ae17feda1b428c19e0bc8bb52d05dc
 SHA512 (ruby-gd-0.8.0.gem) = c108ab54a88e52599bcb8189230db0c7291297f5361e7ac55d3eaf82e3ab1330b06421bb87e206eec5e3ef21464d525f738481775dab5e17f12570a78b0b00c0
 Size (ruby-gd-0.8.0.gem) = 41984 bytes
-SHA1 (patch-aa) = eb761593b7fbbe04df46eac8e868f6f4d301345f
+SHA1 (patch-aa) = b6d022408ee70de53fb5aad87b6cbc673978e840
diff -r 1f72eeba881c -r 3a27395e14d0 graphics/ruby-gd/patches/patch-aa
--- a/graphics/ruby-gd/patches/patch-aa Sun Feb 14 14:58:20 2021 +0000
+++ b/graphics/ruby-gd/patches/patch-aa Sun Feb 14 14:59:38 2021 +0000
@@ -1,34 +1,22 @@
-$NetBSD: patch-aa,v 1.2 2014/03/17 14:12:10 taca Exp $
+$NetBSD: patch-aa,v 1.3 2021/02/14 14:59:38 taca Exp $
 
-Support both Ruby 1.8 and Ruby 1.9.
+Support modern Ruby API.
 
---- GD.c.orig  2014-03-11 11:19:58.000000000 +0000
+--- GD.c.orig  2021-01-11 07:41:51.880067934 +0000
 +++ GD.c
-@@ -11,7 +11,23 @@
+@@ -11,6 +11,9 @@
  **************************************************************/
  #include "ruby.h"
-+#ifdef HAVE_RUBY_IO_H         /* Ruby 1.9 and later */
-+
+-#include "rubyio.h"
+-#include "version.h"
 +#include "ruby/io.h"
 +#include "ruby/version.h"
 +
 +#define RB_IO_PATH(iot)               (RSTRING_PTR((iot)->pathv))
 +#define RB_IO_FILE(iot)               rb_io_stdio_file((iot))
-+
-+#else                         /* Ruby 1.8.x */
-+
- #include "rubyio.h"
- #include "version.h"
  
-+#define rb_io_stdio_file(iot) ((iot)->f)
-+#define RB_IO_PATH(iot)               ((iot)->path)
-+#define RB_IO_FILE(iot)               (((iot)->f2)? (iot)->f2: (iot)->f)
-+
-+#endif
-+
  #include "gd.h"
- #include "gdfontg.h"          /* giant */
-@@ -63,17 +79,17 @@ img_from_pngfname(klass, fname)
+@@ -63,17 +66,17 @@ img_from_pngfname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -50,14 +38,14 @@
 +          rb_raise(rb_eArgError, "%s is not a valid PNG File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -85,5 +101,5 @@ img_from_png(klass, f)
+@@ -85,5 +88,5 @@ img_from_png(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -93,7 +109,7 @@ img_from_png(klass, f)
+@@ -93,7 +96,7 @@ img_from_png(klass, f)
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromPng(fptr->f);
@@ -67,7 +55,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid PNG File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -106,17 +122,17 @@ img_from_giffname(klass, fname)
+@@ -106,17 +109,17 @@ img_from_giffname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -89,14 +77,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid GIF File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -127,5 +143,5 @@ img_from_gif(klass, f)
+@@ -127,5 +130,5 @@ img_from_gif(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -135,7 +151,7 @@ img_from_gif(klass, f)
+@@ -135,7 +138,7 @@ img_from_gif(klass, f)
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromGif(fptr->f);
@@ -106,7 +94,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid GIF File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -148,17 +164,17 @@ img_from_gdfname(klass, fname)
+@@ -148,17 +151,17 @@ img_from_gdfname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -128,14 +116,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -169,5 +185,5 @@ img_from_gd(klass, f)
+@@ -169,5 +172,5 @@ img_from_gd(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -177,7 +193,7 @@ img_from_gd(klass, f)
+@@ -177,7 +180,7 @@ img_from_gd(klass, f)
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromGd(fptr->f);
@@ -145,7 +133,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd File", RB_IO_PATH(fptr));
      return Data_Wrap_Struct(klass,0,free_img,iptr);
  }
-@@ -188,17 +204,17 @@ img_from_gd2fname(klass, fname)
+@@ -188,17 +191,17 @@ img_from_gd2fname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -167,14 +155,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -209,5 +225,5 @@ img_from_gd2(klass, f)
+@@ -209,5 +212,5 @@ img_from_gd2(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -217,7 +233,7 @@ img_from_gd2(klass, f)
+@@ -217,7 +220,7 @@ img_from_gd2(klass, f)
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromGd2(fptr->f);
@@ -184,7 +172,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr));
      
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -229,18 +245,18 @@ img_from_gd2_partfname(klass, fname, src
+@@ -229,18 +232,18 @@ img_from_gd2_partfname(klass, fname, src
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -207,14 +195,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -251,5 +267,5 @@ img_from_gd2_part(klass, f, srcx, srcy, 
+@@ -251,5 +254,5 @@ img_from_gd2_part(klass, f, srcx, srcy, 
      VALUE klass, f, srcx, srcy, w, h;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -259,8 +275,8 @@ img_from_gd2_part(klass, f, srcx, srcy, 
+@@ -259,8 +262,8 @@ img_from_gd2_part(klass, f, srcx, srcy, 
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromGd2Part(fptr->f, NUM2INT(srcx),
@@ -225,14 +213,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr));
      
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -272,5 +288,5 @@ img_from_xbm(klass, f)
+@@ -272,5 +275,5 @@ img_from_xbm(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -280,7 +296,7 @@ img_from_xbm(klass, f)
+@@ -280,7 +283,7 @@ img_from_xbm(klass, f)
      rb_io_check_readable(fptr);
  
 -    iptr = gdImageCreateFromXbm(fptr->f);
@@ -242,7 +230,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Xbm File", RB_IO_PATH(fptr));
  
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -292,17 +308,17 @@ img_from_xbmfname(klass, fname)
+@@ -292,17 +295,17 @@ img_from_xbmfname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -264,14 +252,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Xbm File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -314,5 +330,5 @@ img_from_xpm(klass, f)
+@@ -314,5 +317,5 @@ img_from_xpm(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -323,7 +339,7 @@ img_from_xpm(klass, f)
+@@ -323,7 +326,7 @@ img_from_xpm(klass, f)
  
      /* need cast, and the argument is char* type */
 -    iptr = (gdImagePtr)gdImageCreateFromXpm(fptr->path);
@@ -281,7 +269,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid XPM File", RB_IO_PATH(fptr));
  
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -335,10 +351,10 @@ img_from_xpmfname(klass, fname)
+@@ -335,10 +338,10 @@ img_from_xpmfname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -294,7 +282,7 @@
 +    f = rb_file_open(StringValuePtr(fname), "r");
      rb_io_binmode(f);
      GetOpenFile(f, fptr);
-@@ -346,7 +362,7 @@ img_from_xpmfname(klass, fname)
+@@ -346,7 +349,7 @@ img_from_xpmfname(klass, fname)
  
      /* need cast, and the argument is char* type */
 -    iptr = (gdImagePtr)gdImageCreateFromXpm(fptr->path);
@@ -304,14 +292,14 @@
 +        rb_raise(rb_eArgError, "%s is not a valid XPM File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -360,5 +376,5 @@ img_from_jpeg(klass, f)
+@@ -360,5 +363,5 @@ img_from_jpeg(klass, f)
      VALUE klass, f;
  {
 -    OpenFile *fptr;
 +    rb_io_t *fptr;
      gdImagePtr iptr;
  
-@@ -368,7 +384,7 @@ img_from_jpeg(klass, f)
+@@ -368,7 +371,7 @@ img_from_jpeg(klass, f)
      rb_io_check_readable(fptr);
      
 -    iptr = gdImageCreateFromJpeg(fptr->f);
@@ -321,7 +309,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Jpeg File", RB_IO_PATH(fptr));
  
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -380,17 +396,17 @@ img_from_jpegfname(klass, fname)
+@@ -380,17 +383,17 @@ img_from_jpegfname(klass, fname)
  {
      VALUE f;
 -    OpenFile *fptr;
@@ -343,7 +331,7 @@
 +        rb_raise(rb_eArgError, "%s is not a valid Jpeg File", RB_IO_PATH(fptr));
                   
      return Data_Wrap_Struct(klass,0,free_img,iptr);
-@@ -419,10 +435,10 @@ hex2triplet(hex)
+@@ -419,10 +422,10 @@ hex2triplet(hex)
      Check_Type(hex, T_STRING);
      
 -    if (RSTRING(hex)->len != 7)
@@ -359,7 +347,7 @@
 +    bstr = rb_str_new(RSTRING_PTR(hex) + 5, 2);
  
      ret_ary = rb_ary_new();
-@@ -460,7 +476,7 @@ img_color_allocate_str(img, rgbstr)
+@@ -460,7 +463,7 @@ img_color_allocate_str(img, rgbstr)
      ary = hex2triplet(rgbstr);
      c = gdImageColorAllocate(im,
 -                             NUM2INT(*(RARRAY(ary)->ptr)),
@@ -370,7 +358,7 @@
 +                             NUM2INT(*(RARRAY_PTR(ary)+2)));
      return INT2FIX(c);
  }
-@@ -533,7 +549,7 @@ img_color_resolve_str(img, rgbstr)
+@@ -533,7 +536,7 @@ img_color_resolve_str(img, rgbstr)
      ary = hex2triplet(rgbstr);
      c = gdImageColorResolve(im,
 -                            NUM2INT(*(RARRAY(ary)->ptr)),
@@ -381,7 +369,7 @@
 +                            NUM2INT(*(RARRAY_PTR(ary)+2)));
  
      return INT2FIX(c);
-@@ -596,7 +612,7 @@ img_color_closest_str(img, rgbstr)
+@@ -596,7 +599,7 @@ img_color_closest_str(img, rgbstr)
      ary = hex2triplet(rgbstr);



Home | Main Index | Thread Index | Old Index