glib2 4.0.3 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffb0680897893bf81e94d3a5cfb8c271bf8ff785712a36c29b9a5f9afd0f0d6f
4
- data.tar.gz: bf76c18a85f67ce4f1ccbab25841c09f99bddd1b191b39744b90e306685ba946
3
+ metadata.gz: f7926c6f46ecefebbd076553fd03848564c70d5674206bc00d636b8ba776790e
4
+ data.tar.gz: 6715f80c40625e14d63c9423057395c3bda87ea758db05cc2291ebf477e51836
5
5
  SHA512:
6
- metadata.gz: e8c5c081d51ac5365b4797ceac91fedd1847c1f24f074f3b6afbd73a7c1f6b85ce110b7ea92b01b4f5dd211644e541da965d241a837aa0862aef578c9988eaa2
7
- data.tar.gz: 77d472fd1de8f0339829b61b6a8b527ab5db3c022034fb1eda839e011dbe50db749c8dfe9f36d326baf3cd9c7d7849bfbe41c4c191fb7f2eed7773bd6dc2bd3f
6
+ metadata.gz: d65c4f2210c78150e61295a4d5bc24a8ef3d07745dc9a5dafd94863e2cdd871f22b0750a40fce61510c88eb79db713860c1c1294036ea7990a78842dca664029
7
+ data.tar.gz: 8c20a8cbe5c7ac23ee1eaaae3d38f478f5d30968394e80ce348332ad85db5ed9d30ecdbd187a050c99c4999f5a8af85c1f0623d27a32fc90698fde0d83dd55a7
data/ext/glib2/rbglib.h CHANGED
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 4
35
35
  #define RBGLIB_MINOR_VERSION 0
36
- #define RBGLIB_MICRO_VERSION 3
36
+ #define RBGLIB_MICRO_VERSION 4
37
37
 
38
38
  #ifndef RB_ZALLOC
39
39
  # ifdef ZALLOC
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2021 Ruby-GNOME Project Team
3
+ * Copyright (C) 2011-2022 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2004 Masao Mutoh
5
5
  * Copyright (C) 2004 Kazuhiro NISHIYAMA
6
6
  *
@@ -230,11 +230,45 @@ Init_glib_spawn(void)
230
230
  RG_DEF_SMETHOD(command_line_async, 1);
231
231
  RG_DEF_SMETHOD(close_pid, 1);
232
232
 
233
- rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_DESCRIPTORS_OPEN", INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN));
234
- rb_define_const(RG_TARGET_NAMESPACE, "DO_NOT_REAP_CHILD", INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD));
235
- rb_define_const(RG_TARGET_NAMESPACE, "SEARCH_PATH", INT2NUM(G_SPAWN_SEARCH_PATH));
236
- rb_define_const(RG_TARGET_NAMESPACE, "STDOUT_TO_DEV_NULL", INT2NUM(G_SPAWN_STDOUT_TO_DEV_NULL));
237
- rb_define_const(RG_TARGET_NAMESPACE, "STDERR_TO_DEV_NULL", INT2NUM(G_SPAWN_STDERR_TO_DEV_NULL));
238
- rb_define_const(RG_TARGET_NAMESPACE, "CHILD_INHERITS_STDIN", INT2NUM(G_SPAWN_CHILD_INHERITS_STDIN));
239
- rb_define_const(RG_TARGET_NAMESPACE, "FILE_AND_ARGV_ZERO", INT2NUM(G_SPAWN_FILE_AND_ARGV_ZERO));
233
+ rb_define_const(RG_TARGET_NAMESPACE,
234
+ "DEFAULT",
235
+ INT2NUM(G_SPAWN_DEFAULT));
236
+ rb_define_const(RG_TARGET_NAMESPACE,
237
+ "LEAVE_DESCRIPTORS_OPEN",
238
+ INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN));
239
+ rb_define_const(RG_TARGET_NAMESPACE,
240
+ "DO_NOT_REAP_CHILD",
241
+ INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD));
242
+ rb_define_const(RG_TARGET_NAMESPACE,
243
+ "SEARCH_PATH",
244
+ INT2NUM(G_SPAWN_SEARCH_PATH));
245
+ rb_define_const(RG_TARGET_NAMESPACE,
246
+ "STDOUT_TO_DEV_NULL",
247
+ INT2NUM(G_SPAWN_STDOUT_TO_DEV_NULL));
248
+ rb_define_const(RG_TARGET_NAMESPACE,
249
+ "STDERR_TO_DEV_NULL",
250
+ INT2NUM(G_SPAWN_STDERR_TO_DEV_NULL));
251
+ rb_define_const(RG_TARGET_NAMESPACE,
252
+ "CHILD_INHERITS_STDIN",
253
+ INT2NUM(G_SPAWN_CHILD_INHERITS_STDIN));
254
+ rb_define_const(RG_TARGET_NAMESPACE,
255
+ "FILE_AND_ARGV_ZERO",
256
+ INT2NUM(G_SPAWN_FILE_AND_ARGV_ZERO));
257
+ rb_define_const(RG_TARGET_NAMESPACE,
258
+ "SEARCH_PATH_FROM_ENVP",
259
+ INT2NUM(G_SPAWN_SEARCH_PATH_FROM_ENVP));
260
+ rb_define_const(RG_TARGET_NAMESPACE,
261
+ "CLOEXEC_PIPES",
262
+ INT2NUM(G_SPAWN_CLOEXEC_PIPES));
263
+ #if GLIB_CHECK_VERSION(2, 74, 0)
264
+ rb_define_const(RG_TARGET_NAMESPACE,
265
+ "CHILD_INHERITS_STDOUT",
266
+ INT2NUM(G_SPAWN_CHILD_INHERITS_STDOUT));
267
+ rb_define_const(RG_TARGET_NAMESPACE,
268
+ "CHILD_INHERITS_STDERR",
269
+ INT2NUM(G_SPAWN_CHILD_INHERITS_STDERR));
270
+ rb_define_const(RG_TARGET_NAMESPACE,
271
+ "STDIN_FROM_DEV_NULL",
272
+ INT2NUM(G_SPAWN_STDIN_FROM_DEV_NULL));
273
+ #endif
240
274
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2004-2021 Ruby-GNOME Project Team
3
+ * Copyright (C) 2004-2022 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2002,2003 Masahiro Sakai
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -19,6 +19,10 @@
19
19
  * MA 02110-1301 USA
20
20
  */
21
21
 
22
+ /* This is for suppressing warnings for GValueArray.
23
+ * We support GValueArray because GStreamer still uses it. */
24
+ #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30
25
+
22
26
  #include "rbgprivate.h"
23
27
 
24
28
  #define DEF_NUMERIC_PSPEC_METHODS_FUNC(pspec_type, typename, from_ruby, to_ruby, pspec_cast) \
@@ -198,6 +202,20 @@ pointer_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE flags)
198
202
  return Qnil;
199
203
  }
200
204
 
205
+ static VALUE
206
+ value_array_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
207
+ VALUE element_spec, VALUE flags)
208
+ {
209
+ GParamSpec *pspec;
210
+ pspec = g_param_spec_value_array(StringValuePtr(name),
211
+ StringValuePtr(nick),
212
+ StringValuePtr(blurb),
213
+ RVAL2GOBJ(element_spec),
214
+ NUM2UINT(flags));
215
+ rbgobj_param_spec_initialize(self, pspec);
216
+ return Qnil;
217
+ }
218
+
201
219
  static VALUE
202
220
  object_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb,
203
221
  VALUE object_type, VALUE flags)
@@ -288,6 +306,9 @@ Init_gobject_gparamspecs(void)
288
306
  c = G_DEF_CLASS(G_TYPE_PARAM_POINTER, "Pointer", cParamSpec);
289
307
  rbg_define_method(c, "initialize", pointer_initialize, 4);
290
308
 
309
+ c = G_DEF_CLASS(G_TYPE_PARAM_VALUE_ARRAY, "ValueArray", cParamSpec);
310
+ rbg_define_method(c, "initialize", value_array_initialize, 5);
311
+
291
312
  c = G_DEF_CLASS(G_TYPE_PARAM_OBJECT, "Object", cParamSpec);
292
313
  rbg_define_method(c, "initialize", object_initialize, 5);
293
314
  }
@@ -418,8 +418,10 @@ gobj_sig_connect_impl(gboolean after, int argc, VALUE *argv, VALUE self)
418
418
  rclosure, after);
419
419
  VALUE rb_handler_id = ULONG2NUM(handler_id);
420
420
  if (handler_id != 0) {
421
- VALUE rb_connected_closures = rb_ivar_get(self, id_connected_closures);
422
- if (NIL_P(rb_connected_closures)) {
421
+ VALUE rb_connected_closures;
422
+ if (RVAL2CBOOL(rb_ivar_defined(self, id_connected_closures))) {
423
+ rb_connected_closures = rb_ivar_get(self, id_connected_closures);
424
+ } else {
423
425
  rb_connected_closures = rb_hash_new();
424
426
  rb_ivar_set(self, id_connected_closures, rb_connected_closures);
425
427
  }
@@ -66,8 +66,10 @@ static void
66
66
  cinfo_free(void *data)
67
67
  {
68
68
  RGObjClassInfo *cinfo = data;
69
+ g_hash_table_remove(gtype_to_cinfo, GUINT_TO_POINTER(cinfo->gtype));
69
70
  xfree(cinfo->name);
70
71
  xfree(cinfo->data_type);
72
+ xfree(cinfo);
71
73
  }
72
74
 
73
75
  static RGObjClassInfo *
@@ -106,6 +108,7 @@ rbgobj_class_info_create_data_type(VALUE klass)
106
108
  rb_data_type_t *data_type;
107
109
 
108
110
  data_type = RB_ZALLOC(rb_data_type_t);
111
+ data_type->wrap_struct_name = "RGObjClassInfo";
109
112
  data_type->function.dmark = cinfo_mark;
110
113
  data_type->function.dfree = cinfo_free;
111
114
  if (RB_TYPE_P(klass, RUBY_T_CLASS) && klass != rb_cObject) {
@@ -0,0 +1,104 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011-2022 Ruby-GNOME Project Team
4
+ * Copyright (C) 2006 Sjoerd Simons
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ /* This is for suppressing warnings for GValueArray.
23
+ * We support GValueArray because GStreamer still uses it. */
24
+ #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30
25
+
26
+ #include "rbgprivate.h"
27
+
28
+ static VALUE
29
+ value_array_to_ruby(const GValue *from)
30
+ {
31
+ VALUE ary;
32
+ guint i;
33
+
34
+ GValueArray *array = (GValueArray *)g_value_get_boxed(from);
35
+ if (array == NULL)
36
+ return Qnil;
37
+
38
+ ary = rb_ary_new();
39
+ for (i = 0; i < array->n_values; i++)
40
+ rb_ary_push(ary, GVAL2RVAL(g_value_array_get_nth(array, i)));
41
+
42
+ return ary;
43
+ }
44
+
45
+ struct value_array_from_ruby_args {
46
+ VALUE ary;
47
+ long n;
48
+ GValueArray *result;
49
+ };
50
+
51
+ static VALUE
52
+ value_array_from_ruby_body(VALUE value)
53
+ {
54
+ long i;
55
+ struct value_array_from_ruby_args *args = (struct value_array_from_ruby_args *)value;
56
+
57
+ for (i = 0; i < args->n; i++) {
58
+ GValue v = G_VALUE_INIT;
59
+
60
+ g_value_init(&v, RVAL2GTYPE(RARRAY_PTR(args->ary)[i]));
61
+ rbgobj_rvalue_to_gvalue(RARRAY_PTR(args->ary)[i], &v);
62
+
63
+ g_value_array_append(args->result, &v);
64
+ }
65
+
66
+ return Qnil;
67
+ }
68
+
69
+ static G_GNUC_NORETURN VALUE
70
+ value_array_from_ruby_rescue(VALUE value, VALUE error)
71
+ {
72
+ g_value_array_free(((struct value_array_from_ruby_args *)value)->result);
73
+
74
+ rb_exc_raise(error);
75
+ }
76
+
77
+ static void
78
+ value_array_from_ruby(const VALUE from, GValue *to)
79
+ {
80
+ struct value_array_from_ruby_args args;
81
+
82
+ if (NIL_P(from)) {
83
+ g_value_set_boxed(to, NULL);
84
+
85
+ return;
86
+ }
87
+
88
+ args.ary = rb_ary_to_ary(from);
89
+ args.n = RARRAY_LEN(args.ary);
90
+ args.result = g_value_array_new((guint)args.n);
91
+
92
+ rb_rescue(value_array_from_ruby_body, (VALUE)&args,
93
+ value_array_from_ruby_rescue, (VALUE)&args);
94
+
95
+ g_value_set_boxed(to, args.result);
96
+ }
97
+
98
+ void
99
+ Init_gobject_value_array(void)
100
+ {
101
+ /* ValueArray is treated as Array */
102
+ rbgobj_register_g2r_func(G_TYPE_VALUE_ARRAY, value_array_to_ruby);
103
+ rbgobj_register_r2g_func(G_TYPE_VALUE_ARRAY, value_array_from_ruby);
104
+ }
@@ -23,7 +23,7 @@
23
23
  #include "rbgobject.h"
24
24
 
25
25
  static const rb_data_type_t rbg_pointer_type = {
26
- "GLib::Poitner",
26
+ "GLib::Pointer",
27
27
  {
28
28
  NULL,
29
29
  NULL,
@@ -43,9 +43,9 @@ gpointer
43
43
  rbgobj_ptr2cptr(VALUE ptr)
44
44
  {
45
45
  gpointer dest;
46
- if (rb_obj_is_kind_of(ptr, GTYPE2CLASS(G_TYPE_POINTER))){
46
+ if (RVAL2CBOOL(rb_obj_is_kind_of(ptr, GTYPE2CLASS(G_TYPE_POINTER)))) {
47
47
  TypedData_Get_Struct(ptr, void, &rbg_pointer_type, dest);
48
- } else if (rb_obj_is_kind_of(ptr, rb_cObject)){
48
+ } else if (RVAL2CBOOL(rb_obj_is_kind_of(ptr, rb_cObject))) {
49
49
  dest = (gpointer)ptr;
50
50
  } else{
51
51
  rb_raise(rb_eTypeError, "not a pointer object");
@@ -53,25 +53,51 @@ rbgobj_ptr2cptr(VALUE ptr)
53
53
  return dest;
54
54
  }
55
55
 
56
+ static VALUE
57
+ ptr_alloc(VALUE klass)
58
+ {
59
+ gpointer pointer;
60
+ return TypedData_Make_Struct(klass,
61
+ gpointer,
62
+ &rbg_pointer_type,
63
+ pointer);
64
+ }
65
+
66
+
56
67
  static VALUE
57
68
  ptr_s_gtype(VALUE klass)
58
69
  {
59
70
  return rbgobj_gtype_new(rbgobj_lookup_class(klass)->gtype);
60
71
  }
61
72
 
73
+ static VALUE
74
+ ptr_initialize(VALUE self, VALUE address)
75
+ {
76
+ RTYPEDDATA_DATA(self) = NUM2POINTER(address);
77
+ return RUBY_Qnil;
78
+ }
79
+
62
80
  static VALUE
63
81
  ptr_gtype(VALUE self)
64
82
  {
65
83
  return ptr_s_gtype(CLASS_OF(self));
66
84
  }
67
85
 
86
+ static VALUE
87
+ ptr_to_i(VALUE self)
88
+ {
89
+ return POINTER2NUM(rbgobj_ptr2cptr(self));
90
+ }
91
+
68
92
  static void
69
93
  Init_gtype_pointer(void)
70
94
  {
71
95
  VALUE cPtr = G_DEF_CLASS(G_TYPE_POINTER, "Pointer", rbg_mGLib());
72
- rb_undef_alloc_func(cPtr);
73
- rbg_define_singleton_method(cPtr, "gtype", ptr_s_gtype, 1);
74
- rbg_define_method(cPtr, "gtype", ptr_gtype, 1);
96
+ rb_define_alloc_func(cPtr, ptr_alloc);
97
+ rbg_define_singleton_method(cPtr, "gtype", ptr_s_gtype, 0);
98
+ rbg_define_method(cPtr, "initialize", ptr_initialize, 1);
99
+ rbg_define_method(cPtr, "gtype", ptr_gtype, 0);
100
+ rbg_define_method(cPtr, "to_i", ptr_to_i, 0);
75
101
  }
76
102
 
77
103
  /**********************************************************************/
@@ -390,6 +390,7 @@ Init_gobject(void)
390
390
  Init_gobject_gvaluetypes();
391
391
  Init_gobject_gboxed();
392
392
  Init_gobject_gstrv();
393
+ Init_gobject_value_array();
393
394
  Init_gobject_genumflags();
394
395
  Init_gobject_gparam();
395
396
  Init_gobject_gparamspecs();
@@ -28,7 +28,9 @@
28
28
  * Ubuntu 20.04: GLib 2.64
29
29
  * Ubuntu 22.04: GLib 2.72
30
30
  */
31
- #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_50
31
+ #ifndef GLIB_VERSION_MIN_REQUIRED
32
+ # define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_50
33
+ #endif
32
34
 
33
35
  #define G_LOG_DOMAIN "Ruby/GLib2"
34
36
 
@@ -189,6 +191,7 @@ G_GNUC_INTERNAL void Init_gobject_gvalue(void);
189
191
  G_GNUC_INTERNAL void Init_gobject_gvaluetypes(void);
190
192
  G_GNUC_INTERNAL void Init_gobject_gboxed(void);
191
193
  G_GNUC_INTERNAL void Init_gobject_gstrv(void);
194
+ G_GNUC_INTERNAL void Init_gobject_value_array(void);
192
195
  G_GNUC_INTERNAL void Init_gobject_genumflags(void);
193
196
  G_GNUC_INTERNAL void Init_gobject_genums(void);
194
197
  G_GNUC_INTERNAL void Init_gobject_gflags(void);
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-2022 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- module GNOME2
17
+ module GNOME
18
18
  module Rake
19
19
  class ExternalPackage < Struct.new(:name,
20
20
  :download_name,
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-2022 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- module GNOME2
17
+ module GNOME
18
18
  module Rake
19
19
  class NativeBinaryBuildTask
20
20
  def initialize(package)
@@ -0,0 +1,217 @@
1
+ # Copyright(C) 2011-2022 Ruby-GNOME Project.
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "find"
18
+ require "pathname"
19
+
20
+ require "rubygems"
21
+ require "rubygems/package_task"
22
+ require_relative "package"
23
+ require_relative "external-package"
24
+ require_relative "source-download-task"
25
+ require_relative "native-binary-build-task"
26
+ require_relative "windows-binary-download-task"
27
+ require_relative "windows-binary-build-task"
28
+
29
+ module GNOME
30
+ module Rake
31
+ class PackageTask
32
+ class << self
33
+ def define(spec, root_dir, &block)
34
+ new(spec, root_dir, &block).define
35
+ end
36
+ end
37
+
38
+ include ::Rake::DSL
39
+
40
+ attr_accessor :name, :summary, :description, :author, :email, :homepage, :required_ruby_version, :post_install_message
41
+ attr_reader :root_dir
42
+ def initialize(spec=nil, root_dir=nil)
43
+ @spec = spec
44
+ initialize_variables
45
+ initialize_configurations
46
+ if @spec
47
+ @package = Package.new(@spec.name, root_dir)
48
+ else
49
+ file, line, method = caller[1].scan(/^(.*):(\d+)(?::.*`(.*)')?\Z/).first
50
+ root_dir = File.dirname(file)
51
+ @package = Package.new(File.basename(root_dir), root_dir)
52
+ end
53
+ @packages = FileList["#{@package.root_dir.parent}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact
54
+ @name = @package.name
55
+ @cross_compiling_hooks = []
56
+ yield(self) if block_given?
57
+ end
58
+
59
+ def cross_compiling(&block)
60
+ warn("cross compile support is dropped.")
61
+ @cross_compiling_hooks << block
62
+ end
63
+
64
+ def define
65
+ task :default => :build
66
+ define_spec
67
+ define_package_tasks
68
+ end
69
+
70
+ # Deprecated. Use #define instead.
71
+ def define_tasks
72
+ define
73
+ end
74
+
75
+ def ruby_gnome2_package?(name)
76
+ @packages.include?(name)
77
+ end
78
+
79
+ def dependency
80
+ @dependency_configuration
81
+ end
82
+
83
+ def package
84
+ @package
85
+ end
86
+
87
+ def windows
88
+ @package.windows
89
+ end
90
+
91
+ def native
92
+ @package.native
93
+ end
94
+
95
+ def version
96
+ ENV["VERSION"] || guess_version
97
+ end
98
+
99
+ def guess_version
100
+ versions = {}
101
+ File.open("#{@package.glib2_root_dir}/ext/glib2/rbglib.h") do |rbglib_h|
102
+ rbglib_h.each_line do |line|
103
+ if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
104
+ versions[$1.downcase] = $2.to_i
105
+ end
106
+ end
107
+ end
108
+ ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".")
109
+ end
110
+
111
+ def external_packages
112
+ @package.external_packages
113
+ end
114
+
115
+ def external_packages=(packages)
116
+ @package.external_packages = packages
117
+ end
118
+
119
+ def windows_binary_build_task
120
+ @windows_binary_build_task ||= WindowsBinaryBuildTask.new(@package)
121
+ end
122
+
123
+ private
124
+ def initialize_variables
125
+ @summary = ""
126
+ @description = ""
127
+ @author = "The Ruby-GNOME2 Project Team"
128
+ @email = "ruby-gnome2-devel-en@lists.sourceforge.net"
129
+ @homepage = "https://ruby-gnome2.osdn.jp/"
130
+ @external_packages = []
131
+ end
132
+
133
+ def initialize_configurations
134
+ @dependency_configuration = DependencyConfiguration.new(self)
135
+ end
136
+
137
+ def define_spec
138
+ @spec ||= Gem::Specification.new do |s|
139
+ warn("spec generation is deprecated. Use .gemspec instead.")
140
+ s.name = @name
141
+ s.summary = @summary
142
+ s.description = @description
143
+ s.author = @author
144
+ s.email = @email
145
+ s.homepage = @homepage
146
+ s.licenses = ["LGPL-2.1+"]
147
+ s.version = version
148
+ extensions = FileList["ext/#{@name}/extconf.rb",
149
+ "dependency-check/Rakefile"]
150
+ extensions.existing!
151
+ s.extensions = extensions
152
+ s.require_paths = ["lib"]
153
+ files = FileList["ChangeLog", "README",
154
+ "Rakefile", "extconf.rb",
155
+ "dependency-check/Rakefile",
156
+ "lib/**/*.rb",
157
+ "ext/**/depend",
158
+ "ext/**/*.{c,h,def,rb}",
159
+ "{sample,test}/**/*"]
160
+ files.existing!
161
+ s.files = files
162
+ s.required_ruby_version = @required_ruby_version || ">= 2.1.0"
163
+ s.post_install_message = @post_install_message
164
+ @dependency_configuration.apply(s)
165
+ end
166
+ end
167
+
168
+ def define_package_tasks
169
+ Gem::PackageTask.new(@spec) do |pkg|
170
+ end
171
+ end
172
+
173
+ class DependencyConfiguration
174
+ attr_accessor :platform, :ruby
175
+ def initialize(package)
176
+ @package = package
177
+ @platform = Gem::Platform::RUBY
178
+ @gem_configuration = GemConfiguration.new(@package)
179
+ end
180
+
181
+ def gem
182
+ @gem_configuration
183
+ end
184
+
185
+ def apply(spec)
186
+ spec.platform = @platform
187
+ @gem_configuration.apply(spec)
188
+ end
189
+
190
+ class GemConfiguration
191
+ attr_accessor :runtime, :development
192
+ def initialize(package)
193
+ @package = package
194
+ @runtime = []
195
+ @development = []
196
+ end
197
+
198
+ def apply(spec)
199
+ @runtime.each do |dependency|
200
+ spec.add_runtime_dependency(*append_version(dependency))
201
+ end
202
+
203
+ @development.each do |dependency|
204
+ spec.add_development_dependency(*append_version(dependency))
205
+ end
206
+ end
207
+
208
+ def append_version(dependency)
209
+ name, *ver = dependency.is_a?(Array) ? dependency : [dependency]
210
+ ver << "= #{@package.version}" if @package.ruby_gnome2_package?(name)
211
+ [name, *ver]
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2013-2015 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2013-2022 Ruby-GNOME Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
18
18
 
19
19
  require "pathname"
20
20
 
21
- module GNOME2
21
+ module GNOME
22
22
  module Rake
23
23
  class Package
24
24
  attr_reader :name
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-2022 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- module GNOME2
17
+ module GNOME
18
18
  module Rake
19
19
  class SourceDownloadTask
20
20
  def initialize(package)
@@ -0,0 +1,45 @@
1
+ # Copyright(C) 2012-2022 Ruby-GNOME Project.
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module GNOME
18
+ module Rake
19
+ class WindowsBinaryBuildTask
20
+ def initialize(package)
21
+ @package = package
22
+ end
23
+
24
+ def define
25
+ end
26
+
27
+ def rcairo_binary_base_dir
28
+ rcairo_dir + "vendor" + "local"
29
+ end
30
+
31
+ def glib2_binary_base_dir
32
+ @package.glib2_root_dir + "vendor" + "local"
33
+ end
34
+
35
+ def binary_base_dir(package)
36
+ @package.project_root_dir + package + "vendor" + "local"
37
+ end
38
+
39
+ private
40
+ def rcairo_dir
41
+ @package.project_root_dir.parent + "rcairo"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright(C) 2010-2022 Ruby-GNOME Project.
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module GNOME
18
+ module Rake
19
+ class WindowsBinaryDownloadTask
20
+ URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries"
21
+ def initialize(package)
22
+ @package = package
23
+ end
24
+
25
+ def define
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,205 +1,25 @@
1
- # Copyright(C) 2011-2019 Ruby-GNOME2 Project.
1
+ # Copyright(C) 2011-2022 Ruby-GNOME Project.
2
2
  #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3
16
  # This program is licenced under the same license of Ruby-GNOME2.
4
17
 
5
- require "find"
6
- require "pathname"
7
-
8
- require "rubygems"
9
- require "rubygems/package_task"
10
- require "gnome2/rake/package"
11
- require "gnome2/rake/external-package"
12
- require "gnome2/rake/source-download-task"
13
- require "gnome2/rake/native-binary-build-task"
14
- require "gnome2/rake/windows-binary-download-task"
15
- require "gnome2/rake/windows-binary-build-task"
18
+ # Just for backward compatibility.
19
+ require "gnome/rake/package-task"
16
20
 
17
21
  module GNOME2
18
22
  module Rake
19
- class PackageTask
20
- class << self
21
- def define(spec, root_dir, &block)
22
- new(spec, root_dir, &block).define
23
- end
24
- end
25
-
26
- include ::Rake::DSL
27
-
28
- attr_accessor :name, :summary, :description, :author, :email, :homepage, :required_ruby_version, :post_install_message
29
- attr_reader :root_dir
30
- def initialize(spec=nil, root_dir=nil)
31
- @spec = spec
32
- initialize_variables
33
- initialize_configurations
34
- if @spec
35
- @package = Package.new(@spec.name, root_dir)
36
- else
37
- file, line, method = caller[1].scan(/^(.*):(\d+)(?::.*`(.*)')?\Z/).first
38
- root_dir = File.dirname(file)
39
- @package = Package.new(File.basename(root_dir), root_dir)
40
- end
41
- @packages = FileList["#{@package.root_dir.parent}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact
42
- @name = @package.name
43
- @cross_compiling_hooks = []
44
- yield(self) if block_given?
45
- end
46
-
47
- def cross_compiling(&block)
48
- warn("cross compile support is dropped.")
49
- @cross_compiling_hooks << block
50
- end
51
-
52
- def define
53
- task :default => :build
54
- define_spec
55
- define_package_tasks
56
- end
57
-
58
- # Deprecated. Use #define instead.
59
- def define_tasks
60
- define
61
- end
62
-
63
- def ruby_gnome2_package?(name)
64
- @packages.include?(name)
65
- end
66
-
67
- def dependency
68
- @dependency_configuration
69
- end
70
-
71
- def package
72
- @package
73
- end
74
-
75
- def windows
76
- @package.windows
77
- end
78
-
79
- def native
80
- @package.native
81
- end
82
-
83
- def version
84
- ENV["VERSION"] || guess_version
85
- end
86
-
87
- def guess_version
88
- versions = {}
89
- File.open("#{@package.glib2_root_dir}/ext/glib2/rbglib.h") do |rbglib_h|
90
- rbglib_h.each_line do |line|
91
- if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
92
- versions[$1.downcase] = $2.to_i
93
- end
94
- end
95
- end
96
- ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".")
97
- end
98
-
99
- def external_packages
100
- @package.external_packages
101
- end
102
-
103
- def external_packages=(packages)
104
- @package.external_packages = packages
105
- end
106
-
107
- def windows_binary_build_task
108
- @windows_binary_build_task ||= WindowsBinaryBuildTask.new(@package)
109
- end
110
-
111
- private
112
- def initialize_variables
113
- @summary = ""
114
- @description = ""
115
- @author = "The Ruby-GNOME2 Project Team"
116
- @email = "ruby-gnome2-devel-en@lists.sourceforge.net"
117
- @homepage = "https://ruby-gnome2.osdn.jp/"
118
- @external_packages = []
119
- end
120
-
121
- def initialize_configurations
122
- @dependency_configuration = DependencyConfiguration.new(self)
123
- end
124
-
125
- def define_spec
126
- @spec ||= Gem::Specification.new do |s|
127
- warn("spec generation is deprecated. Use .gemspec instead.")
128
- s.name = @name
129
- s.summary = @summary
130
- s.description = @description
131
- s.author = @author
132
- s.email = @email
133
- s.homepage = @homepage
134
- s.licenses = ["LGPL-2.1+"]
135
- s.version = version
136
- extensions = FileList["ext/#{@name}/extconf.rb",
137
- "dependency-check/Rakefile"]
138
- extensions.existing!
139
- s.extensions = extensions
140
- s.require_paths = ["lib"]
141
- files = FileList["ChangeLog", "README",
142
- "Rakefile", "extconf.rb",
143
- "dependency-check/Rakefile",
144
- "lib/**/*.rb",
145
- "ext/**/depend",
146
- "ext/**/*.{c,h,def,rb}",
147
- "{sample,test}/**/*"]
148
- files.existing!
149
- s.files = files
150
- s.required_ruby_version = @required_ruby_version || ">= 2.1.0"
151
- s.post_install_message = @post_install_message
152
- @dependency_configuration.apply(s)
153
- end
154
- end
155
-
156
- def define_package_tasks
157
- Gem::PackageTask.new(@spec) do |pkg|
158
- end
159
- end
160
-
161
- class DependencyConfiguration
162
- attr_accessor :platform, :ruby
163
- def initialize(package)
164
- @package = package
165
- @platform = Gem::Platform::RUBY
166
- @gem_configuration = GemConfiguration.new(@package)
167
- end
168
-
169
- def gem
170
- @gem_configuration
171
- end
172
-
173
- def apply(spec)
174
- spec.platform = @platform
175
- @gem_configuration.apply(spec)
176
- end
177
-
178
- class GemConfiguration
179
- attr_accessor :runtime, :development
180
- def initialize(package)
181
- @package = package
182
- @runtime = []
183
- @development = []
184
- end
185
-
186
- def apply(spec)
187
- @runtime.each do |dependency|
188
- spec.add_runtime_dependency(*append_version(dependency))
189
- end
190
-
191
- @development.each do |dependency|
192
- spec.add_development_dependency(*append_version(dependency))
193
- end
194
- end
195
-
196
- def append_version(dependency)
197
- name, *ver = dependency.is_a?(Array) ? dependency : [dependency]
198
- ver << "= #{@package.version}" if @package.ruby_gnome2_package?(name)
199
- [name, *ver]
200
- end
201
- end
202
- end
203
- end
23
+ PackageTask = GNOME::Rake::PackageTask
204
24
  end
205
25
  end
@@ -0,0 +1,24 @@
1
+ # Copyright (C) 2022 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestGLibPointer < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ test "#to_i" do
21
+ pointer = GLib::Pointer.new(0x08)
22
+ assert_equal(0x08, pointer.to_i)
23
+ end
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -128,6 +128,7 @@ files:
128
128
  - ext/glib2/rbgobj_typemodule.c
129
129
  - ext/glib2/rbgobj_typeplugin.c
130
130
  - ext/glib2/rbgobj_value.c
131
+ - ext/glib2/rbgobj_valuearray.c
131
132
  - ext/glib2/rbgobj_valuetypes.c
132
133
  - ext/glib2/rbgobject.c
133
134
  - ext/glib2/rbgobject.h
@@ -149,14 +150,15 @@ files:
149
150
  - lib/glib2/regex.rb
150
151
  - lib/glib2/variant.rb
151
152
  - lib/glib2/version.rb
153
+ - lib/gnome/rake/external-package.rb
154
+ - lib/gnome/rake/native-binary-build-task.rb
155
+ - lib/gnome/rake/package-task.rb
156
+ - lib/gnome/rake/package.rb
157
+ - lib/gnome/rake/source-download-task.rb
158
+ - lib/gnome/rake/windows-binary-build-task.rb
159
+ - lib/gnome/rake/windows-binary-download-task.rb
152
160
  - lib/gnome2-raketask.rb
153
- - lib/gnome2/rake/external-package.rb
154
- - lib/gnome2/rake/native-binary-build-task.rb
155
161
  - lib/gnome2/rake/package-task.rb
156
- - lib/gnome2/rake/package.rb
157
- - lib/gnome2/rake/source-download-task.rb
158
- - lib/gnome2/rake/windows-binary-build-task.rb
159
- - lib/gnome2/rake/windows-binary-download-task.rb
160
162
  - lib/mkmf-gnome.rb
161
163
  - lib/mkmf-gnome2.rb
162
164
  - sample/bookmarkfile.rb
@@ -185,6 +187,7 @@ files:
185
187
  - test/test-key-file.rb
186
188
  - test/test-match-info.rb
187
189
  - test/test-mkenums.rb
190
+ - test/test-pointer.rb
188
191
  - test/test-poll-fd.rb
189
192
  - test/test-regex.rb
190
193
  - test/test-signal.rb
@@ -1,33 +0,0 @@
1
- # Copyright(C) 2012-2019 Ruby-GNOME2 Project.
2
- #
3
- # This program is licenced under the same license of Ruby-GNOME2.
4
-
5
- module GNOME2
6
- module Rake
7
- class WindowsBinaryBuildTask
8
- def initialize(package)
9
- @package = package
10
- end
11
-
12
- def define
13
- end
14
-
15
- def rcairo_binary_base_dir
16
- rcairo_dir + "vendor" + "local"
17
- end
18
-
19
- def glib2_binary_base_dir
20
- @package.glib2_root_dir + "vendor" + "local"
21
- end
22
-
23
- def binary_base_dir(package)
24
- @package.project_root_dir + package + "vendor" + "local"
25
- end
26
-
27
- private
28
- def rcairo_dir
29
- @package.project_root_dir.parent + "rcairo"
30
- end
31
- end
32
- end
33
- end
@@ -1,17 +0,0 @@
1
- # Copyright(C) 2010-2019 Ruby-GNOME2 Project.
2
- #
3
- # This program is licenced under the same license of Ruby-GNOME2.
4
-
5
- module GNOME2
6
- module Rake
7
- class WindowsBinaryDownloadTask
8
- URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries"
9
- def initialize(package)
10
- @package = package
11
- end
12
-
13
- def define
14
- end
15
- end
16
- end
17
- end