mtasaka pushed to rubygem-glib2 (f22). "Fix compilation with GLib 2.44 (upstream bug 361)"

notifications at fedoraproject.org notifications at fedoraproject.org
Sun Apr 5 07:00:58 UTC 2015


>From 1919509d60489012a4c91f95606c33bd653fcf69 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka at fedoraproject.org>
Date: Sun, 5 Apr 2015 15:59:53 +0900
Subject: Fix compilation with GLib 2.44 (upstream bug 361)


diff --git a/rubygem-glib2-1.2.1-glibconv-encoding.patch b/rubygem-glib2-1.2.1-glibconv-encoding.patch
deleted file mode 100644
index f36e049..0000000
--- a/rubygem-glib2-1.2.1-glibconv-encoding.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- glib2-1.2.1/test/test_glib2.rb.encoding	2013-02-28 13:32:06.238563593 +0900
-+++ glib2-1.2.1/test/test_glib2.rb	2013-02-28 14:11:05.370613313 +0900
-@@ -31,9 +31,9 @@
-   def test_convert
-     assert_kind_of(String, GLib.charset)
- 
--    sjis = "\202\261\202\361\202\311\202\277\202\315\220\242\212E"
--    euc  = "\244\263\244\363\244\313\244\301\244\317\300\244\263\246"
--    utf8 = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257\344\270\226\347\225\214"
-+    sjis = "\202\261\202\361\202\311\202\277\202\315\220\242\212E".force_encoding("ASCII-8BIT")
-+    euc  = "\244\263\244\363\244\313\244\301\244\317\300\244\263\246".force_encoding("ASCII-8BIT")
-+    utf8 = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257\344\270\226\347\225\214".force_encoding("ASCII-8BIT")
-     assert_equal(GLib.convert(sjis, "UTF-8", "SHIFT_JIS"), utf8)
-     assert_equal(GLib.convert(sjis, "EUC-JP", "SHIFT_JIS"), euc)
-     assert_equal(GLib.convert(sjis, "SHIFT_JIS", "SHIFT_JIS"), sjis)
diff --git a/rubygem-glib2-1.2.6-GLibCompletion-delete.patch b/rubygem-glib2-1.2.6-GLibCompletion-delete.patch
deleted file mode 100644
index 3700b41..0000000
--- a/rubygem-glib2-1.2.6-GLibCompletion-delete.patch
+++ /dev/null
@@ -1,266 +0,0 @@
---- 1.2.5//TMP/ext/glib2/rbglib.c	1970-01-01 09:00:00.000000000 +0900
-+++ 1.2.6//TMP/ext/glib2/rbglib.c	1970-01-01 09:00:00.000000000 +0900
-@@ -1115,7 +1115,6 @@
-     Init_glib_io_channel_win32_socket();
-     Init_glib_shell();
-     Init_glib_shellerror();
--    Init_glib_completion();
-     Init_glib_timer();
-     Init_glib_unicode();
-     Init_glib_utf8();
---- 1.2.5//TMP/ext/glib2/rbglib_completion.c	1970-01-01 09:00:00.000000000 +0900
-+++ 1.2.6//TMP/ext/glib2/rbglib_completion.c	1970-01-01 09:00:00.000000000 +0900
-@@ -1,195 +0,0 @@
--/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
--/*
-- *  Copyright (C) 2011  Ruby-GNOME2 Project Team
-- *  Copyright (C) 2005,2006  Masao Mutoh
-- *
-- *  This library is free software; you can redistribute it and/or
-- *  modify it under the terms of the GNU Lesser General Public
-- *  License as published by the Free Software Foundation; either
-- *  version 2.1 of the License, or (at your option) any later version.
-- *
-- *  This library is distributed in the hope that it will be useful,
-- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- *  Lesser General Public License for more details.
-- *
-- *  You should have received a copy of the GNU Lesser General Public
-- *  License along with this library; if not, write to the Free Software
-- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- *  MA  02110-1301  USA
-- */
--
--#include "rbgprivate.h"
--
--static ID id_compfunc;
--static ID id_call;
--static ID id_to_s;
--static ID id_clear;
--static ID id_items_internal;
--
--/*****************************************/
--static GCompletion*
--completion_copy(GCompletion *comp)
--{
--  GCompletion* new_comp;
--  g_return_val_if_fail (comp != NULL, NULL);
--
--  new_comp = g_new(GCompletion, 1);
--  *new_comp = *comp;
--  return new_comp;
--}
--
--static GType
--g_completion_get_type(void)
--{
--    static GType our_type = 0;
--    if (our_type == 0)
--        our_type = g_boxed_type_register_static ("GCompletion",
--                                                 (GBoxedCopyFunc)completion_copy,
--                                                 (GBoxedFreeFunc)g_completion_free);
--    return our_type;
--}
--/*****************************************/
--
--#define G_TYPE_COMPLETION (g_completion_get_type())
--
--#define RG_TARGET_NAMESPACE cCompletion
--#define _SELF(s) ((GCompletion*)RVAL2BOXED(s, G_TYPE_COMPLETION))
--
--/* data should be [self, data] */
--static gchar *
--comp_func(gpointer compdata)
--{
--    VALUE ret;
--    VALUE self = RARRAY_PTR((VALUE)compdata)[0];
--    VALUE data = RARRAY_PTR((VALUE)compdata)[1];
--
--    VALUE func = rb_ivar_get(self, id_compfunc);
--
--    if (NIL_P(func)){
--        ret = rb_funcall(data, id_to_s, 0);
--    } else {
--        ret = rb_funcall(func, id_call, 1, data);
--    }
--    return (gchar *)RVAL2CSTR(ret);
--}
--
--static VALUE
--rg_initialize(VALUE self)
--{
--    VALUE block = Qnil;
--
--    if (rb_block_given_p()) {
--        block = rb_block_proc();
--    }
--
--    rb_ivar_set(self, id_compfunc, block);
--    /* This is used for memory management(GC) */
--    rb_ivar_set(self, id_items_internal, rb_hash_new());
--
--    G_INITIALIZE(self, g_completion_new((GCompletionFunc)comp_func));
--
--    return Qnil;
--}
--
--static VALUE
--rg_add_items(VALUE self, VALUE items)
--{
--    gint i, len;
--    GList* list = (GList*)NULL;
--    VALUE items_internal = rb_ivar_get(self, id_items_internal);
--
--    items = rb_ary_to_ary(items);
--    len = RARRAY_LEN(items);
--    for (i = 0; i < len; i ++){
--        VALUE data = RARRAY_PTR(items)[i];
--        VALUE item = rb_assoc_new(self, data);
--        list = g_list_append(list, (gpointer)item);
--        rb_hash_aset(items_internal, data, item);
--    }
--    g_completion_add_items(_SELF(self), list);
--
--    return self;
--}
--
--static VALUE
--rg_remove_items(VALUE self, VALUE items)
--{
--    gint i, len;
--    GList* list = (GList*)NULL;
--    VALUE items_internal = rb_ivar_get(self, id_items_internal);
--
--    items = rb_ary_to_ary(items);
--    len = RARRAY_LEN(items);
--    for (i = 0; i < len; i ++){
--        VALUE data = RARRAY_PTR(items)[i];
--        VALUE item = rb_hash_aref(items_internal, data);
--        list = g_list_append(list, (gpointer)item);
--        rb_hash_delete(items_internal, data);
--    }
--    g_completion_remove_items(_SELF(self), list);
--
--    return self;
--}
--
--static VALUE
--rg_clear_items(VALUE self)
--{
--    VALUE items_internal = rb_ivar_get(self, id_items_internal);
--    rb_funcall(items_internal, id_clear, 0);
--    g_completion_clear_items(_SELF(self));
--    return self;
--}
--
--static VALUE
--rg_items(VALUE self)
--{
--    return rb_ivar_get(self, id_items_internal);
--}
--
--static VALUE
--rg_complete(VALUE self, VALUE prefix)
--{
--    gchar* new_prefix;
--    VALUE ary = rb_ary_new();
--#if GLIB_CHECK_VERSION(2,4,0)
--    GList* list = g_completion_complete_utf8(_SELF(self),
--                                            (const gchar*)RVAL2CSTR(prefix),
--                                            &new_prefix);
--#else
--    GList* list = g_completion_complete(_SELF(self),
--                                        RVAL2CSTR(prefix),
--                                        &new_prefix);
--#endif
--    while (list) {
--        rb_ary_push(ary, RARRAY_PTR((VALUE)list->data)[1]);
--        list = list->next;
--    }
--
--    return rb_assoc_new(ary, new_prefix ? CSTR2RVAL(new_prefix) : Qnil);
--}
--
--/* We don't use this.
--void        g_completion_set_compare        (GCompletion *cmp,
--                                             GCompletionStrncmpFunc strncmp_func);
--*/
--
--void
--Init_glib_completion(void)
--{
--    VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_COMPLETION, "Completion", mGLib); 
--
--    id_call = rb_intern("call");
--    id_to_s = rb_intern("to_s");
--    id_clear = rb_intern("clear");
--    id_compfunc = rb_intern("completion_proc");
--    id_items_internal = rb_intern("items_internal");
--
--    RG_DEF_METHOD(initialize, 0);
--    RG_DEF_METHOD(add_items, 1);
--    RG_DEF_METHOD(remove_items, 1);
--    RG_DEF_METHOD(clear_items, 0);
--    RG_DEF_METHOD(complete, 1);
--
--    RG_DEF_METHOD(items, 0);
--}
---- 1.2.5//TMP/ext/glib2/rbgprivate.h	1970-01-01 09:00:00.000000000 +0900
-+++ 1.2.6//TMP/ext/glib2/rbgprivate.h	1970-01-01 09:00:00.000000000 +0900
-@@ -141,7 +141,6 @@
- G_GNUC_INTERNAL void Init_glib_io_channel_win32_socket(void);
- G_GNUC_INTERNAL void Init_glib_shell(void);
- G_GNUC_INTERNAL void Init_glib_shellerror(void);
--G_GNUC_INTERNAL void Init_glib_completion(void);
- G_GNUC_INTERNAL void Init_glib_timer(void);
- G_GNUC_INTERNAL void Init_glib_unicode(void);
- G_GNUC_INTERNAL void Init_glib_utf8(void);
---- 1.2.5//TMP/sample/completion.rb	1970-01-01 09:00:00.000000000 +0900
-+++ 1.2.6//TMP/sample/completion.rb	1970-01-01 09:00:00.000000000 +0900
-@@ -1,45 +0,0 @@
--=begin
--  completion.rb - Sample for GLib::Completion
--
--  Copyright (C) 2005 Ruby-GNOME2 Project Team
--  This program is licenced under the same licence as Ruby-GNOME2.
--
--  $Id: completion.rb,v 1.1 2005/10/14 19:10:07 mutoh Exp $
--=end
--
--require 'glib2'
--
--###########################
--# Simple String completion
--###########################
--ary = ["a_", "a_ab", "aac", "aabc", "aabcd"]
--comp = GLib::Completion.new
--comp.add_items(ary)
--p comp.complete("a_")
--p comp.complete("aab")
--
--puts "-----------"
--
--
--############################
--# Class completion and UTF-8
--############################
--class Test
--  def initialize(str)
--    @str = str
--  end
--  def value
--    @str
--  end
--end
--
--ary2 = [Test.new("あ_"), Test.new("あ_あい"), 
--  Test.new("ああab"), Test.new("ああabc"), Test.new("ああbcd")]
--
--comp2 = GLib::Completion.new {|data|
--  data.value
--}
--
--comp2.add_items(ary2)
--puts %Q$["#{comp2.complete("あ_").join(', "')}"]$
--puts %Q$["#{comp2.complete("ああa").join(', "')}"]$
diff --git a/rubygem-glib2-2.2.3-converter-bigendian64bit.patch b/rubygem-glib2-2.2.3-converter-bigendian64bit.patch
deleted file mode 100644
index b125d1c..0000000
--- a/rubygem-glib2-2.2.3-converter-bigendian64bit.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From dff826dfaa109ad85b4f497846015446a5b316b5 Mon Sep 17 00:00:00 2001
-From: Kouhei Sutou <kou at clear-code.com>
-Date: Sun, 23 Nov 2014 20:48:32 +0900
-Subject: [PATCH] glib2: (maybe) fix a bug that wrong converter is used on
- bigendian environment
-
-GitHub: #270
-
-Reported by mtasaka. Thanks!!!
----
- glib2/ext/glib2/rbgobj_convert.c | 21 ++++++++++++---------
- 1 file changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/glib2/ext/glib2/rbgobj_convert.c b/glib2/ext/glib2/rbgobj_convert.c
-index da2ee2d..fcde0e8 100644
---- a/glib2/ext/glib2/rbgobj_convert.c
-+++ b/glib2/ext/glib2/rbgobj_convert.c
-@@ -1,6 +1,6 @@
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
- /*
-- *  Copyright (C) 2011-2013  Ruby-GNOME2 Project Team
-+ *  Copyright (C) 2011-2014  Ruby-GNOME2 Project Team
-  *  Copyright (C) 2006  Sjoerd Simons, Masao Mutoh
-  *
-  *  This library is free software; you can redistribute it and/or
-@@ -39,9 +39,9 @@ void
- Init_gobject_convert(void)
- {
-     /* TODO: unref the below tables on exit. */
--    tables = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
-+    tables = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
-                                    rg_convert_table_free);
--    class_to_g_type_map = g_hash_table_new(g_int_hash, g_int_equal);
-+    class_to_g_type_map = g_hash_table_new(g_direct_hash, g_direct_equal);
- }
- 
- void
-@@ -49,17 +49,20 @@ rbgobj_convert_define(const RGConvertTable *table)
- {
-     RGConvertTable *copied_table;
-     copied_table = g_memdup(table, sizeof(RGConvertTable));
--    g_hash_table_insert(tables, &(copied_table->type), copied_table);
-+    g_hash_table_insert(tables,
-+                        GUINT_TO_POINTER(copied_table->type),
-+                        copied_table);
-     if (copied_table->klass != Qfalse && !NIL_P(copied_table->klass)) {
-         g_hash_table_insert(class_to_g_type_map,
--                            &(copied_table->klass), &(copied_table->type));
-+                            GUINT_TO_POINTER(copied_table->klass),
-+                            GUINT_TO_POINTER(copied_table->type));
-     }
- }
- 
- RGConvertTable *
- rbgobj_convert_lookup(GType type)
- {
--    return g_hash_table_lookup(tables, &type);
-+    return g_hash_table_lookup(tables, GUINT_TO_POINTER(type));
- }
- 
- gboolean
-@@ -128,11 +131,11 @@ GType
- rbgobj_convert_rvalue2gtype(VALUE value)
- {
-     VALUE klass;
--    GType *result;
-+    gpointer result;
- 
-     klass = rb_class_of(value);
--    result = g_hash_table_lookup(class_to_g_type_map, &klass);
--    return result ? *result : 0;
-+    result = g_hash_table_lookup(class_to_g_type_map, GUINT_TO_POINTER(klass));
-+    return GPOINTER_TO_UINT(result);
- }
- 
- gboolean
diff --git a/rubygem-glib2-2.2.4-compilation-glib244-bug361.patch b/rubygem-glib2-2.2.4-compilation-glib244-bug361.patch
new file mode 100644
index 0000000..5549923
--- /dev/null
+++ b/rubygem-glib2-2.2.4-compilation-glib244-bug361.patch
@@ -0,0 +1,38 @@
+From c5cdb741a9eb72351739e48a38946b87c292c293 Mon Sep 17 00:00:00 2001
+From: Kouhei Sutou <kou at clear-code.com>
+Date: Sat, 4 Apr 2015 15:00:14 +0900
+Subject: [PATCH] glib2: support GLib 2.44
+
+gwin32.h includes an enum type that is available on Windows.
+
+GitHub: fix #361
+
+Reported by Benjamin Maisano. Thanks!!!
+---
+ glib2/ext/glib2/extconf.rb | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/glib2/ext/glib2/extconf.rb b/glib2/ext/glib2/extconf.rb
+index d88d971..1c5cd8d 100644
+--- a/glib2/ext/glib2/extconf.rb
++++ b/glib2/ext/glib2/extconf.rb
+@@ -56,10 +56,18 @@
+ 
+ enum_types_prefix = "glib-enum-types"
+ include_paths = PKGConfig.cflags_only_I("glib-2.0")
++ignore_headers = [
++  "giochannel.h",
++  "gmain.h",
++  "gscanner.h",
++]
++unless (/mingw|cygwin|mswin/ === RUBY_PLATFORM)
++  ignore_headers << "gwin32.h"
++end
+ headers = include_paths.split.inject([]) do |result, path|
+   result + Dir.glob(File.join(path.sub(/^-I/, ""), "glib", "*.h"))
+ end.reject do |file|
+-  /g(iochannel|main|scanner)\.h/ =~ file
++  ignore_headers.include?(File.basename(file))
+ end
+ include_paths = PKGConfig.cflags_only_I("gobject-2.0")
+ headers = include_paths.split.inject(headers) do |result, path|
diff --git a/rubygem-glib2.spec b/rubygem-glib2.spec
index f31c0b7..d452a52 100644
--- a/rubygem-glib2.spec
+++ b/rubygem-glib2.spec
@@ -7,7 +7,7 @@
 Summary:	Ruby binding of GLib-2.x
 Name:		rubygem-%{gem_name}
 Version:	2.2.4
-Release:	2%{?dist}
+Release:	3%{?dist}
 Group:		Development/Languages
 # from README
 License:	LGPLv2
@@ -16,6 +16,10 @@ Source0:	http://rubygems.org/gems/%{gem_name}-%{version}.gem
 # F-19 %%_bindir/ruby wrapper pollutes environ, which makes
 # g_spawn_async() test failure
 Patch100:	rubygem-glib2-1.2.1-rubywrapper-pollutes-env.patch
+# Fix compilation with GLib 2.44
+# https://github.com/ruby-gnome2/ruby-gnome2/issues/361
+# https://github.com/ruby-gnome2/ruby-gnome2/commit/c5cdb741a9eb72351739e48a38946b87c292c293.patch
+Patch201:	rubygem-glib2-2.2.4-compilation-glib244-bug361.patch
 
 Requires:	ruby(release)
 # Explicitly require mri for g_spawn_async() test
@@ -88,6 +92,7 @@ gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
 
 # Patches and etc
 %patch100 -p1
+%patch201 -p2
 
 # Make pkg-config devel dependency (not runtime)
 sed -i \
@@ -221,6 +226,9 @@ popd
 
 
 %changelog
+* Sun Apr  5 2015 Mamoru TASAKA <mtasaka at fedoraproject.org> - 2.2.4-3
+- Fix compilation with GLib 2.44 (upstream bug 361)
+
 * Thu Jan 15 2015 Mamoru TASAKA <mtasaka at fedoraproject.org> - 2.2.4-2
 - F-22: Rebuild for ruby 2.2
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/rubygem-glib2.git/commit/?h=f22&id=1919509d60489012a4c91f95606c33bd653fcf69


More information about the scm-commits mailing list